You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
784 KiB
143 lines
784 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[47,5,6,7,16],{"+NIl":function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(z,L){"use strict";function K(w,g){w.cmdState.push(g)}function N(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var g=w.cmdState.pop();g&&g.closeBracket()}function B(w){for(var g=w.cmdState,v=g.length-1;v>=0;v--){var d=g[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(w,g,v){return function(){this.name=w,this.bracketNo=0,this.style=g,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=k("importmodule","tag",["string","builtin"]),R.documentclass=k("documentclass","tag",["","atom"]),R.usepackage=k("usepackage","tag",["atom"]),R.begin=k("begin","tag",["atom"]),R.end=k("end","tag",["atom"]),R.label=k("label","tag",["atom"]),R.ref=k("ref","tag",["atom"]),R.eqref=k("eqref","tag",["atom"]),R.cite=k("cite","tag",["atom"]),R.bibitem=k("bibitem","tag",["atom"]),R.Bibitem=k("Bibitem","tag",["atom"]),R.RBibitem=k("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function S(w,g){w.f=g}function h(w,g){var v;if(w.match(/^\\[a-zA-Z@]+/)){var d=w.current().slice(1);return v=R.hasOwnProperty(d)?R[d]:R.DEFAULT,v=new v,K(g,v),S(g,P),v.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return S(g,function(l,u){return b(l,u,"\\]")}),"keyword";if(w.match("\\("))return S(g,function(l,u){return b(l,u,"\\)")}),"keyword";if(w.match("$$"))return S(g,function(l,u){return b(l,u,"$$")}),"keyword";if(w.match("$"))return S(g,function(l,u){return b(l,u,"$")}),"keyword";var o=w.next();if(o=="%")return w.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=N(g),v)v.closeBracket(o),S(g,P);else return"error";return"bracket"}else return o=="{"||o=="["?(v=R.DEFAULT,v=new v,K(g,v),"bracket"):/\d/.test(o)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),v=B(g),v.name=="begin"&&(v.argument=w.current()),v.styleIdentifier())}function b(w,g,v){if(w.eatSpace())return null;if(v&&w.match(v))return S(g,h),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=w.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,g){var v=w.peek(),d;return v=="{"||v=="["?(d=N(g),d.openBracket(v),w.eat(v),S(g,h),"bracket"):/[ \t\r]/.test(v)?(w.eat(v),null):(S(g,h),O(g),h(w,g))}return{startState:function(){var w=L.inMathMode?function(g,v){return b(g,v)}:h;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,g){return g.f(w,g)},blankLine:function(w){w.f=h,w.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+ua5":function(Ze,We,J){},"19Vz":function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){q.defineOption("placeholder","",function(k,R,S){var h=S&&S!=q.Init;if(R&&!h)k.on("blur",N),k.on("change",O),k.on("swapDoc",O),q.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){K(k)}),O(k);else if(!R&&h){k.off("blur",N),k.off("change",O),k.off("swapDoc",O),q.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),z(k);var b=k.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}R&&!k.hasFocus()&&N(k)});function z(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function L(k){z(k);var R=k.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=k.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var S=k.getOption("placeholder");typeof S=="string"&&(S=document.createTextNode(S)),R.appendChild(S),k.display.lineSpace.insertBefore(R,k.display.lineSpace.firstChild)}function K(k){setTimeout(function(){var R=!1,S=k.getInputField();S.nodeName=="TEXTAREA"?R=!S.value:k.lineCount()==1&&(R=!/[^\u200b]/.test(S.querySelector(".CodeMirror-line").textContent)),R?L(k):z(k)},20)}function N(k){B(k)&&L(k)}function O(k){var R=k.getWrapperElement(),S=B(k);R.className=R.className.replace(" CodeMirror-empty","")+(S?" CodeMirror-empty":""),S?L(k):z(k)}function B(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(K,N){var O=K.indentUnit,B={},k=N.htmlMode?z:L;for(var R in k)B[R]=k[R];for(var R in N)B[R]=N[R];var S,h;function b(a,x){function y(U){return x.tokenize=U,U(a,x)}var m=a.next();if(m=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(g("atom","]]>")):null:a.match("--")?y(g("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=g("meta","?>"),"meta"):(S=a.eat("/")?"closeTag":"openTag",x.tokenize=P,"tag bracket");if(m=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}b.isInText=!0;function P(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=b,S=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return S="equals",null;if(y=="<"){x.tokenize=b,x.state=u,x.tagName=x.tagStart=null;var m=x.tokenize(a,x);return m?m+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=w(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var x=function(y,m){for(;!y.eol();)if(y.next()==a){m.tokenize=P;break}return"string"};return x.isInAttribute=!0,x}function g(a,x){return function(y,m){for(;!y.eol();){if(y.match(x)){m.tokenize=b;break}y.next()}return a}}function v(a){return function(x,y){for(var m;(m=x.next())!=null;){if(m=="<")return y.tokenize=v(a+1),y.tokenize(x,y);if(m==">")if(a==1){y.tokenize=b;break}else return y.tokenize=v(a-1),y.tokenize(x,y)}return"meta"}}function d(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function u(a,x,y){return a=="openTag"?(y.tagStart=x.column(),C):a=="closeTag"?E:u}function C(a,x,y){return a=="word"?(y.tagName=x.current(),h="tag",T):B.allowMissingTagName&&a=="endTag"?(h="tag bracket",T(a,x,y)):(h="error",C)}function E(a,x,y){if(a=="word"){var m=x.current();return y.context&&y.context.tagName!=m&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==m||B.matchClosing===!1?(h="tag",f):(h="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(h="tag bracket",f(a,x,y)):(h="error",A)}function f(a,x,y){return a!="endTag"?(h="error",f):(o(y),u)}function A(a,x,y){return h="error",f(a,x,y)}function T(a,x,y){if(a=="word")return h="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var m=y.tagName,D=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(m)?l(y,m):(l(y,m),y.context=new d(y,m,D==y.indented)),u}return h="error",T}function p(a,x,y){return a=="equals"?c:(B.allowMissing||(h="error"),T(a,x,y))}function c(a,x,y){return a=="string"?s:a=="word"&&B.allowUnquoted?(h="string",T):(h="error",T(a,x,y))}function s(a,x,y){return a=="string"?s:T(a,x,y)}return{startState:function(a){var x={tokenize:b,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;S=null;var y=x.tokenize(a,x);return(y||S)&&y!="comment"&&(h=null,x.state=x.state(S||y,a,x),h&&(y=h=="error"?y+" error":h)),y},indent:function(a,x,y){var m=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(m&&m.noIndent)return q.Pass;if(a.tokenize!=P&&a.tokenize!=b)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var D=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(D&&D[1])for(;m;)if(m.tagName==D[2]){m=m.prev;break}else if(B.implicitlyClosed.hasOwnProperty(m.tagName))m=m.prev;else break;else if(D)for(;m;){var U=B.contextGrabbers[m.tagName];if(U&&U.hasOwnProperty(D[2]))m=m.prev;else break}for(;m&&m.prev&&!m.startOfLine;)m=m.prev;return m?m.indent+O:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=T)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(Ze,We,J){"use strict";J.d(We,"a",function(){return E});var q=J("+L6B"),z=J("2/Rp"),L=J("2qtc"),K=J("kLXV"),N=J("9og8"),O=J("k1fw"),B=J("miYZ"),k=J("tsqr"),R=J("oBTY"),S=J("tJVT"),h=J("DZo9"),b=J("8z0m"),P=J("WmNS"),w=J.n(P),g=J("cDcd"),v=J.n(g),d=J("m3rI"),o=J("wzkS"),l=J("y5JW"),u=J("LtfV"),C=b.a.Dragger;function E(f){var A=[];return f&&f.length>0&&(A=f.map(function(T){return{uid:T.id,id:T.id,name:T.title+l.c+T.filesize,url:T.url,filesize:T.filesize,status:"done",response:{id:T.id}}})),A}We.b=function(f){var A=f.value,T=f.onChange,p=f.action,c=f.className,s=f.maxSize,a=s===void 0?150:s,x=f.title,y=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,m=f.showRemoveModal,D=m===void 0?!1:m,U=f.accept,F=U===void 0?"":U,W=f.additionalText,M=f.isDragger,I=f.number,H=I===void 0?1e3:I,X=f.aloneClear,ee=X===void 0?!1:X,ae=Object(g.useState)(!1),be=Object(S.a)(ae,2),pe=be[0],ue=be[1],se=Object(g.useState)(A||[]),fe=Object(S.a)(se,2),ne=fe[0],me=fe[1];Object(g.useEffect)(function(){A&&(me(Object(R.a)(A)),H===(A==null?void 0:A.length)&&ue(!0))},[A]);var Q=function(){setTimeout(function(){ne.pop(),me(Object(R.a)(ne))},500)},ie={multiple:!0,disabled:pe,accept:F,withCredentials:!0,fileList:ne,beforeUpload:function(_e,ye){var ve=_e.size/1024/1024;return ne.concat(ye).length>H?(ne.pop(),me(Object(R.a)(ne)),k.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():(Q(),!1)):!0},action:p||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(_e){var ye,ve,Te=Object(R.a)(_e.fileList);if(_e.file.status==="done"&&((ye=_e.file)===null||ye===void 0||((ve=ye.response)===null||ve===void 0)?void 0:ve.status)===-1){var De,Re;k.b.error((De=_e.file)===null||De===void 0||((Re=De.response)===null||Re===void 0)?void 0:Re.message);return}Te.length>=H?ue(!0):ue(!1),me(Object(R.a)(Te)),Te=Te.map(function(Ce){var Le;if(Ce!=null&&(Le=Ce.response)!==null&&Le!==void 0&&Le.id){var ze;Ce.url="/api/attachments/".concat(Ce==null||((ze=Ce.response)===null||ze===void 0)?void 0:ze.id)}return Ce.name.indexOf(l.c)===-1&&(Ce.name="".concat(Ce.name).concat(l.c).concat(Object(l.a)(Ce.size))),Object(O.a)({},Ce)}),console.log("info:",_e),T(Te)},onRemove:function(){var Ee=Object(N.a)(w.a.mark(function ye(ve){var Te;return w.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:if(Te=function(){var Ce=Object(N.a)(w.a.mark(function Le(){var ze,Ve;return w.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(ze=ve.response?ve.response.id:ve.id,!ze){je.next=8;break}return je.next=4,Object(o.d)(ve.response?ve.response.id:ve.uid);case 4:return Ve=je.sent,je.abrupt("return",Ve);case 8:return je.abrupt("return",!0);case 9:case"end":return je.stop()}},Le)}));return function(){return Ce.apply(this,arguments)}}(),!D){Re.next=5;break}return Re.abrupt("return",new Promise(function(Ce,Le){K.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var ze=Object(N.a)(w.a.mark(function Be(){var je;return w.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Te();case 2:je=Xe.sent,k.b.success("\u5220\u9664\u6210\u529F"),Ce(!0);case 5:case"end":return Xe.stop()}},Be)}));function Ve(){return ze.apply(this,arguments)}return Ve}(),onCancel:function(){return Ce(!1)}})}));case 5:return Re.next=7,Te();case 7:return Re.abrupt("return",Re.sent);case 8:case"end":return Re.stop()}},ye)}));function _e(ye){return Ee.apply(this,arguments)}return _e}()};function te(Ee){Ee.preventDefault(),Ee.stopPropagation()}return v.a.createElement("div",{className:"multi-upload ".concat(c||"")},M&&v.a.createElement(C,ie,v.a.createElement("p",{className:"ant-upload-drag-icon"},v.a.createElement(u.a,null)),v.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",v.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!M&&v.a.createElement(b.a,ie,v.a.createElement(z.a,{disabled:pe},y),v.a.createElement("span",{onClick:te,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(Ze,We,J){"use strict";J.d(We,"a",function(){return l});var q=J("Ty5D"),z=J("dI71"),L=J("cDcd"),K=J.n(L),N=J("YS25"),O=J("17x9"),B=J.n(O),k=J("wx14"),R=J("zLVn"),S=J("9R94"),h=function(c){Object(z.a)(s,c);function s(){for(var x,y=arguments.length,m=new Array(y),D=0;D<y;D++)m[D]=arguments[D];return x=c.call.apply(c,[this].concat(m))||this,x.history=Object(N.a)(x.props),x}var a=s.prototype;return a.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},s}(K.a.Component),b=function(c){Object(z.a)(s,c);function s(){for(var x,y=arguments.length,m=new Array(y),D=0;D<y;D++)m[D]=arguments[D];return x=c.call.apply(c,[this].concat(m))||this,x.history=Object(N.b)(x.props),x}var a=s.prototype;return a.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},s}(K.a.Component),P=function(s,a){return typeof s=="function"?s(a):s},w=function(s,a){return typeof s=="string"?Object(N.c)(s,null,null,a):s},g=function(s){return s},v=K.a.forwardRef;typeof v=="undefined"&&(v=g);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,s){var a=c.innerRef,x=c.navigate,y=c.onClick,m=Object(R.a)(c,["innerRef","navigate","onClick"]),D=m.target,U=Object(k.a)({},m,{onClick:function(W){try{y&&y(W)}catch(M){throw W.preventDefault(),M}!W.defaultPrevented&&W.button===0&&(!D||D==="_self")&&!d(W)&&(W.preventDefault(),x())}});return g!==v?U.ref=s||a:U.ref=a,K.a.createElement("a",U)}),l=v(function(c,s){var a=c.component,x=a===void 0?o:a,y=c.replace,m=c.to,D=c.innerRef,U=Object(R.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(F){F||Object(S.a)(!1);var W=F.history,M=w(P(m,F.location),F.location),I=M?W.createHref(M):"",H=Object(k.a)({},U,{href:I,navigate:function(){var ee=P(m,F.location),ae=y?W.replace:W.push;ae(ee)}});return g!==v?H.ref=s||D:H.innerRef=D,K.a.createElement(x,H)})});if(!1)var u,C;var E=function(s){return s},f=K.a.forwardRef;typeof f=="undefined"&&(f=E);function A(){for(var c=arguments.length,s=new Array(c),a=0;a<c;a++)s[a]=arguments[a];return s.filter(function(x){return x}).join(" ")}var T=f(function(c,s){var a=c["aria-current"],x=a===void 0?"page":a,y=c.activeClassName,m=y===void 0?"active":y,D=c.activeStyle,U=c.className,F=c.exact,W=c.isActive,M=c.location,I=c.sensitive,H=c.strict,X=c.style,ee=c.to,ae=c.innerRef,be=Object(R.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(pe){pe||Object(S.a)(!1);var ue=M||pe.location,se=w(P(ee,ue),ue),fe=se.pathname,ne=fe&&fe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ne?Object(q.f)(ue.pathname,{path:ne,exact:F,sensitive:I,strict:H}):null,Q=!!(W?W(me,ue):me),ie=Q?A(U,m):U,te=Q?Object(k.a)({},X,{},D):X,Ee=Object(k.a)({"aria-current":Q&&x||null,className:ie,style:te,to:se},be);return E!==f?Ee.ref=s||ae:Ee.innerRef=ae,K.a.createElement(l,Ee)})});if(!1)var p},"7Cbv":function(Ze,We,J){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),z=new Uint8Array(16);function L(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(z)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function N(P){return typeof P=="string"&&K.test(P)}for(var O=N,B=[],k=0;k<256;++k)B.push((k+256).toString(16).substr(1));function R(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,g=(B[P[w+0]]+B[P[w+1]]+B[P[w+2]]+B[P[w+3]]+"-"+B[P[w+4]]+B[P[w+5]]+"-"+B[P[w+6]]+B[P[w+7]]+"-"+B[P[w+8]]+B[P[w+9]]+"-"+B[P[w+10]]+B[P[w+11]]+B[P[w+12]]+B[P[w+13]]+B[P[w+14]]+B[P[w+15]]).toLowerCase();if(!O(g))throw TypeError("Stringified UUID is invalid");return g}var S=R;function h(P,w,g){P=P||{};var v=P.random||(P.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,w){g=g||0;for(var d=0;d<16;++d)w[g+d]=v[d];return w}return S(v)}var b=We.a=h},"7ahc":function(Ze,We,J){"use strict";J.d(We,"a",function(){return C});var q=J("k1fw"),z=J("0Owb"),L=J("+L6B"),K=J("2/Rp"),N=J("y8nQ"),O=J("Vl3Y"),B=J("tJVT"),k=J("OaEy"),R=J("2fM7"),S=J("cDcd"),h=J.n(S),b=J("VrN/"),P=J.n(b),w=J("p77/"),g=J.n(w),v=J("c5Ni"),d=J.n(v),o=R.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={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"]};We.b=function(E){var f=E.callback,A=E.onCancel,T=Object(S.useState)("python"),p=Object(B.a)(T,2),c=p[0],s=p[1];function a(y){s(u[y][1])}function x(y){f(y)}return h.a.createElement(O.a,Object(z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},h.a.createElement(R.a,{onChange:a},Object.keys(u).map(function(y){return h.a.createElement(o,{key:y,value:y},u[y][0])}))),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},h.a.createElement(C,{mode:c})),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function C(E){var f=E.value,A=E.onChange,T=E.mode,p=E.options,c=p===void 0?{}:p,s=Object(S.useRef)(),a=Object(S.useState)(),x=Object(B.a)(a,2),y=x[0],m=x[1];return Object(S.useEffect)(function(){if(y){function D(U){var F=U.getValue();A&&A(F)}return y.on("change",D),function(){y.off("change",D)}}},[y,A]),Object(S.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(S.useEffect)(function(){y&&((f!==y.getValue()||f==="")&&setTimeout(function(){y.setValue(f||" ")},300))},[y,f]),Object(S.useEffect)(function(){if(s.current&&!y){var D=P.a.fromTextArea(s.current,Object(q.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));m(D)}},[s.current,y]),h.a.createElement("div",{className:"my-codemirror-container"},h.a.createElement("textarea",{ref:s}))}},"8EBN":function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){"use strict";q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var z=0;z<q.modeInfo.length;z++){var L=q.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}q.findModeByMIME=function(K){K=K.toLowerCase();for(var N=0;N<q.modeInfo.length;N++){var O=q.modeInfo[N];if(O.mime==K)return O;if(O.mimes){for(var B=0;B<O.mimes.length;B++)if(O.mimes[B]==K)return O}}if(/\+xml$/.test(K))return q.findModeByMIME("application/xml");if(/\+json$/.test(K))return q.findModeByMIME("application/json")},q.findModeByExtension=function(K){K=K.toLowerCase();for(var N=0;N<q.modeInfo.length;N++){var O=q.modeInfo[N];if(O.ext){for(var B=0;B<O.ext.length;B++)if(O.ext[B]==K)return O}}},q.findModeByFileName=function(K){for(var N=0;N<q.modeInfo.length;N++){var O=q.modeInfo[N];if(O.file&&O.file.test(K))return O}var B=K.lastIndexOf("."),k=B>-1&&K.substring(B+1,K.length);if(k)return q.findModeByExtension(k)},q.findModeByName=function(K){K=K.toLowerCase();for(var N=0;N<q.modeInfo.length;N++){var O=q.modeInfo[N];if(O.name.toLowerCase()==K)return O;if(O.alias){for(var B=0;B<O.alias.length;B++)if(O.alias[B].toLowerCase()==K)return O}}}})},"8hTe":function(Ze,We,J){Ze.exports={button:"button___1wy9m"}},"9Bee":function(Ze,We,J){"use strict";var q=J("DYRE"),z=J("zeV3"),L=J("+L6B"),K=J("2/Rp"),N=J("k1fw"),O=J("tJVT"),B=J("cDcd"),k=J.n(B),R=J("vg9a"),S=J("DlQD"),h=J.n(S),b=J("rUJ1");function P(ue,se){var fe=ue.match(/^(\s+)(?:```)/);if(fe===null)return se;var ne=fe[1];return se.split(`
|
|
`).map(function(me){var Q=me.match(/^\s+/);if(Q===null)return me;var ie=Object(O.a)(Q,1),te=ie[0];return te.length>=ne.length?me.slice(ne.length):me}).join(`
|
|
`)}var w=[],g=["<ul>"],v=new h.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){w.length=0,g=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(ue,se,fe,ne){if(se>=ue.length||ue[se].level<=fe)return se;var me=ue[se];ne.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),se++;var Q=[];return se=u(ue,se,me.level,Q),Q.length>0&&(ne.push("<ul>"),Q.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),se=u(ue,se,fe,ne),se}function C(){return u(w,0,0,g),g.push("</ul>"),g.join("")}var E={heading:function(se){var fe=d.exec(se);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(se){var fe=this.rules.block.fences.exec(se);if(fe){var ne=fe[0],me=P(ne,fe[3]||""),Q=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(Q)>=0){var ie=T(),te=me;me=ie,p[ie]={type:"block",expression:te}}return{type:"code",raw:ne,lang:Q,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,T=function(){return"__special_katext_id_".concat(A++,"__")},p={};function c(){return p}function s(){A=0,p={}}function a(ue){return ue=ue.replace(f,function(se,fe){var ne=T();return p[ne]={type:"inline",expression:fe},ne}),ue}var x=v.listitem;v.listitem=function(ue){return x(a(ue))};var y=v.paragraph;v.paragraph=function(ue){return y(a(ue))};var m=v.tablecell;v.tablecell=function(ue,se){return m(a(ue),se)},v.code=function(ue,se,fe){var ne=(se||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(ue,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(se,'">').concat(fe?ue:Object(b.escape)(ue,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(fe?ue:Object(b.escape)(ue,!0))+"</code></pre>"},v.heading=function(ue,se,fe){var ne=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ne,level:se,text:ue}),"<h"+se+' id="'+ne+'">'+ue+"</h"+se+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:E,renderer:v});var D=h.a,U=J("SJMd"),F=J("ulZh"),W=J.n(F),M=J("m3rI"),I=J("Oy/b"),H=J("p5ED"),X=J("8hTe"),ee=J.n(X),ae=/<pre[^>]*>/g;function be(ue){var se=document.createElement("div");return se.innerHTML=ue,se.childNodes.length===0?"":se.childNodes[0].nodeValue}var pe=We.a=function(ue){var se=ue.value,fe=se===void 0?"":se,ne=ue.edit,me=ne===void 0?!1:ne,Q=ue.className,ie=ue.showTextOnly,te=ue.showLines,Ee=ue.replaces,_e=ue.zoomImg,ye=ue.hasMask,ve=ue.style,Te=ve===void 0?{}:ve,De=ue.stylesPrev,Re=De===void 0?{}:De,Ce=String(fe),Le=Object(B.useRef)(),ze=Object(B.useRef)(),Ve=Object(B.useState)(""),Be=Object(O.a)(Ve,2),je=Be[0],qe=Be[1],Xe=Object(B.useState)("office"),Qe=Object(O.a)(Xe,2),Ae=Qe[0],tt=Qe[1],Je=Object(B.useMemo)(function(){try{var he=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ce=Ce.replace(he,"("+M.a.API_SERVER+"/api/attachments/").replace(Y,'"'+M.a.API_SERVER+"/api/attachments/").replace(Z,'"'+M.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(Pe){}var re=D(Ce),le=c();if(Ce.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",C()),o()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Pe,ke){var Ge=le[ke],it=Ge.type,Me=Ge.expression;return Object(I.renderToString)(be(Me)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),s(),ie){var Se=document.createElement("div");return Se.innerHTML=re,Se.innerText}return setTimeout(function(){return ge()},500),re},[Ce]),Oe=Object(B.useRef)();l.WebkitLineClamp=te,te&&(Te=Object(N.a)(Object(N.a)({},Te),l));function Ue(he){var Y=he.target;if(Y.tagName.toUpperCase()==="IMG"){if(_e){var Z=Y.getAttribute("src");qe(Z),tt("image")}}else if(Y.tagName.toUpperCase()==="A"){var re=Y.getAttribute("href");if(re.indexOf("office")>-1)he.preventDefault(),qe(re),tt("office");else if(re.indexOf("application/pdf")>-1)he.preventDefault(),qe(re),tt("pdf");else if(re.indexOf("text/html")>-1)he.preventDefault(),qe(re),tt("html");else if(re.startsWith("#")){he.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var ge=function(){var Y,Z=(Y=Oe.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Z==null||Z.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(B.useEffect)(function(){if(Oe.current&&Je&&(Je.match(ae)&&window.PR.prettyPrint()),Oe.current)return Oe.current.addEventListener("click",Ue),function(){Oe.current.removeEventListener("click",Ue),s(),o()}},[Je,Oe.current,Ue]);var ce=function(Y){if(!me)return;Y.target.nodeName==="IMG"?(Le.current.style.display="flex",Le.current.style.width=Y.target.clientWidth+"px",Le.current.style.height=Y.target.clientHeight+"px",Le.current.style.top=Y.target.offsetTop+"px",Le.current.style.left=Y.target.offsetLeft+"px",ze.current.src=Y.target.getAttribute("src")):Le.current.style.display="none"};return k.a.createElement("div",{style:{position:"relative"}},k.a.createElement("div",{ref:Oe,style:Object(N.a)({},Te),className:"".concat(Q||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:ce,dangerouslySetInnerHTML:{__html:Je}}),k.a.createElement("div",{ref:Le,className:ee.a.button},k.a.createElement(z.a,null,k.a.createElement(K.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),k.a.createElement(K.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),k.a.createElement("img",{ref:ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),k.a.createElement(H.a,{close:!0,data:je,type:je!=null&&je.length?Ae:"",style:Object(N.a)({},Re),onClose:function(){return qe("")}}))}},"9VGf":function(Ze,We,J){"use strict";J.d(We,"a",function(){return L});var q=J("cDcd"),z=J.n(q);function L(K,N){var O=Object(q.useRef)();Object(q.useEffect)(function(){O.current=K}),Object(q.useEffect)(function(){function B(){O.current()}if(N!==null){var k=setInterval(B,N);return function(){return clearInterval(k)}}},[N])}},BU3w:function(Ze,We,J){"use strict";J.d(We,"a",function(){return O});var q=J("MNnm"),z="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var k=document.querySelector("head");return k||document.body}function K(B){var k,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(q.a)())return null;var S=document.createElement("style");if((k=R.csp)===null||k===void 0?void 0:k.nonce){var h;S.nonce=(h=R.csp)===null||h===void 0?void 0:h.nonce}S.innerHTML=B;var b=L(R),P=b.firstChild;return R.prepend&&b.prepend?b.prepend(S):R.prepend&&P?b.insertBefore(S,P):b.appendChild(S),S}var N=new Map;function O(B,k){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=L(R);if(!N.has(S)){var h=K("",R),b=h.parentNode;N.set(S,b),b.removeChild(h)}var P=Array.from(N.get(S).children).find(function(o){return o.tagName==="STYLE"&&o[z]===k});if(P){var w,g;if(((w=R.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((g=R.csp)===null||g===void 0?void 0:g.nonce)){var v;P.nonce=(v=R.csp)===null||v===void 0?void 0:v.nonce}return P.innerHTML!==B&&(P.innerHTML=B),P}var d=K(B,R);return d[z]=k,d}},Bd2K:function(Ze,We,J){(function(q){q(J("VrN/"),J("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(R,S,h){if(h!=q.Init&&h&&R.removeKeyMap("autoCloseTags"),!S)return;var b={name:"autoCloseTags"};(typeof S!="object"||S.whenClosing!==!1)&&(b["'/'"]=function(P){return O(P)}),(typeof S!="object"||S.whenOpening!==!1)&&(b["'>'"]=function(P){return K(P)}),R.addKeyMap(b)});var z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function K(R){if(R.getOption("disableInput"))return q.Pass;for(var S=R.listSelections(),h=[],b=R.getOption("autoCloseTags"),P=0;P<S.length;P++){if(!S[P].empty())return q.Pass;var w=S[P].head,g=R.getTokenAt(w),v=q.innerMode(R.getMode(),g.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return q.Pass;var u=v.mode.configuration=="html",C=typeof b=="object"&&b.dontCloseTags||u&&z,E=typeof b=="object"&&b.indentTags||u&&L;g.end>w.ch&&(l=l.slice(0,l.length-g.end+w.ch));var f=l.toLowerCase();if(!l||g.type=="string"&&(g.end!=w.ch||!/[\"\']/.test(g.string.charAt(g.string.length-1))||g.string.length==1)||g.type=="tag"&&o.close||g.string.indexOf("/")==w.ch-g.start-1||C&&B(C,f)>-1||k(R,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],l,w,!0))return q.Pass;var A=typeof b=="object"&&b.emptyTags;if(A&&B(A,l)>-1){h[P]={text:"/>",newPos:q.Pos(w.line,w.ch+2)};continue}var T=E&&B(E,f)>-1;h[P]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+l+">",newPos:T?q.Pos(w.line+1,0):q.Pos(w.line,w.ch+1)}}for(var p=typeof b=="object"&&b.dontIndentOnAutoClose,P=S.length-1;P>=0;P--){var c=h[P];R.replaceRange(c.text,S[P].head,S[P].anchor,"+insert");var s=R.listSelections().slice(0);s[P]={head:c.newPos,anchor:c.newPos},R.setSelections(s),!p&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function N(R,S){for(var h=R.listSelections(),b=[],P=S?"/":"</",w=R.getOption("autoCloseTags"),g=typeof w=="object"&&w.dontIndentOnSlash,v=0;v<h.length;v++){if(!h[v].empty())return q.Pass;var d=h[v].head,o=R.getTokenAt(d),l=q.innerMode(R.getMode(),o.state),u=l.state;if(S&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return q.Pass;var C,E=l.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(E&&l.mode.name=="javascript")C=P+"script";else if(E&&l.mode.name=="css")C=P+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!f||f.length&&k(R,f,f[f.length-1],d))return q.Pass;C=P+f[f.length-1]}R.getLine(d.line).charAt(o.end)!=">"&&(C+=">"),b[v]=C}if(R.replaceSelections(b),h=R.listSelections(),!g)for(var v=0;v<h.length;v++)(v==h.length-1||h[v].head.line<h[v+1].head.line)&&R.indentLine(h[v].head.line)}function O(R){return R.getOption("disableInput")?q.Pass:N(R,!0)}q.commands.closeTag=function(R){return N(R)};function B(R,S){if(R.indexOf)return R.indexOf(S);for(var h=0,b=R.length;h<b;++h)if(R[h]==S)return h;return-1}function k(R,S,h,b,P){if(!q.scanForClosingTag)return!1;var w=Math.min(R.lastLine()+1,b.line+500),g=q.scanForClosingTag(R,b,null,w);if(!g||g.tag!=h)return!1;for(var v=P?1:0,d=S.length-1;d>=0&&S[d]==h;d--)++v;b=g.to;for(var d=1;d<v;d++){var o=q.scanForClosingTag(R,b,null,w);if(!o||o.tag!=h)return!1;b=o.to}return!0}})},BjJ7:function(Ze,We,J){"use strict";J.d(We,"d",function(){return z}),J.d(We,"c",function(){return L}),J.d(We,"e",function(){return K}),J.d(We,"b",function(){return N}),J.d(We,"a",function(){return B});var q=J("m3rI");function z(k){var R=!0;if(k.length>0){for(var S=0;S<k.length;S++)if(k[S].compile_success==0||!k[S].compile_success){R=!1;break}}else R=!1;return R}function L(k){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",S=[],h=0;h<k.length;h++){var b=k[h],P=R?"".concat(R,"/").concat(b.name):"".concat(b.name);S.push({title:b.name,isLeaf:!(b.type==="tree"),key:P})}return S}function K(k,R,S){for(var h=0;h<k.length;h++){var b=k[h];if(b.key===R){b.children=S;break}b.children&&K(b.children,R,S)}return k}function N(k,R,S){var h;return function(){var b=this,P=arguments,w=function(){h=null,S||k.apply(b,P)},g=S&&!h;clearTimeout(h),h=setTimeout(w,R),g&&k.apply(b,P)}}var O=!0,B=q.a.API_SERVER},"C+DQ":function(Ze,We,J){},D1Df:function(Ze,We,J){"use strict";function q(m){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?q=function(U){return typeof U}:q=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},q(m)}function z(){return z=Object.assign||function(m){for(var D=1;D<arguments.length;D++){var U=arguments[D];for(var F in U)Object.prototype.hasOwnProperty.call(U,F)&&(m[F]=U[F])}return m},z.apply(this,arguments)}function L(m,D){var U=Object.keys(m);if(Object.getOwnPropertySymbols){var F=Object.getOwnPropertySymbols(m);D&&(F=F.filter(function(W){return Object.getOwnPropertyDescriptor(m,W).enumerable})),U.push.apply(U,F)}return U}function K(m){for(var D=1;D<arguments.length;D++){var U=arguments[D]!=null?arguments[D]:{};D%2?L(U,!0).forEach(function(F){g(m,F,U[F])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(U)):L(U).forEach(function(F){Object.defineProperty(m,F,Object.getOwnPropertyDescriptor(U,F))})}return m}function N(m,D){if(m==null)return{};var U=O(m,D),F,W;if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(m);for(W=0;W<M.length;W++){if(F=M[W],D.indexOf(F)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(m,F))continue;U[F]=m[F]}}return U}function O(m,D){if(m==null)return{};var U={},F=Object.keys(m),W,M;for(M=0;M<F.length;M++){if(W=F[M],D.indexOf(W)>=0)continue;U[W]=m[W]}return U}function B(m,D){if(!(m instanceof D))throw new TypeError("Cannot call a class as a function")}function k(m,D){for(var U=0;U<D.length;U++){var F=D[U];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(m,F.key,F)}}function R(m,D,U){return D&&k(m.prototype,D),U&&k(m,U),m}function S(m,D){return D&&(q(D)==="object"||typeof D=="function")?D:b(m)}function h(m){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},h(m)}function b(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function P(m,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(D&&D.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),D&&w(m,D)}function w(m,D){return w=Object.setPrototypeOf||function(F,W){return F.__proto__=W,F},w(m,D)}function g(m,D,U){return D in m?Object.defineProperty(m,D,{value:U,enumerable:!0,configurable:!0,writable:!0}):m[D]=U,m}var v=J("cDcd"),d=J("17x9"),o=J("H38U"),l=J("aRTE");function u(m){for(var D="",U=0;U<m.length;U++){var F=m.charCodeAt(U);F<128?D+=String.fromCharCode(F):F<2048?(D+=String.fromCharCode(192|F>>6),D+=String.fromCharCode(128|F&63)):F<55296||F>=57344?(D+=String.fromCharCode(224|F>>12),D+=String.fromCharCode(128|F>>6&63),D+=String.fromCharCode(128|F&63)):(U++,F=65536+((F&1023)<<10|m.charCodeAt(U)&1023),D+=String.fromCharCode(240|F>>18),D+=String.fromCharCode(128|F>>12&63),D+=String.fromCharCode(128|F>>6&63),D+=String.fromCharCode(128|F&63))}return D}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},E={},f=4,A=.1;function T(m){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return m.forEach(function(F,W){var M=null;F.forEach(function(I,H){if(!I&&M!==null){U.push("M".concat(M+D," ").concat(W+D,"h").concat(H-M,"v1H").concat(M+D,"z")),M=null;return}if(H===F.length-1){if(!I)return;M===null?U.push("M".concat(H+D,",").concat(W+D," h1v1H").concat(H+D,"z")):U.push("M".concat(M+D,",").concat(W+D," h").concat(H+1-M,"v1H").concat(M+D,"z"));return}I&&M===null&&(M=H)})}),U.join("")}function p(m,D){return m.slice().map(function(U,F){return F<D.y||F>=D.y+D.h?U:U.map(function(W,M){return M<D.x||M>=D.x+D.w?W:!1})})}function c(m,D){var U=m.imageSettings,F=m.size,W=m.includeMargin;if(U==null)return null;var M=W?f:0,I=D.length+M*2,H=Math.floor(F*A),X=I/F,ee=(U.width||H)*X,ae=(U.height||H)*X,be=U.x==null?D.length/2-ee/2:U.x*X,pe=U.y==null?D.length/2-ae/2:U.y*X,ue=null;if(U.excavate){var se=Math.floor(be),fe=Math.floor(pe),ne=Math.ceil(ee+be-se),me=Math.ceil(ae+pe-fe);ue={x:se,y:fe,w:ne,h:me}}return{x:be,y:pe,h:ae,w:ee,excavation:ue}}var s=function(){try{new Path2D().addPath(new Path2D)}catch(m){return!1}return!0}(),a=function(m){P(D,m);function D(){var U,F;B(this,D);for(var W=arguments.length,M=new Array(W),I=0;I<W;I++)M[I]=arguments[I];return F=S(this,(U=h(D)).call.apply(U,[this].concat(M))),g(b(F),"_canvas",void 0),g(b(F),"_image",void 0),g(b(F),"state",{imgLoaded:!1}),g(b(F),"handleImageLoad",function(){F.setState({imgLoaded:!0})}),F}return R(D,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var F=this.props,W=F.value,M=F.size,I=F.level,H=F.bgColor,X=F.fgColor,ee=F.includeMargin,ae=F.imageSettings,be=new o(-1,l[I]);if(be.addData(u(W)),be.make(),this._canvas!=null){var pe=this._canvas,ue=pe.getContext("2d");if(!ue)return;var se=be.modules;if(se===null)return;var fe=ee?f:0,ne=se.length+fe*2,me=c(this.props,se);ae!=null&&me!=null&&(me.excavation!=null&&(se=p(se,me.excavation)));var Q=window.devicePixelRatio||1;pe.height=pe.width=M*Q;var ie=M/ne*Q;ue.scale(ie,ie),ue.fillStyle=H,ue.fillRect(0,0,ne,ne),ue.fillStyle=X,s?ue.fill(new Path2D(T(se,fe))):se.forEach(function(te,Ee){te.forEach(function(_e,ye){_e&&ue.fillRect(ye+fe,Ee+fe,1,1)})}),this.state.imgLoaded&&this._image&&me!=null&&ue.drawImage(this._image,me.x+fe,me.y+fe,me.w,me.h)}}},{key:"render",value:function(){var F=this,W=this.props,M=W.value,I=W.size,H=W.level,X=W.bgColor,ee=W.fgColor,ae=W.style,be=W.includeMargin,pe=W.imageSettings,ue=N(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),se=K({height:I,width:I},ae),fe=null,ne=pe&&pe.src;return pe!=null&&ne!=null&&(fe=v.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(Q){return F._image=Q}})),v.createElement(v.Fragment,null,v.createElement("canvas",z({style:se,height:I,width:I,ref:function(Q){return F._canvas=Q}},ue)),fe)}}]),D}(v.PureComponent);g(a,"defaultProps",C);var x=function(m){P(D,m);function D(){return B(this,D),S(this,h(D).apply(this,arguments))}return R(D,[{key:"render",value:function(){var F=this.props,W=F.value,M=F.size,I=F.level,H=F.bgColor,X=F.fgColor,ee=F.includeMargin,ae=F.imageSettings,be=N(F,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new o(-1,l[I]);pe.addData(u(W)),pe.make();var ue=pe.modules;if(ue===null)return null;var se=ee?f:0,fe=ue.length+se*2,ne=c(this.props,ue),me=null;ae!=null&&ne!=null&&(ne.excavation!=null&&(ue=p(ue,ne.excavation)),me=v.createElement("image",{xlinkHref:ae.src,height:ne.h,width:ne.w,x:ne.x+se,y:ne.y+se,preserveAspectRatio:"none"}));var Q=T(ue,se);return v.createElement("svg",z({shapeRendering:"crispEdges",height:M,width:M,viewBox:"0 0 ".concat(fe," ").concat(fe)},be),v.createElement("path",{fill:H,d:"M0,0 h".concat(fe,"v").concat(fe,"H0z")}),v.createElement("path",{fill:X,d:Q}),me)}}]),D}(v.PureComponent);g(x,"defaultProps",C);var y=function(D){var U=D.renderAs,F=N(D,["renderAs"]),W=U==="svg"?x:a;return v.createElement(W,F)};y.defaultProps=K({renderAs:"canvas"},C),Ze.exports=y},DlQD:function(Ze,We,J){(function(q,z){Ze.exports=z()})(this,function(){"use strict";function q(ge,ce){for(var he=0;he<ce.length;he++){var Y=ce[he];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(ge,Y.key,Y)}}function z(ge,ce,he){return ce&&q(ge.prototype,ce),he&&q(ge,he),ge}function L(ge,ce){if(!ge)return;if(typeof ge=="string")return K(ge,ce);var he=Object.prototype.toString.call(ge).slice(8,-1);if(he==="Object"&&ge.constructor&&(he=ge.constructor.name),he==="Map"||he==="Set")return Array.from(ge);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return K(ge,ce)}function K(ge,ce){(ce==null||ce>ge.length)&&(ce=ge.length);for(var he=0,Y=new Array(ce);he<ce;he++)Y[he]=ge[he];return Y}function N(ge,ce){var he;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(he=L(ge))||ce&&ge&&typeof ge.length=="number"){he&&(ge=he);var Y=0;return function(){return Y>=ge.length?{done:!0}:{done:!1,value:ge[Y++]}}}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 he=ge[Symbol.iterator](),he.next.bind(he)}function O(ge,ce){return ce={exports:{}},ge(ce,ce.exports),ce.exports}var B=O(function(ge){function ce(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function he(Y){ge.exports.defaults=Y}ge.exports={defaults:ce(),getDefaults:ce,changeDefaults:he}}),k=B.defaults,R=B.getDefaults,S=B.changeDefaults,h=/[&<>"']/,b=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,g={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(ce){return g[ce]};function d(ge,ce){if(ce){if(h.test(ge))return ge.replace(b,v)}else if(P.test(ge))return ge.replace(w,v);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ge){return ge.replace(o,function(ce,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(ge,ce){ge=ge.source||ge,ce=ce||"";var he={replace:function(Z,re){return re=re.source||re,re=re.replace(u,"$1"),ge=ge.replace(Z,re),he},getRegex:function(){return new RegExp(ge,ce)}};return he}var E=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(ge,ce,he){if(ge){var Y;try{Y=decodeURIComponent(l(he)).replace(E,"").toLowerCase()}catch(Z){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ce&&!f.test(he)&&(he=a(ce,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch(Z){return null}return he}var T={},p=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,ce){T[" "+ge]||(p.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=D(ge,"/",!0)),ge=T[" "+ge];var he=ge.indexOf(":")===-1;return ce.substring(0,2)==="//"?he?ce:ge.replace(c,"$1")+ce:ce.charAt(0)==="/"?he?ce:ge.replace(s,"$1")+ce:ge+ce}var x={exec:function(){}};function y(ge){for(var ce=1,he,Y;ce<arguments.length;ce++){he=arguments[ce];for(Y in he)Object.prototype.hasOwnProperty.call(he,Y)&&(ge[Y]=he[Y])}return ge}function m(ge,ce){var he=ge.replace(/\|/g,function(re,le,Se){for(var Pe=!1,ke=le;--ke>=0&&Se[ke]==="\\";)Pe=!Pe;return Pe?"|":" |"}),Y=he.split(/ \|/),Z=0;if(Y.length>ce)Y.splice(ce);else for(;Y.length<ce;)Y.push("");for(;Z<Y.length;Z++)Y[Z]=Y[Z].trim().replace(/\\\|/g,"|");return Y}function D(ge,ce,he){var Y=ge.length;if(Y===0)return"";for(var Z=0;Z<Y;){var re=ge.charAt(Y-Z-1);if(re===ce&&!he)Z++;else if(re!==ce&&he)Z++;else break}return ge.substr(0,Y-Z)}function U(ge,ce){if(ge.indexOf(ce[1])===-1)return-1;for(var he=ge.length,Y=0,Z=0;Z<he;Z++)if(ge[Z]==="\\")Z++;else if(ge[Z]===ce[0])Y++;else if(ge[Z]===ce[1]&&(Y--,Y<0))return Z;return-1}function F(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:l,edit:C,cleanUrl:A,resolveUrl:a,noopTest:x,merge:y,splitCells:m,rtrim:D,findClosingBracket:U,checkSanitizeDeprecation:F},M=B.defaults,I=W.rtrim,H=W.splitCells,X=W.escape,ee=W.findClosingBracket;function ae(ge,ce,he){var Y=ce.href,Z=ce.title?X(ce.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:he,href:Y,title:Z,text:re}:{type:"image",raw:he,href:Y,title:Z,text:X(re)}}function be(ge,ce){var he=ge.match(/^(\s+)(?:```)/);if(he===null)return ce;var Y=he[1];return ce.split(`
|
|
`).map(function(Z){var re=Z.match(/^\s+/);if(re===null)return Z;var le=re[0];return le.length>=Y.length?Z.slice(Y.length):Z}).join(`
|
|
`)}var pe=function(){function ge(he){this.options=he||M}var ce=ge.prototype;return ce.space=function(Y){var Z=this.rules.block.newline.exec(Y);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
`}},ce.code=function(Y,Z){var re=this.rules.block.code.exec(Y);if(re){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Se=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Se:I(Se,`
|
|
`)}}},ce.fences=function(Y){var Z=this.rules.block.fences.exec(Y);if(Z){var re=Z[0],le=be(re,Z[3]||"");return{type:"code",raw:re,lang:Z[2]?Z[2].trim():Z[2],text:le}}},ce.heading=function(Y){var Z=this.rules.block.heading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},ce.nptable=function(Y){var Z=this.rules.block.nptable.exec(Y);if(Z){var re={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(re.header.length===re.align.length){var le=re.align.length,Se;for(Se=0;Se<le;Se++)/^ *-+: *$/.test(re.align[Se])?re.align[Se]="right":/^ *:-+: *$/.test(re.align[Se])?re.align[Se]="center":/^ *:-+ *$/.test(re.align[Se])?re.align[Se]="left":re.align[Se]=null;for(le=re.cells.length,Se=0;Se<le;Se++)re.cells[Se]=H(re.cells[Se],re.header.length);return re}}},ce.hr=function(Y){var Z=this.rules.block.hr.exec(Y);if(Z)return{type:"hr",raw:Z[0]}},ce.blockquote=function(Y){var Z=this.rules.block.blockquote.exec(Y);if(Z){var re=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:re}}},ce.list=function(Y){var Z=this.rules.block.list.exec(Y);if(Z){for(var re=Z[0],le=Z[2],Se=le.length>1,Pe=le[le.length-1]===")",ke={type:"list",raw:re,ordered:Se,start:Se?+le.slice(0,-1):"",loose:!1,items:[]},Ge=Z[0].match(this.rules.block.item),it=!1,Me,ct,at,rt,xt,Et,Rt,At=Ge.length,pt=0;pt<At;pt++)Me=Ge[pt],re=Me,ct=Me.length,Me=Me.replace(/^ *([*+-]|\d+[.)]) */,""),~Me.indexOf(`
|
|
`)&&(ct-=Me.length,Me=this.options.pedantic?Me.replace(/^ {1,4}/gm,""):Me.replace(new RegExp("^ {1,"+ct+"}","gm"),"")),pt!==At-1&&(at=this.rules.block.bullet.exec(Ge[pt+1])[0],(Se?at.length===1||!Pe&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==le)&&(rt=Ge.slice(pt+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-rt.length),pt=At-1)),xt=it||/\n\n(?!\s*$)/.test(Me),pt!==At-1&&(it=Me.charAt(Me.length-1)===`
|
|
`,xt||(xt=it)),xt&&(ke.loose=!0),Et=/^\[[ xX]\] /.test(Me),Rt=void 0,Et&&(Rt=Me[1]!==" ",Me=Me.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:re,task:Et,checked:Rt,loose:xt,text:Me});return ke}},ce.html=function(Y){var Z=this.rules.block.html.exec(Y);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]):X(Z[0]):Z[0]}},ce.def=function(Y){var Z=this.rules.block.def.exec(Y);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var re=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:Z[0],href:Z[2],title:Z[3]}}},ce.table=function(Y){var Z=this.rules.block.table.exec(Y);if(Z){var re={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=Z[0];var le=re.align.length,Se;for(Se=0;Se<le;Se++)/^ *-+: *$/.test(re.align[Se])?re.align[Se]="right":/^ *:-+: *$/.test(re.align[Se])?re.align[Se]="center":/^ *:-+ *$/.test(re.align[Se])?re.align[Se]="left":re.align[Se]=null;for(le=re.cells.length,Se=0;Se<le;Se++)re.cells[Se]=H(re.cells[Se].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},ce.lheading=function(Y){var Z=this.rules.block.lheading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},ce.paragraph=function(Y){var Z=this.rules.block.paragraph.exec(Y);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
`?Z[1].slice(0,-1):Z[1]}},ce.text=function(Y,Z){var re=this.rules.block.text.exec(Y);if(re){var le=Z[Z.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},ce.escape=function(Y){var Z=this.rules.inline.escape.exec(Y);if(Z)return{type:"escape",raw:Z[0],text:X(Z[1])}},ce.tag=function(Y,Z,re){var le=this.rules.inline.tag.exec(Y);if(le)return!Z&&/^<a /i.test(le[0])?Z=!0:Z&&/^<\/a>/i.test(le[0])&&(Z=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]}},ce.link=function(Y){var Z=this.rules.inline.link.exec(Y);if(Z){var re=ee(Z[2],"()");if(re>-1){var le=Z[0].indexOf("!")===0?5:4,Se=le+Z[1].length+re;Z[2]=Z[2].substring(0,re),Z[0]=Z[0].substring(0,Se).trim(),Z[3]=""}var Pe=Z[2],ke="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);Ge?(Pe=Ge[1],ke=Ge[3]):ke=""}else ke=Z[3]?Z[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var it=ae(Z,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},Z[0]);return it}},ce.reflink=function(Y,Z){var re;if((re=this.rules.inline.reflink.exec(Y))||(re=this.rules.inline.nolink.exec(Y))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var Se=re[0].charAt(0);return{type:"text",raw:Se,text:Se}}var Pe=ae(re,le,re[0]);return Pe}},ce.strong=function(Y,Z,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec(Y);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Y.length);var Se=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Se.lastIndex=0;for(var Pe;(le=Se.exec(Z))!=null;)if(Pe=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Pe)return{type:"strong",raw:Y.slice(0,Pe[0].length),text:Y.slice(2,Pe[0].length-2)}}},ce.em=function(Y,Z,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec(Y);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Y.length);var Se=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Se.lastIndex=0;for(var Pe;(le=Se.exec(Z))!=null;)if(Pe=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Pe)return{type:"em",raw:Y.slice(0,Pe[0].length),text:Y.slice(1,Pe[0].length-1)}}},ce.codespan=function(Y){var Z=this.rules.inline.code.exec(Y);if(Z){var re=Z[2].replace(/\n/g," "),le=/[^ ]/.test(re),Se=re.startsWith(" ")&&re.endsWith(" ");return le&&Se&&(re=re.substring(1,re.length-1)),re=X(re,!0),{type:"codespan",raw:Z[0],text:re}}},ce.br=function(Y){var Z=this.rules.inline.br.exec(Y);if(Z)return{type:"br",raw:Z[0]}},ce.del=function(Y){var Z=this.rules.inline.del.exec(Y);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},ce.autolink=function(Y,Z){var re=this.rules.inline.autolink.exec(Y);if(re){var le,Se;return re[2]==="@"?(le=X(this.options.mangle?Z(re[1]):re[1]),Se="mailto:"+le):(le=X(re[1]),Se=le),{type:"link",raw:re[0],text:le,href:Se,tokens:[{type:"text",raw:le,text:le}]}}},ce.url=function(Y,Z){var re;if(re=this.rules.inline.url.exec(Y)){var le,Se;if(re[2]==="@")le=X(this.options.mangle?Z(re[0]):re[0]),Se="mailto:"+le;else{var Pe;do Pe=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Pe!==re[0]);le=X(re[0]),re[1]==="www."?Se="http://"+le:Se=le}return{type:"link",raw:re[0],text:le,href:Se,tokens:[{type:"text",raw:le,text:le}]}}},ce.inlineText=function(Y,Z,re){var le=this.rules.inline.text.exec(Y);if(le){var Se;return Z?Se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]:Se=X(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:Se}}},ge}(),ue=W.noopTest,se=W.edit,fe=W.merge,ne={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ue,table:ue,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=se(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=se(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=se(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=se(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=se(ne._paragraph).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.blockquote=se(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=fe({},ne),ne.gfm=fe({},ne.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*|$)"}),ne.gfm.nptable=se(ne.gfm.nptable).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.gfm.table=se(ne.gfm.table).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.pedantic=fe({},ne.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ue,paragraph:se(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ue,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ue,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=se(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=se(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=se(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=se(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=se(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=se(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=se(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=se(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=se(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=se(me._blockSkip,"g").getRegex(),me.overlapSkip=se(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=se(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=se(me.tag).replace("comment",ne._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=se(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=se(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=se(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:se(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=fe({},me.normal,{escape:se(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]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=se(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=fe({},me.gfm,{br:se(me.br).replace("{2,}","*").getRegex(),text:se(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Q={block:ne,inline:me},ie=B.defaults,te=Q.block,Ee=Q.inline;function _e(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(ge){var ce="",he,Y,Z=ge.length;for(he=0;he<Z;he++)Y=ge.charCodeAt(he),Math.random()>.5&&(Y="x"+Y.toString(16)),ce+="&#"+Y+";";return ce}var ve=function(){function ge(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||ie,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:te.normal,inline:Ee.normal};this.options.pedantic?(Y.block=te.pedantic,Y.inline=Ee.pedantic):this.options.gfm&&(Y.block=te.gfm,this.options.breaks?Y.inline=Ee.breaks:Y.inline=Ee.gfm),this.tokenizer.rules=Y}ge.lex=function(Y,Z){var re=new ge(Z);return re.lex(Y)};var ce=ge.prototype;return ce.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(Y,Z,re){Z===void 0&&(Z=[]),re===void 0&&(re=!0),Y=Y.replace(/^ +$/gm,"");for(var le,Se,Pe,ke;Y;){if(le=this.tokenizer.space(Y)){Y=Y.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(ke=Z[Z.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote(Y)){Y=Y.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),Z.push(le);continue}if(le=this.tokenizer.list(Y)){for(Y=Y.substring(le.raw.length),Pe=le.items.length,Se=0;Se<Pe;Se++)le.items[Se].tokens=this.blockTokens(le.items[Se].text,[],!1);Z.push(le);continue}if(le=this.tokenizer.html(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(re&&(le=this.tokenizer.def(Y))){Y=Y.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.lheading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(re&&(le=this.tokenizer.paragraph(Y))){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.text(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(ke=Z[Z.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(Y){var Ge="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return Z},ce.inline=function(Y){var Z,re,le,Se,Pe,ke,Ge=Y.length;for(Z=0;Z<Ge;Z++){ke=Y[Z];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},Se=ke.header.length,re=0;re<Se;re++)ke.tokens.header[re]=[],this.inlineTokens(ke.header[re],ke.tokens.header[re]);for(Se=ke.cells.length,re=0;re<Se;re++)for(Pe=ke.cells[re],ke.tokens.cells[re]=[],le=0;le<Pe.length;le++)ke.tokens.cells[re][le]=[],this.inlineTokens(Pe[le],ke.tokens.cells[re][le]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(Se=ke.items.length,re=0;re<Se;re++)this.inline(ke.items[re].tokens);break}}}return Y},ce.inlineTokens=function(Y,Z,re,le,Se){Z===void 0&&(Z=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),Se===void 0&&(Se="");var Pe,ke=Y,Ge;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)it.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Pe=this.tokenizer.escape(Y)){Y=Y.substring(Pe.raw.length),Z.push(Pe);continue}if(Pe=this.tokenizer.tag(Y,re,le)){Y=Y.substring(Pe.raw.length),re=Pe.inLink,le=Pe.inRawBlock,Z.push(Pe);continue}if(Pe=this.tokenizer.link(Y)){Y=Y.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,le)),Z.push(Pe);continue}if(Pe=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,le)),Z.push(Pe);continue}if(Pe=this.tokenizer.strong(Y,ke,Se)){Y=Y.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],re,le),Z.push(Pe);continue}if(Pe=this.tokenizer.em(Y,ke,Se)){Y=Y.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],re,le),Z.push(Pe);continue}if(Pe=this.tokenizer.codespan(Y)){Y=Y.substring(Pe.raw.length),Z.push(Pe);continue}if(Pe=this.tokenizer.br(Y)){Y=Y.substring(Pe.raw.length),Z.push(Pe);continue}if(Pe=this.tokenizer.del(Y)){Y=Y.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],re,le),Z.push(Pe);continue}if(Pe=this.tokenizer.autolink(Y,ye)){Y=Y.substring(Pe.raw.length),Z.push(Pe);continue}if(!re&&(Pe=this.tokenizer.url(Y,ye))){Y=Y.substring(Pe.raw.length),Z.push(Pe);continue}if(Pe=this.tokenizer.inlineText(Y,le,_e)){Y=Y.substring(Pe.raw.length),Se=Pe.raw.slice(-1),Z.push(Pe);continue}if(Y){var Me="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return Z},z(ge,null,[{key:"rules",get:function(){return{block:te,inline:Ee}}}]),ge}(),Te=B.defaults,De=W.cleanUrl,Re=W.escape,Ce=function(){function ge(he){this.options=he||Te}var ce=ge.prototype;return ce.code=function(Y,Z,re){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var Se=this.options.highlight(Y,le);Se!=null&&Se!==Y&&(re=!0,Y=Se)}return le?'<pre><code class="'+this.options.langPrefix+Re(le,!0)+'">'+(re?Y:Re(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?Y:Re(Y,!0))+`</code></pre>
|
|
`},ce.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},ce.html=function(Y){return Y},ce.heading=function(Y,Z,re,le){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+le.slug(re)+'">'+Y+"</h"+Z+`>
|
|
`:"<h"+Z+">"+Y+"</h"+Z+`>
|
|
`},ce.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ce.list=function(Y,Z,re){var le=Z?"ol":"ul",Se=Z&&re!==1?' start="'+re+'"':"";return"<"+le+Se+`>
|
|
`+Y+"</"+le+`>
|
|
`},ce.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},ce.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ce.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},ce.table=function(Y,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+Z+`</table>
|
|
`},ce.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},ce.tablecell=function(Y,Z){var re=Z.header?"th":"td",le=Z.align?"<"+re+' align="'+Z.align+'">':"<"+re+">";return le+Y+"</"+re+`>
|
|
`},ce.strong=function(Y){return"<strong>"+Y+"</strong>"},ce.em=function(Y){return"<em>"+Y+"</em>"},ce.codespan=function(Y){return"<code>"+Y+"</code>"},ce.br=function(){return this.options.xhtml?"<br/>":"<br>"},ce.del=function(Y){return"<del>"+Y+"</del>"},ce.link=function(Y,Z,re){if(Y=De(this.options.sanitize,this.options.baseUrl,Y),Y===null)return re;var le='<a href="'+Re(Y)+'"';return Z&&(le+=' title="'+Z+'"'),le+=">"+re+"</a>",le},ce.image=function(Y,Z,re){if(Y=De(this.options.sanitize,this.options.baseUrl,Y),Y===null)return re;var le='<img src="'+Y+'" alt="'+re+'"';return Z&&(le+=' title="'+Z+'"'),le+=this.options.xhtml?"/>":">",le},ce.text=function(Y){return Y},ge}(),Le=function(){function ge(){}var ce=ge.prototype;return ce.strong=function(Y){return Y},ce.em=function(Y){return Y},ce.codespan=function(Y){return Y},ce.del=function(Y){return Y},ce.html=function(Y){return Y},ce.text=function(Y){return Y},ce.link=function(Y,Z,re){return""+re},ce.image=function(Y,Z,re){return""+re},ce.br=function(){return""},ge}(),ze=function(){function ge(){this.seen={}}var ce=ge.prototype;return ce.slug=function(Y){var Z=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var re=Z;do this.seen[re]++,Z=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ge}(),Ve=B.defaults,Be=W.unescape,je=function(){function ge(he){this.options=he||Ve,this.options.renderer=this.options.renderer||new Ce,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new ze}ge.parse=function(Y,Z){var re=new ge(Z);return re.parse(Y)};var ce=ge.prototype;return ce.parse=function(Y,Z){Z===void 0&&(Z=!0);var re="",le,Se,Pe,ke,Ge,it,Me,ct,at,rt,xt,Et,Rt,At,pt,or,Kt,Ft,Tr=Y.length;for(le=0;le<Tr;le++){rt=Y[le];switch(rt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,Be(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(ct="",Me="",ke=rt.header.length,Se=0;Se<ke;Se++)Me+=this.renderer.tablecell(this.parseInline(rt.tokens.header[Se]),{header:!0,align:rt.align[Se]});for(ct+=this.renderer.tablerow(Me),at="",ke=rt.cells.length,Se=0;Se<ke;Se++){for(it=rt.tokens.cells[Se],Me="",Ge=it.length,Pe=0;Pe<Ge;Pe++)Me+=this.renderer.tablecell(this.parseInline(it[Pe]),{header:!1,align:rt.align[Pe]});at+=this.renderer.tablerow(Me)}re+=this.renderer.table(ct,at);continue}case"blockquote":{at=this.parse(rt.tokens),re+=this.renderer.blockquote(at);continue}case"list":{for(xt=rt.ordered,Et=rt.start,Rt=rt.loose,ke=rt.items.length,at="",Se=0;Se<ke;Se++)pt=rt.items[Se],or=pt.checked,Kt=pt.task,At="",pt.task&&(Ft=this.renderer.checkbox(or),Rt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Ft+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Ft+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Ft}):At+=Ft),At+=this.parse(pt.tokens,Rt),at+=this.renderer.listitem(At,Kt,or);re+=this.renderer.list(at,xt,Et);continue}case"html":{re+=this.renderer.html(rt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(at=rt.tokens?this.parseInline(rt.tokens):rt.text;le+1<Tr&&Y[le+1].type==="text";)rt=Y[++le],at+=`
|
|
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);re+=Z?this.renderer.paragraph(at):at;continue}default:{var vr='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return re},ce.parseInline=function(Y,Z){Z=Z||this.renderer;var re="",le,Se,Pe=Y.length;for(le=0;le<Pe;le++){Se=Y[le];switch(Se.type){case"escape":{re+=Z.text(Se.text);break}case"html":{re+=Z.html(Se.text);break}case"link":{re+=Z.link(Se.href,Se.title,this.parseInline(Se.tokens,Z));break}case"image":{re+=Z.image(Se.href,Se.title,Se.text);break}case"strong":{re+=Z.strong(this.parseInline(Se.tokens,Z));break}case"em":{re+=Z.em(this.parseInline(Se.tokens,Z));break}case"codespan":{re+=Z.codespan(Se.text);break}case"br":{re+=Z.br();break}case"del":{re+=Z.del(this.parseInline(Se.tokens,Z));break}case"text":{re+=Z.text(Se.text);break}default:{var ke='Token with "'+Se.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return re},ge}(),qe=W.merge,Xe=W.checkSanitizeDeprecation,Qe=W.escape,Ae=B.getDefaults,tt=B.changeDefaults,Je=B.defaults;function Oe(ge,ce,he){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof ce=="function"&&(he=ce,ce=null),ce=qe({},Oe.defaults,ce||{}),Xe(ce),he){var Y=ce.highlight,Z;try{Z=ve.lex(ge,ce)}catch(Pe){return he(Pe)}var re=function(ke){var Ge;if(!ke)try{Ge=je.parse(Z,ce)}catch(it){ke=it}return ce.highlight=Y,ke?he(ke):he(null,Ge)};if(!Y||Y.length<3)return re();if(delete ce.highlight,!Z.length)return re();var le=0;Oe.walkTokens(Z,function(Pe){Pe.type==="code"&&(le++,setTimeout(function(){Y(Pe.text,Pe.lang,function(ke,Ge){if(ke)return re(ke);Ge!=null&&Ge!==Pe.text&&(Pe.text=Ge,Pe.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var Se=ve.lex(ge,ce);return ce.walkTokens&&Oe.walkTokens(Se,ce.walkTokens),je.parse(Se,ce)}catch(Pe){if(Pe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ce.silent)return"<p>An error occurred:</p><pre>"+Qe(Pe.message+"",!0)+"</pre>";throw Pe}}Oe.options=Oe.setOptions=function(ge){return qe(Oe.defaults,ge),tt(Oe.defaults),Oe},Oe.getDefaults=Ae,Oe.defaults=Je,Oe.use=function(ge){var ce=qe({},ge);if(ge.renderer&&function(){var Y=Oe.defaults.renderer||new Ce,Z=function(Se){var Pe=Y[Se];Y[Se]=function(){for(var ke=arguments.length,Ge=new Array(ke),it=0;it<ke;it++)Ge[it]=arguments[it];var Me=ge.renderer[Se].apply(Y,Ge);return Me===!1&&(Me=Pe.apply(Y,Ge)),Me}};for(var re in ge.renderer)Z(re);ce.renderer=Y}(),ge.tokenizer&&function(){var Y=Oe.defaults.tokenizer||new pe,Z=function(Se){var Pe=Y[Se];Y[Se]=function(){for(var ke=arguments.length,Ge=new Array(ke),it=0;it<ke;it++)Ge[it]=arguments[it];var Me=ge.tokenizer[Se].apply(Y,Ge);return Me===!1&&(Me=Pe.apply(Y,Ge)),Me}};for(var re in ge.tokenizer)Z(re);ce.tokenizer=Y}(),ge.walkTokens){var he=Oe.defaults.walkTokens;ce.walkTokens=function(Y){ge.walkTokens(Y),he&&he(Y)}}Oe.setOptions(ce)},Oe.walkTokens=function(ge,ce){for(var he=N(ge),Y;!(Y=he()).done;){var Z=Y.value;ce(Z);switch(Z.type){case"table":{for(var re=N(Z.tokens.header),le;!(le=re()).done;){var Se=le.value;Oe.walkTokens(Se,ce)}for(var Pe=N(Z.tokens.cells),ke;!(ke=Pe()).done;)for(var Ge=ke.value,it=N(Ge),Me;!(Me=it()).done;){var ct=Me.value;Oe.walkTokens(ct,ce)}break}case"list":{Oe.walkTokens(Z.items,ce);break}default:Z.tokens&&Oe.walkTokens(Z.tokens,ce)}}},Oe.Parser=je,Oe.parser=je.parse,Oe.Renderer=Ce,Oe.TextRenderer=Le,Oe.Lexer=ve,Oe.lexer=ve.lex,Oe.Tokenizer=pe,Oe.Slugger=ze,Oe.parse=Oe;var Ue=Oe;return Ue})},ELLl:function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=q.Pos;q.defineOption("autoCloseBrackets",!1,function(g,v,d){d&&d!=q.Init&&(g.removeKeyMap(N),g.state.closeBrackets=null),v&&(O(K(v,"pairs")),g.state.closeBrackets=v,g.addKeyMap(N))});function K(g,v){return v=="pairs"&&typeof g=="string"?g:typeof g=="object"&&g[v]!=null?g[v]:z[v]}var N={Backspace:R,Enter:S};function O(g){for(var v=0;v<g.length;v++){var d=g.charAt(v),o="'"+d+"'";N[o]||(N[o]=B(d))}}O(z.pairs+"`");function B(g){return function(v){return b(v,g)}}function k(g){var v=g.state.closeBrackets;if(!v||v.override)return v;var d=g.getModeAt(g.getCursor());return d.closeBrackets||v}function R(g){var v=k(g);if(!v||g.getOption("disableInput"))return q.Pass;for(var d=K(v,"pairs"),o=g.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return q.Pass;var u=P(g,o[l].head);if(!u||d.indexOf(u)%2!=0)return q.Pass}for(var l=o.length-1;l>=0;l--){var C=o[l].head;g.replaceRange("",L(C.line,C.ch-1),L(C.line,C.ch+1),"+delete")}}function S(g){var v=k(g),d=v&&K(v,"explode");if(!d||g.getOption("disableInput"))return q.Pass;for(var o=g.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return q.Pass;var u=P(g,o[l].head);if(!u||d.indexOf(u)%2!=0)return q.Pass}g.operation(function(){var C=g.lineSeparator()||`
|
|
`;g.replaceSelection(C+C,null),g.execCommand("goCharLeft"),o=g.listSelections();for(var E=0;E<o.length;E++){var f=o[E].head.line;g.indentLine(f,null,!0),g.indentLine(f+1,null,!0)}})}function h(g){var v=q.cmpPos(g.anchor,g.head)>0;return{anchor:new L(g.anchor.line,g.anchor.ch+(v?-1:1)),head:new L(g.head.line,g.head.ch+(v?1:-1))}}function b(g,v){var d=k(g);if(!d||g.getOption("disableInput"))return q.Pass;var o=K(d,"pairs"),l=o.indexOf(v);if(l==-1)return q.Pass;for(var u=K(d,"closeBefore"),C=K(d,"triples"),E=o.charAt(l+1)==v,f=g.listSelections(),A=l%2==0,T,p=0;p<f.length;p++){var c=f[p],s=c.head,a,x=g.getRange(s,L(s.line,s.ch+1));if(A&&!c.empty())a="surround";else if((E||!A)&&x==v)E&&w(g,s)?a="both":C.indexOf(v)>=0&&g.getRange(s,L(s.line,s.ch+3))==v+v+v?a="skipThree":a="skip";else if(E&&s.ch>1&&C.indexOf(v)>=0&&g.getRange(L(s.line,s.ch-2),s)==v+v){if(s.ch>2&&/\bstring/.test(g.getTokenTypeAt(L(s.line,s.ch-2))))return q.Pass;a="addFour"}else if(E){var y=s.ch==0?" ":g.getRange(L(s.line,s.ch-1),s);if(!q.isWordChar(x)&&y!=v&&!q.isWordChar(y))a="both";else return q.Pass}else if(A&&(x.length===0||/\s/.test(x)||u.indexOf(x)>-1))a="both";else return q.Pass;if(!T)T=a;else if(T!=a)return q.Pass}var m=l%2?o.charAt(l-1):v,D=l%2?v:o.charAt(l+1);g.operation(function(){if(T=="skip")g.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)g.execCommand("goCharRight");else if(T=="surround"){for(var F=g.getSelections(),U=0;U<F.length;U++)F[U]=m+F[U]+D;g.replaceSelections(F,"around"),F=g.listSelections().slice();for(var U=0;U<F.length;U++)F[U]=h(F[U]);g.setSelections(F)}else T=="both"?(g.replaceSelection(m+D,null),g.triggerElectric(m+D),g.execCommand("goCharLeft")):T=="addFour"&&(g.replaceSelection(m+m+m+m,"before"),g.execCommand("goCharRight"))})}function P(g,v){var d=g.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return d.length==2?d:null}function w(g,v){var d=g.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(g.getTokenTypeAt(v)))}})},GfqC:function(Ze,We,J){"use strict";var q=J("cDcd"),z=J.n(q),L=J("TSYQ"),K=J.n(L);function N(W,M){var I="cannot "+W.method+" "+W.action+" "+M.status+"'",H=new Error(I);return H.status=M.status,H.method=W.method,H.url=W.action,H}function O(W){var M=W.responseText||W.response;if(!M)return M;try{return JSON.parse(M)}catch(I){return M}}function B(W){var M=new XMLHttpRequest;W.onProgress&&M.upload&&(M.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var I=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var ee=W.data[X];if(Array.isArray(ee)){ee.forEach(function(ae){I.append(X+"[]",ae)});return}I.append(X,W.data[X])}),W.file instanceof Blob?I.append(W.filename,W.file,W.file.name):I.append(W.filename,W.file),M.onerror=function(ee){W.onError(ee)},M.onload=function(){return M.status<200||M.status>=300?W.onError(N(W,M),O(M)):W.onSuccess(O(M),M)},M.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&M.setRequestHeader(X,H[X])}),M.send(I),{abort:function(){M.abort()}}}var k=+new Date,R=0;function S(){return"rc-upload-"+k+"-"+ ++R}function h(W,M){return W.indexOf(M,W.length-M.length)!==-1}var b=function(W,M){if(W&&M){var I=Array.isArray(M)?M:M.split(","),H=W.name||"",X=W.type||"",ee=X.replace(/\/.*$/,"");return I.some(function(ae){var be=ae.trim();return be.charAt(0)==="."?h(H.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?ee===be.replace(/\/.*$/,""):X===be})}return!0};function P(W,M){var I=W.createReader(),H=[];function X(){I.readEntries(function(ee){var ae=Array.prototype.slice.apply(ee);H=H.concat(ae);var be=!ae.length;be?M(H):X()})}X()}var w=function(M,I,H){var X=function ee(ae,be){be=be||"",ae.isFile?ae.file(function(pe){H(pe)&&(ae.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=ae.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),I([pe]))}):ae.isDirectory&&P(ae,function(pe){pe.forEach(function(ue){ee(ue,""+be+ae.name+"/")})})};M.forEach(function(ee){X(ee.webkitGetAsEntry())})},g=w,v=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},d=function(){function W(M,I){var H=[],X=!0,ee=!1,ae=void 0;try{for(var be=M[Symbol.iterator](),pe;!(X=(pe=be.next()).done)&&!(H.push(pe.value),I&&H.length===I);X=!0);}catch(ue){ee=!0,ae=ue}finally{try{!X&&be.return&&be.return()}finally{if(ee)throw ae}}return H}return function(M,I){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return W(M,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(M,I){for(var H=0;H<I.length;H++){var X=I[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,I,H){return I&&W(M.prototype,I),H&&W(M,H),M}}();function l(W,M,I){return M in W?Object.defineProperty(W,M,{value:I,enumerable:!0,configurable:!0,writable:!0}):W[M]=I,W}function u(W,M){var I={};for(var H in W){if(M.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;I[H]=W[H]}return I}function C(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function E(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function f(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}var A=function(M){return Object.keys(M).reduce(function(I,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(I[H]=M[H]),I},{})},T=function(W){f(M,W);function M(){var I,H,X,ee;C(this,M);for(var ae=arguments.length,be=Array(ae),pe=0;pe<ae;pe++)be[pe]=arguments[pe];return ee=(H=(X=E(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(be))),X),X.state={uid:S()},X.reqs={},X.onChange=function(ue){var se=ue.target.files;X.uploadFiles(se),X.reset()},X.onClick=function(ue){var se=X.fileInput;if(!se)return;var fe=X.props,ne=fe.children,me=fe.onClick;ne&&ne.type==="button"&&(se.parentNode.focus(),se.parentNode.querySelector("button").blur()),se.click(),me&&me(ue)},X.onKeyDown=function(ue){ue.key==="Enter"&&X.onClick()},X.onFileDrop=function(ue){var se=X.props.multiple;if(ue.preventDefault(),ue.type==="dragover")return;if(X.props.directory)g(Array.prototype.slice.call(ue.dataTransfer.items),X.uploadFiles,function(ne){return b(ne,X.props.accept)});else{var fe=Array.prototype.slice.call(ue.dataTransfer.files).filter(function(ne){return b(ne,X.props.accept)});se===!1&&(fe=fe.slice(0,1)),X.uploadFiles(fe)}},X.uploadFiles=function(ue){var se=Array.prototype.slice.call(ue);se.map(function(fe){return fe.uid=S(),fe}).forEach(function(fe){X.upload(fe,se)})},X.saveFileInput=function(ue){X.fileInput=ue},H),E(X,ee)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var ee=this,ae=this.props;if(!ae.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var be=ae.beforeUpload(H,X);be&&be.then?be.then(function(pe){var ue=Object.prototype.toString.call(pe);return ue==="[object File]"||ue==="[object Blob]"?ee.post(pe):ee.post(H)}).catch(function(pe){console.log(pe)}):be!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var ee=this.props,ae=ee.onStart,be=ee.onProgress,pe=ee.transformFile,ue=pe===void 0?function(se){return se}:pe;new Promise(function(se){var fe=ee.action;return typeof fe=="function"&&(fe=fe(H)),se(fe)}).then(function(se){var fe=H.uid,ne=ee.customRequest||B,me=Promise.resolve(ue(H)).then(function(Q){var ie=ee.data;return typeof ie=="function"&&(ie=ie(Q)),Promise.all([Q,ie])}).catch(function(Q){console.error(Q)});me.then(function(Q){var ie=d(Q,2),te=ie[0],Ee=ie[1],_e={action:se,filename:ee.name,data:Ee,file:te,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:be?function(ye){be(ye,H)}:null,onSuccess:function(ve,Te){delete X.reqs[fe],ee.onSuccess(ve,H,Te)},onError:function(ve,Te){delete X.reqs[fe],ee.onError(ve,Te,H)}};ae(H),X.reqs[fe]=ne(_e)})})}},{key:"reset",value:function(){this.setState({uid:S()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),X[ee]&&X[ee].abort&&X[ee].abort(),delete X[ee]}else Object.keys(X).forEach(function(ae){X[ae]&&X[ae].abort&&X[ae].abort(),delete X[ae]})}},{key:"render",value:function(){var H,X=this.props,ee=X.component,ae=X.prefixCls,be=X.className,pe=X.disabled,ue=X.id,se=X.style,fe=X.multiple,ne=X.accept,me=X.children,Q=X.directory,ie=X.openFileDialogOnClick,te=X.onMouseEnter,Ee=X.onMouseLeave,_e=u(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=K()((H={},l(H,ae,!0),l(H,ae+"-disabled",pe),l(H,be,be),H)),ve=pe?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:te,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return z.a.createElement(ee,v({},ve,{className:ye,role:"button",style:se}),z.a.createElement("input",v({},A(_e),{id:ue,type:"file",ref:this.saveFileInput,onClick:function(De){return De.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:Q?"directory":null,webkitdirectory:Q?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),me)}}]),M}(q.Component),p=T,c=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},s=function(){function W(M,I){for(var H=0;H<I.length;H++){var X=I[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,I,H){return I&&W(M.prototype,I),H&&W(M,H),M}}();function a(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function x(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function y(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}function m(){}var D=function(W){y(M,W);function M(){var I,H,X,ee;a(this,M);for(var ae=arguments.length,be=Array(ae),pe=0;pe<ae;pe++)be[pe]=arguments[pe];return ee=(H=(X=x(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(be))),X),X.saveUploader=function(ue){X.uploader=ue},H),x(X,ee)}return s(M,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return z.a.createElement(p,c({},this.props,{ref:this.saveUploader}))}}]),M}(q.Component);D.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:m,onError:m,onSuccess:m,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=D,F=We.a=U},H38U:function(Ze,We,J){var q=J("f4xo"),z=J("rcnY"),L=J("wU8J"),K=J("Iq15"),N=J("dWSS");function O(k,R){this.typeNumber=k,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var B=O.prototype;B.addData=function(k){var R=new q(k);this.dataList.push(R),this.dataCache=null},B.isDark=function(k,R){if(k<0||this.moduleCount<=k||R<0||this.moduleCount<=R)throw new Error(k+","+R);return this.modules[k][R]},B.getModuleCount=function(){return this.moduleCount},B.make=function(){if(this.typeNumber<1){var k=1;for(k=1;k<40;k++){for(var R=z.getRSBlocks(k,this.errorCorrectLevel),S=new L,h=0,b=0;b<R.length;b++)h+=R[b].dataCount;for(var b=0;b<this.dataList.length;b++){var P=this.dataList[b];S.put(P.mode,4),S.put(P.getLength(),K.getLengthInBits(P.mode,k)),P.write(S)}if(S.getLengthInBits()<=h*8)break}this.typeNumber=k}this.makeImpl(!1,this.getBestMaskPattern())},B.makeImpl=function(k,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var S=0;S<this.moduleCount;S++){this.modules[S]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++)this.modules[S][h]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(k,R),this.typeNumber>=7&&this.setupTypeNumber(k),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},B.setupPositionProbePattern=function(k,R){for(var S=-1;S<=7;S++){if(k+S<=-1||this.moduleCount<=k+S)continue;for(var h=-1;h<=7;h++){if(R+h<=-1||this.moduleCount<=R+h)continue;0<=S&&S<=6&&(h==0||h==6)||0<=h&&h<=6&&(S==0||S==6)||2<=S&&S<=4&&2<=h&&h<=4?this.modules[k+S][R+h]=!0:this.modules[k+S][R+h]=!1}}},B.getBestMaskPattern=function(){for(var k=0,R=0,S=0;S<8;S++){this.makeImpl(!0,S);var h=K.getLostPoint(this);(S==0||k>h)&&(k=h,R=S)}return R},B.createMovieClip=function(k,R,S){var h=k.createEmptyMovieClip(R,S),b=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*b,g=0;g<this.modules[P].length;g++){var v=g*b,d=this.modules[P][g];d&&(h.beginFill(0,100),h.moveTo(v,w),h.lineTo(v+b,w),h.lineTo(v+b,w+b),h.lineTo(v,w+b),h.endFill())}return h},B.setupTimingPattern=function(){for(var k=8;k<this.moduleCount-8;k++){if(this.modules[k][6]!=null)continue;this.modules[k][6]=k%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},B.setupPositionAdjustPattern=function(){for(var k=K.getPatternPosition(this.typeNumber),R=0;R<k.length;R++)for(var S=0;S<k.length;S++){var h=k[R],b=k[S];if(this.modules[h][b]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[h+P][b+w]=!0:this.modules[h+P][b+w]=!1}},B.setupTypeNumber=function(k){for(var R=K.getBCHTypeNumber(this.typeNumber),S=0;S<18;S++){var h=!k&&(R>>S&1)==1;this.modules[Math.floor(S/3)][S%3+this.moduleCount-8-3]=h}for(var S=0;S<18;S++){var h=!k&&(R>>S&1)==1;this.modules[S%3+this.moduleCount-8-3][Math.floor(S/3)]=h}},B.setupTypeInfo=function(k,R){for(var S=this.errorCorrectLevel<<3|R,h=K.getBCHTypeInfo(S),b=0;b<15;b++){var P=!k&&(h>>b&1)==1;b<6?this.modules[b][8]=P:b<8?this.modules[b+1][8]=P:this.modules[this.moduleCount-15+b][8]=P}for(var b=0;b<15;b++){var P=!k&&(h>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=P:b<9?this.modules[8][15-b-1+1]=P:this.modules[8][15-b-1]=P}this.modules[this.moduleCount-8][8]=!k},B.mapData=function(k,R){for(var S=-1,h=this.moduleCount-1,b=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var g=0;g<2;g++)if(this.modules[h][w-g]==null){var v=!1;P<k.length&&(v=(k[P]>>>b&1)==1);var d=K.getMask(R,h,w-g);d&&(v=!v),this.modules[h][w-g]=v,b--,b==-1&&(P++,b=7)}if(h+=S,h<0||this.moduleCount<=h){h-=S,S=-S;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(k,R,S){for(var h=z.getRSBlocks(k,R),b=new L,P=0;P<S.length;P++){var w=S[P];b.put(w.mode,4),b.put(w.getLength(),K.getLengthInBits(w.mode,k)),w.write(b)}for(var g=0,P=0;P<h.length;P++)g+=h[P].dataCount;if(b.getLengthInBits()>g*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+g*8+")");for(b.getLengthInBits()+4<=g*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=g*8);){if(b.put(O.PAD0,8),b.getLengthInBits()>=g*8)break;b.put(O.PAD1,8)}return O.createBytes(b,h)},O.createBytes=function(k,R){for(var S=0,h=0,b=0,P=new Array(R.length),w=new Array(R.length),g=0;g<R.length;g++){var v=R[g].dataCount,d=R[g].totalCount-v;h=Math.max(h,v),b=Math.max(b,d),P[g]=new Array(v);for(var o=0;o<P[g].length;o++)P[g][o]=255&k.buffer[o+S];S+=v;var l=K.getErrorCorrectPolynomial(d),u=new N(P[g],l.getLength()-1),C=u.mod(l);w[g]=new Array(l.getLength()-1);for(var o=0;o<w[g].length;o++){var E=o+C.getLength()-w[g].length;w[g][o]=E>=0?C.get(E):0}}for(var f=0,o=0;o<R.length;o++)f+=R[o].totalCount;for(var A=new Array(f),T=0,o=0;o<h;o++)for(var g=0;g<R.length;g++)o<P[g].length&&(A[T++]=P[g][o]);for(var o=0;o<b;o++)for(var g=0;g<R.length;g++)o<w[g].length&&(A[T++]=w[g][o]);return A},Ze.exports=O},HmJG:function(Ze,We,J){},Iq15:function(Ze,We,J){var q=J("nVVt"),z=J("dWSS"),L=J("dQei"),K={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var B=O<<10;N.getBCHDigit(B)-N.getBCHDigit(N.G15)>=0;)B^=N.G15<<N.getBCHDigit(B)-N.getBCHDigit(N.G15);return(O<<10|B)^N.G15_MASK},getBCHTypeNumber:function(O){for(var B=O<<12;N.getBCHDigit(B)-N.getBCHDigit(N.G18)>=0;)B^=N.G18<<N.getBCHDigit(B)-N.getBCHDigit(N.G18);return O<<12|B},getBCHDigit:function(O){for(var B=0;O!=0;)B++,O>>>=1;return B},getPatternPosition:function(O){return N.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,B,k){switch(O){case K.PATTERN000:return(B+k)%2==0;case K.PATTERN001:return B%2==0;case K.PATTERN010:return k%3==0;case K.PATTERN011:return(B+k)%3==0;case K.PATTERN100:return(Math.floor(B/2)+Math.floor(k/3))%2==0;case K.PATTERN101:return B*k%2+B*k%3==0;case K.PATTERN110:return(B*k%2+B*k%3)%2==0;case K.PATTERN111:return(B*k%3+(B+k)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var B=new z([1],0),k=0;k<O;k++)B=B.multiply(new z([1,L.gexp(k)],0));return B},getLengthInBits:function(O,B){if(1<=B&&B<10)switch(O){case q.MODE_NUMBER:return 10;case q.MODE_ALPHA_NUM:return 9;case q.MODE_8BIT_BYTE:return 8;case q.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(B<27)switch(O){case q.MODE_NUMBER:return 12;case q.MODE_ALPHA_NUM:return 11;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(B<41)switch(O){case q.MODE_NUMBER:return 14;case q.MODE_ALPHA_NUM:return 13;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+B)},getLostPoint:function(O){for(var B=O.getModuleCount(),k=0,R=0;R<B;R++)for(var S=0;S<B;S++){for(var h=0,b=O.isDark(R,S),P=-1;P<=1;P++){if(R+P<0||B<=R+P)continue;for(var w=-1;w<=1;w++){if(S+w<0||B<=S+w)continue;if(P==0&&w==0)continue;b==O.isDark(R+P,S+w)&&h++}}h>5&&(k+=3+h-5)}for(var R=0;R<B-1;R++)for(var S=0;S<B-1;S++){var g=0;O.isDark(R,S)&&g++,O.isDark(R+1,S)&&g++,O.isDark(R,S+1)&&g++,O.isDark(R+1,S+1)&&g++,(g==0||g==4)&&(k+=3)}for(var R=0;R<B;R++)for(var S=0;S<B-6;S++)O.isDark(R,S)&&!O.isDark(R,S+1)&&O.isDark(R,S+2)&&O.isDark(R,S+3)&&O.isDark(R,S+4)&&!O.isDark(R,S+5)&&O.isDark(R,S+6)&&(k+=40);for(var S=0;S<B;S++)for(var R=0;R<B-6;R++)O.isDark(R,S)&&!O.isDark(R+1,S)&&O.isDark(R+2,S)&&O.isDark(R+3,S)&&O.isDark(R+4,S)&&!O.isDark(R+5,S)&&O.isDark(R+6,S)&&(k+=40);for(var v=0,S=0;S<B;S++)for(var R=0;R<B;R++)O.isDark(R,S)&&v++;var d=Math.abs(100*v/B/B-50)/5;return k+=d*10,k}};Ze.exports=N},LdHM:function(Ze,We,J){"use strict";J.d(We,"b",function(){return u}),J.d(We,"a",function(){return E});var q=J("1OyB"),z=J("vuIU"),L=J("Ji7U"),K=J("LK+K"),N=J("cDcd"),O=J("rePB"),B=J("Ff2n"),k=J("ODXe"),R=J("4IlW"),S=J("bX4T"),h=J("YrtM"),b=J("TSYQ"),P=J.n(b),w=J("+nKL"),g=J("8OUc"),v=function(H,X){var ee=H.prefixCls,ae=H.id,be=H.flattenOptions,pe=H.childrenAsData,ue=H.values,se=H.searchValue,fe=H.multiple,ne=H.defaultActiveFirstOption,me=H.height,Q=H.itemHeight,ie=H.notFoundContent,te=H.open,Ee=H.menuItemSelectedIcon,_e=H.virtual,ye=H.onSelect,ve=H.onToggleOpen,Te=H.onActiveValue,De=H.onScroll,Re=H.onMouseEnter,Ce="".concat(ee,"-item"),Le=Object(h.a)(function(){return be},[te,be],function(Ue,ge){return ge[0]&&Ue[1]!==ge[1]}),ze=N.useRef(null),Ve=function(ge){ge.preventDefault()},Be=function(ge){ze.current&&ze.current.scrollTo({index:ge})},je=function(ge){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=Le.length,Y=0;Y<he;Y+=1){var Z=(ge+Y*ce+he)%he,re=Le[Z],le=re.group,Se=re.data;if(!le&&!Se.disabled)return Z}return-1},qe=N.useState(function(){return je(0)}),Xe=Object(k.a)(qe,2),Qe=Xe[0],Ae=Xe[1],tt=function(ge){Ae(ge);var ce=Le[ge];if(!ce){Te(null,-1);return}Te(ce.data.value,ge)};N.useEffect(function(){tt(ne!==!1?je(0):-1)},[Le.length,se]),N.useEffect(function(){var Ue=setTimeout(function(){if(!fe&&te&&ue.size===1){var ge=Array.from(ue)[0],ce=Le.findIndex(function(he){var Y=he.data;return Y.value===ge});tt(ce),Be(ce)}});return function(){return clearTimeout(Ue)}},[te]);var Je=function(ge){ge!==void 0&&ye(ge,{selected:!ue.has(ge)}),fe||ve(!1)};if(N.useImperativeHandle(X,function(){return{onKeyDown:function(ge){var ce=ge.which;switch(ce){case R.a.UP:case R.a.DOWN:{var he=0;if(ce===R.a.UP?he=-1:ce===R.a.DOWN&&(he=1),he!==0){var Y=je(Qe+he,he);Be(Y),tt(Y)}break}case R.a.ENTER:{var Z=Le[Qe];Z&&!Z.data.disabled?Je(Z.data.value):Je(void 0),te&&ge.preventDefault();break}case R.a.ESC:ve(!1)}},onKeyUp:function(){},scrollTo:function(ge){Be(ge)}}}),Le.length===0)return N.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Ce,"-empty"),onMouseDown:Ve},ie);function Oe(Ue){var ge=Le[Ue];if(!ge)return null;var ce=ge.data||{},he=ce.value,Y=ce.label,Z=ce.children,re=Object(S.a)(ce,!0),le=pe?Z:Y;return ge?N.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ue,role:"option",id:"".concat(ae,"_list_").concat(Ue),"aria-selected":ue.has(he)}),he):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(Qe-1),Oe(Qe),Oe(Qe+1)),N.createElement(w.a,{itemKey:"key",ref:ze,data:Le,height:me,itemHeight:Q,fullHeight:!1,onMouseDown:Ve,onScroll:De,virtual:_e,onMouseEnter:Re},function(Ue,ge){var ce,he=Ue.group,Y=Ue.groupOption,Z=Ue.data,re=Z.label,le=Z.key;if(he)return N.createElement("div",{className:P()(Ce,"".concat(Ce,"-group"))},re!==void 0?re:le);var Se=Z.disabled,Pe=Z.value,ke=Z.title,Ge=Z.children,it=Z.style,Me=Z.className,ct=Object(B.a)(Z,["disabled","value","title","children","style","className"]),at=ue.has(Pe),rt="".concat(Ce,"-option"),xt=P()(Ce,rt,Me,(ce={},Object(O.a)(ce,"".concat(rt,"-grouped"),Y),Object(O.a)(ce,"".concat(rt,"-active"),Qe===ge&&!Se),Object(O.a)(ce,"".concat(rt,"-disabled"),Se),Object(O.a)(ce,"".concat(rt,"-selected"),at),ce)),Et=pe?Ge:re,Rt=!Ee||typeof Ee=="function"||at;return N.createElement("div",Object.assign({},ct,{"aria-selected":at,className:xt,title:ke,onMouseMove:function(){if(Qe===ge||Se)return;tt(ge)},onClick:function(){Se||Je(Pe)},style:it}),N.createElement("div",{className:"".concat(rt,"-content")},Et||Pe),N.isValidElement(Ee)||at,Rt&&N.createElement(g.a,{className:"".concat(Ce,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},d=N.forwardRef(v);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var u=l,C=function(){return null};C.isSelectOptGroup=!0;var E=C,f=J("VTBJ"),A=J("Zm9Q");function T(I){var H=I.key,X=I.props,ee=X.children,ae=X.value,be=Object(B.a)(X,["children","value"]);return Object(f.a)({key:H,value:ae!==void 0?ae:H,children:ee},be)}function p(I){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(I).map(function(X,ee){if(!N.isValidElement(X)||!X.type)return null;var ae=X.type.isSelectOptGroup,be=X.key,pe=X.props,ue=pe.children,se=Object(B.a)(pe,["children"]);return H||!ae?T(X):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(be===null?ee:be,"__"),label:be},se),{},{options:p(ue)})}).filter(function(X){return X})}var c=J("2Qr1"),s=J("qNPg"),a=J("U8pU"),x=J("Kwbf"),y=J("WKfj");function m(I){var H=I.mode,X=I.options,ee=I.children,ae=I.backfill,be=I.allowClear,pe=I.placeholder,ue=I.getInputElement,se=I.showSearch,fe=I.onSearch,ne=I.defaultOpen,me=I.autoFocus,Q=I.labelInValue,ie=I.value,te=I.inputValue,Ee=I.optionLabelProp,_e=H==="multiple"||H==="tags",ye=se!==void 0?se:_e||H==="combobox",ve=X||p(ee);if(Object(x.a)(H!=="tags"||ve.every(function(Ce){return!Ce.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Te=ve.some(function(Ce){return Ce.options?Ce.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in Ce?Ce.value:Ce.key)=="number"});Object(x.a)(!Te,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(H==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(x.a)(H==="combobox"||!ue,"`getInputElement` only work with `combobox` mode."),Object(x.b)(H!=="combobox"||!ue||!be||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ye&&H!=="combobox"&&H!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ne||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var De=Object(y.d)(ie);Object(x.a)(!Q||De.every(function(Ce){return Object(a.a)(Ce)==="object"&&("key"in Ce||"value"in Ce)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!_e||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Re=null;Object(A.a)(ee).some(function(Ce){if(!N.isValidElement(Ce)||!Ce.type)return!1;var Le=Ce.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var ze=Object(A.a)(Ce.props.children).every(function(Ve){return!N.isValidElement(Ve)||!Ce.type||Ve.type.isSelectOption?!0:(Re=Ve.type,!1)});return!ze}return Re=Le,!0}),Re&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Re.displayName||Re.name||Re,"`.")),Object(x.a)(te===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=m,U=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:p,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:D,fillOptionsWithMissingValue:c.a}),F=function(I){Object(L.a)(X,I);var H=Object(K.a)(X);function X(){var ee;return Object(q.a)(this,X),ee=H.apply(this,arguments),ee.selectRef=N.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(z.a)(X,[{key:"render",value:function(){return N.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(N.Component);F.Option=u,F.OptGroup=E;var W=F,M=We.c=W},M8RZ:function(Ze,We,J){"use strict";J.d(We,"a",function(){return R});var q=J("fWQN"),z=J("mtLc"),L=J("yKVA"),K=J("879j"),N=J("cDcd"),O=J.n(N),B=J("faye"),k=J.n(B),R=function(S){Object(L.a)(b,S);var h=Object(K.a)(b);function b(P){var w;Object(q.a)(this,b),w=h.call(this,P);var g=window.document;return w.node=g.createElement("div"),g.body.appendChild(w.node),w}return Object(z.a)(b,[{key:"render",value:function(){var w=this.props.children;return Object(B.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(O.a.Component)},Ot1p:function(Ze,We,J){"use strict";var q=J("2qtc"),z=J("kLXV"),L=J("rAM+"),K=J("miYZ"),N=J("tsqr"),O=J("9og8"),B=J("tJVT"),k=J("jrin"),R=J("WmNS"),S=J.n(R),h=J("cDcd"),b=J.n(h),P=J("VrN/"),w=J.n(P),g=J("bdgK"),v=J("p77/"),d=J("Bd2K"),o=J("ELLl"),l=J("19Vz"),u=J("lZu9"),C=J("+NIl"),E=J("kSUc"),f=J("9Bee"),A=function(Me){var ct=Me.value,at=ct===void 0?"":ct,rt=Me.className,xt=Me.showTextOnly,Et=Me.showLines,Rt=Me.style,At=Rt===void 0?{}:Rt,pt=Object(h.useMemo)(function(){return""},[at]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},T=J("Q9mQ"),p=J("diRs"),c=J("0Owb"),s=J("dejd"),a=J("C+DQ"),x=J("D1Df"),y=J.n(x),m=J("1vsH"),D=J("m3rI"),U=[{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 F(Me){var ct=Me.onActionCallback,at=Me.title,rt=Me.icon,xt=Me.actionName,Et=Me.className,Rt=Et===void 0?"":Et,At=Me.children;function pt(){ct(xt)}return b.a.createElement("a",{title:at,className:Rt,onClick:pt},b.a.createElement("i",{className:"md-iconfont ".concat(rt)}),At)}var W=function(Me){var ct=Me.watch,at=Me.showNullButton,rt=Me.onActionCallback,xt=Me.fullScreen,Et=Me.insertTemp,Rt=Me.hidetoolBar,At=Me.uuid,pt=Me.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(m.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER)));var or=[].concat(U,[{title:"".concat(ct?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ct?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!Rt&&or.map(function(Kt,Ft){return b.a.createElement("li",{key:Ft},Kt.actionName?b.a.createElement(F,Object(c.a)({},Kt,{onActionCallback:rt})):b.a.createElement("span",{className:"v-line"}))}),at?b.a.createElement("li",null,b.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&b.a.createElement("li",null,b.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:rt},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(p.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(m.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER))}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(F,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},M=J("M8RZ"),I=J("+L6B"),H=J("2/Rp"),X=J("y8nQ"),ee=J("Vl3Y"),ae=J("5NDa"),be=J("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},ue=function(Me){var ct=Me.callback,at=Me.onCancel;function rt(xt){ct(xt)}return b.a.createElement(ee.a,Object(c.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),b.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(be.a,null)),b.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(be.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},se=J("7ahc"),fe=J("k1fw"),ne=J("HmJG"),me=J("BjJ7"),Q=ee.a.useForm,ie={width:280,marginRight:10},te={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Me){var ct=Me.callback,at=Me.onCancel,rt=Q(),xt=Object(B.a)(rt,1),Et=xt[0],Rt=useRef();function At(Kt){ct(Object(fe.a)(Object(fe.a)({},Kt),{},{name:Rt.current}))}function pt(Kt,Ft){if(Kt.status===-1){N.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ft.type})}function or(Kt){var Ft=Kt.target.files[0];Rt.current=Ft.name,ye(Ft,pt)}return b.a.createElement(ee.a,Object(c.a)({form:Et},te,{className:"upload-image-panel",onFinish:At}),b.a.createElement(ee.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(ee.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(be.a,{style:ie})),b.a.createElement(_e,{onFileChange:or}))),b.a.createElement(ee.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},b.a.createElement(be.a,{style:{width:264}})),b.a.createElement(ee.a.Item,{style:{textAlign:"right"}},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function _e(Me){var ct=Me.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:ct}))}function ye(Me,ct){if(!Me)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Me),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(xt){ct(JSON.parse(xt.target.responseText),Me)},!1),rt.addEventListener("error",function(xt){console.error(xt)},!1),rt.open("POST","".concat(me.a,"/api/attachments.json")),rt.send(at)}var ve=J("giR+"),Te=J("fyUT"),De=J("7Kak"),Re=J("9yH6"),Ce=Re.a.Group,Le={margin:"0 8px"},ze=function(Me){var ct=Me.callback,at=Me.onCancel;function rt(xt){ct(xt)}return b.a.createElement(ee.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},b.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},b.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:Le},"\u884C\u6570"),b.a.createElement(ee.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(Te.a,null)),b.a.createElement("span",{style:Le},"\u5217\u6570"),b.a.createElement(ee.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(Te.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},b.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(ee.a.Item,{name:"align"},b.a.createElement(Ce,null,b.a.createElement(Re.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(Re.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(Re.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(Re.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Ve=J("ErOA"),Be=J("7Cbv"),je="link",qe="upload-image",Xe="code-block",Qe="add-table",Ae="------------",tt={default:Ae,left:":".concat(Ae),center:":".concat(Ae,":"),right:"".concat(Ae,":")},Je=J("9VGf"),Oe,Ue;function ge(){}var ce=0,he=1e4,Y="\u2581",Z=`
|
|
**\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 re(Me){return/^\d+$/.test(Me)?"".concat(Me,"px"):Me}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,Se=le?"Cmd":"Ctrl",Pe=["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"],ke=(Oe={},Object(k.a)(Oe,Se+"-B","bold"),Object(k.a)(Oe,Se+"-I","italic"),Oe),Ge=(Ue={},Object(k.a)(Ue,je,"\u6DFB\u52A0\u94FE\u63A5"),Object(k.a)(Ue,Xe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(k.a)(Ue,qe,"\u6DFB\u52A0\u6587\u4EF6"),Object(k.a)(Ue,Qe,"\u6DFB\u52A0\u8868\u683C"),Ue),it=We.a=function(Me){var ct=Me.defaultValue,at=ct===void 0?"":ct,rt=Me.onChange,xt=Me.width,Et=xt===void 0?"100%":xt,Rt=Me.height,At=Rt===void 0?400:Rt,pt=Me.miniToolbar,or=pt===void 0?!1:pt,Kt=Me.isFocus,Ft=Kt===void 0?!1:Kt,Tr=Me.watch,vr=Me.insertTemp,wi=Me.mode,mr=wi===void 0?"markdown":wi,vn=Me.id,Jr=vn===void 0?"markdown-editor-id":vn,Mt=Me.showResizeBar,st=Mt===void 0?!1:Mt,Sr=Me.noStorage,Vn=Sr===void 0?!1:Sr,cr=Me.showNullButton,St=cr===void 0?!1:cr,wr=Me.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Me.fullScreen,Fe=yn===void 0?!1:yn,ft=Me.onBlur,qr=Me.onCMBeforeChange,en=Me.onFullScreen,tn=Me.className,bn=tn===void 0?"":tn,Xn=Me.disablePaste,mt=Xn===void 0?!1:Xn,Ci=Me.placeholder,_i=Ci===void 0?"":Ci,rn=Me.values,sr=rn===void 0?"":rn,Ai=Object(h.useState)(null),Yn=Object(B.a)(Ai,2),He=Yn[0],$n=Yn[1],Li=Object(h.useState)(at),En=Object(B.a)(Li,2),nn=En[0],Ur=En[1],Di=Object(h.useState)(Tr),Qn=Object(B.a)(Di,2),Dr=Qn[0],Oi=Qn[1],Ri=Object(h.useState)(Fe),pr=Object(B.a)(Ri,2),Cr=pr[0],Pi=pr[1],xn=Object(h.useState)(""),Nr=Object(B.a)(xn,2),Fr=Nr[0],Br=Nr[1],aa=Object(h.useState)(0),Mi=Object(B.a)(aa,2),Or=Mi[0],Tn=Mi[1],oa=Object(h.useState)(At),Jn=Object(B.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(h.useState)(!1),wn=Object(B.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(h.useRef)(Object(Be.a)()),ki=Object(h.useRef)(!1),qn=Object(h.useRef)(),$t=Object(h.useRef)(),jr=Object(h.useRef)(),_n=Object(h.useRef)(),Wr=Object(h.useRef)(),Ii=function(){var ot=Object(O.a)(S.a.mark(function ht(){var ut,vt;return S.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return Dt.next=2,Object(Ve.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=Dt.sent,vt!=null&&(ut=vt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",He,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?He.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):He.replaceSelection("[".concat(yt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Dt.stop()}},ht)}));return function(){return ot.apply(this,arguments)}}();Object(h.useEffect)(function(){Ur(sr),He==null||He.setValue(sr)},[sr]),Object(h.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(h.useEffect)(function(){if($t.current){var ot=w.a.fromTextArea($t.current,{mode:mr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Ft&&ot.focus();function ht(ut,vt){if(mt){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var Dt=Tt.types.toString(),yt=Tt.items;if(Dt==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),mr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),Pr=bt.name.split(".").pop();ye(bt,function(Ct){if(Ct.id){var Zt,Lt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Lt=bt.type)===null||Lt===void 0)?void 0:Lt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Pe.includes(Pr)?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",ht),ot.on("dragleave",function(ut,vt){jr.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(ut,vt){jr.current.classList.add("mouse-hover-md")}),ot.on("drop",function(ut,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Dt=function(Wt){var bt=Tt[Wt],Pr=bt.name.split(".").pop();ye(bt,function(Ct){if(Ct.id){var Zt,Lt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Lt=bt.type)===null||Lt===void 0)?void 0:Lt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Pe.includes(Pr)?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},yt=0;yt<Tt.length;yt++)Dt(yt)}}),$n(ot),function(){ot.off("paste",ht)}}},[]);var yr=Object(h.useCallback)(function(){if(jr.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(h.useEffect)(function(){function ot(){var ut=new g.default(function(vt){var Tt=Object(L.a)(vt),Dt;try{for(Tt.s();!(Dt=Tt.n()).done;){var yt=Dt.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),He.setSize("100%","100%"),He.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return ut.observe($t.current.parentElement),ut}if(He){var ht=ot();return function(){ht.unobserve($t.current.parentElement)}}},[He,yr]),Object(h.useEffect)(function(){if(He){for(var ot=[],ht=function(){var yt=vt[ut];Tt=Object(B.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(k.a)({},It,function(){An(Wt)});ot.push(bt),He.addKeyMap(bt)},ut=0,vt=Object.entries(ke);ut<vt.length;ut++){var Tt;ht()}return qn.current=setInterval(function(){ki.current&&Ii()},4e3),function(){clearInterval(qn.current);var Dt=Object(L.a)(ot),yt;try{for(Dt.s();!(yt=Dt.n()).done;){var It=yt.value;He.removeKeyMap(It)}}catch(Wt){Dt.e(Wt)}finally{Dt.f()}}}},[He]),Object(h.useEffect)(function(){Fe!==Cr&&Pi(Fe)},[Fe]),Object(Je.a)(function(){if(!Vn&&Or>0){var ot=new Date().getTime(),ht=window.sessionStorage.getItem(Jr);ot>=Or+he&&(!ht||ht!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},he),Object(h.useEffect)(function(){Oi(Tr)},[He,Tr]),Object(h.useEffect)(function(){He&&(Ft&&He.focus())},[He,Ft]),Object(h.useEffect)(function(){if(Dr&&He){var ot=He.getScrollerElement();function ht(ut){var vt=ut.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return ot.addEventListener("scroll",ht),function(){ot.removeEventListener("scroll",ht)}}},[He,Dr]),Object(h.useEffect)(function(){if(He&&qr){function ot(ht,ut){qr(ht,ut)}return He.on("beforeChange",ot),function(){He.off("beforeChange",ot)}}},[He,qr]),Object(h.useEffect)(function(){if(He&&ft){function ot(){ft(He.getValue())}return He.on("blur",ot),function(){He.off("blur",ot)}}},[He,ft]),Object(h.useEffect)(function(){if(He){function ot(ht){var ut=ht.getValue();Ur(ut),Tn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(ut)}return He.on("change",ot),function(){He.off("change",ot)}}},[He,rt]),Object(h.useEffect)(function(){He&&(at==null?(He.setValue(""),Ur("")):at!==He.getValue()&&(He.setValue(at),Ur(at),He.setCursor(He.lineCount(),0)))},[He,at]);var An=Object(h.useCallback)(function(ot){var ht=He.getCursor(),ut=He.getSelection(),vt=ut.split(`
|
|
`);switch(ot){case"bold":return He.replaceSelection("**"+ut+"**"),ut===""&&He.setCursor(ht.line,ht.ch+2),He.focus();case"italic":return He.replaceSelection("*"+ut+"*"),ut===""&&He.setCursor(ht.line,ht.ch+1),He.focus();case"code":return He.replaceSelection("`"+ut+"`"),ut===""&&He.setCursor(ht.line,ht.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+ut+"$$`"),ut===""&&He.setCursor(ht.line,ht.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+ut+"\n```"),He.setCursor(ht.line+1,ut.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
|
|
`),He.focus();case"list-ul":return ut===""?He.replaceSelection("- "+ut):He.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
|
|
`)),He.focus();case"list-ol":return ut===""?He.replaceSelection("1. "+ut):He.replaceSelection(vt.map(function(Tt,Dt){return Tt===""?"":"".concat(Dt+1,". ").concat(Tt)}).join(`
|
|
`)),He.focus();case"add-null-ch":return ut===""&&He.setCursor(ht.line,ht.ch+1),He.replaceSelection(Y),He.focus();case"inster-template-1":return ut===""&&He.setCursor(ht.line,ht.ch),He.replaceSelection(Z),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return Oi(!Dr),He.focus();case"trigger-full-screen":return Pi(!Cr),He.focus();case je:Br(je);return;case Xe:Br(Xe);return;case qe:Br(qe);return;case Qe:Br(Qe);return;default:throw new Error}},[He,Dr,Cr]),lr=Object(h.useCallback)(function(ot){Br("");switch(Fr){case je:var ht=ot.title,ut=ot.link;return He.replaceSelection("[".concat(ht,"](").concat(ut,")")),He.focus();case Xe:var vt=ot.language,Tt=ot.content;return He.replaceSelection(["```"+vt,Tt,"```"].join(`
|
|
`)),He.focus();case qe:var Dt=ot.src,yt=ot.alt;return yt?He.replaceSelection(".concat(Dt,' "').concat(yt,'" )')):He.replaceSelection("")),He.focus();case Qe:for(var It=ot.row,Wt=ot.col,bt=ot.align,Pr=`
|
|
`,Ct=0;Ct<It;Ct++){for(var Zt=[],Lt=[],gr=0;gr<Wt;gr++)Ct===1&&Lt.push(tt[bt]),Zt.push(" ");Ct===1&&(Pr+="| ".concat(Lt.join(" | "),` |
|
|
`)),Pr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
|
|
`)}return He.replaceSelection(Pr+`
|
|
`),He.focus();default:throw new Error}},[He,Fr]),Ln=Object(h.useMemo)(function(){switch(Fr){case je:return b.a.createElement(ue,{callback:lr,onCancel:Rr});case Xe:return b.a.createElement(se.b,{callback:lr,onCancel:Rr});case qe:return b.a.createElement(Ee,{callback:lr,onCancel:Rr});case Qe:return b.a.createElement(ze,{callback:lr,onCancel:Rr});default:return null}},[Fr]);function Rr(){Br("")}Object(h.useEffect)(function(){if(_n.current){var ot=_n.current,ht=!1,ut=0;function vt(yt){ht=!0,ut=yt.pageY}function Tt(){ht=!1}function Dt(yt){if(ht){var It=yt.pageY-ut;It<0&&(It=0),It>300&&(It=300);var Wt=At+It+"px";an(Wt)}}return ot.addEventListener("mousedown",vt),document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Tt),function(){ot.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Tt)}}},[He,_n]),Object(h.useEffect)(function(){an(At)},[At]);var Hr=re(Et),la=re(Zn),ua={width:Hr,height:la},$a=Object(h.useMemo)(function(){if(Or){var ot=new Date(Or),ht=ot.getHours(),ut=ot.getMinutes(),vt=ot.getSeconds();return ht=ht<10?"0"+ht:ht,ut=ut<10?"0"+ut:ut,vt=vt<10?"0"+vt:vt,"".concat(ht,":").concat(ut,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),He.setValue(window.sessionStorage.getItem(Jr))}function Ui(ot,ht){var ut=He.getValue();ut=ut.replace(ot,ht),Ur(ut),He==null||He.setValue(ut)}return b.a.createElement(h.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},b.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Dr?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},b.a.createElement(W,{insertTemp:vr,watch:Dr,fullScreen:Cr,showNullButton:St,onActionCallback:An,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){ki.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:$t,placeholder:_i})),Dr?b.a.createElement("div",{ref:Wr,className:"preview-container"},mr==="stex"&&b.a.createElement(A,{value:nn}),mr!=="stex"&&b.a.createElement(f.a,{edit:!0,value:nn,replaces:Ui})):null))),st?b.a.createElement("a",{ref:_n,className:"editor-resize"}):null,b.a.createElement(M.a,null,Ge[Fr]?b.a.createElement(z.a,{centered:!0,title:Ge[Fr],visible:!0,onCancel:Rr,footer:null,className:"markdown-popup-form"},Ln):null))}},SJMd:function(Ze,We){/**
|
|
* @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 J,q,z,L=!1,K,N;window.PR_SHOULD_USE_CONTINUATION=!0;var O,B;(function(){var k=window,R=["break,continue,do,else,for,if,return,while"],S=[R,"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"],h=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[h,"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"],P=[h,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[h,"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"],g="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",v=[h,"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=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[R,"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"],u=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[b,w,P,v,d,o,l,u],E=/^(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",A="kwd",T="com",p="typ",c="lit",s="pun",a="pln",x="tag",y="dec",m="src",D="atn",U="atv",F="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ye){for(var ve=0,Te=!1,De=!1,Re=0,Ce=ye.length;Re<Ce;++Re){var Le=ye[Re];if(Le.ignoreCase)De=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Te=!0,De=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function Ve(Qe){var Ae=Qe.charCodeAt(0);if(Ae!==92)return Ae;var tt=Qe.charAt(1);return Ae=ze[tt],Ae||("0"<=tt&&tt<="7"?parseInt(Qe.substring(1),8):tt==="u"||tt==="x"?parseInt(Qe.substring(2),16):Qe.charCodeAt(1))}function Be(Qe){if(Qe<32)return(Qe<16?"\\x0":"\\x")+Qe.toString(16);var Ae=String.fromCharCode(Qe);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function je(Qe){var Ae=Qe.substring(1,Qe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),tt=[],Je=Ae[0]==="^",Oe=["["];Je&&Oe.push("^");for(var Ue=Je?1:0,ge=Ae.length;Ue<ge;++Ue){var ce=Ae[Ue];if(/\\[bdsw]/i.test(ce))Oe.push(ce);else{var he=Ve(ce),Y;Ue+2<ge&&Ae[Ue+1]==="-"?(Y=Ve(Ae[Ue+2]),Ue+=2):Y=he,tt.push([he,Y]),Y<65||he>122||(Y<65||he>90||tt.push([Math.max(65,he)|32,Math.min(Y,90)|32]),Y<97||he>122||tt.push([Math.max(97,he)&~32,Math.min(Y,122)&~32]))}}tt.sort(function(Se,Pe){return Se[0]-Pe[0]||Pe[1]-Se[1]});for(var Z=[],re=[],Ue=0;Ue<tt.length;++Ue){var le=tt[Ue];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):Z.push(re=le)}for(var Ue=0;Ue<Z.length;++Ue){var le=Z[Ue];Oe.push(Be(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Oe.push("-"),Oe.push(Be(le[1])))}return Oe.push("]"),Oe.join("")}function qe(Qe){for(var Ae=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")),tt=Ae.length,Je=[],Oe=0,Ue=0;Oe<tt;++Oe){var ge=Ae[Oe];if(ge==="(")++Ue;else if(ge.charAt(0)==="\\"){var ce=+ge.substring(1);ce&&(ce<=Ue?Je[ce]=-1:Ae[Oe]=Be(ce))}}for(var Oe=1;Oe<Je.length;++Oe)Je[Oe]===-1&&(Je[Oe]=++ve);for(var Oe=0,Ue=0;Oe<tt;++Oe){var ge=Ae[Oe];if(ge==="(")++Ue,Je[Ue]||(Ae[Oe]="(?:");else if(ge.charAt(0)==="\\"){var ce=+ge.substring(1);ce&&ce<=Ue&&(Ae[Oe]="\\"+Je[ce])}}for(var Oe=0;Oe<tt;++Oe)Ae[Oe]==="^"&&Ae[Oe+1]!=="^"&&(Ae[Oe]="");if(Qe.ignoreCase&&Te)for(var Oe=0;Oe<tt;++Oe){var ge=Ae[Oe],he=ge.charAt(0);ge.length>=2&&he==="["?Ae[Oe]=je(ge):he!=="\\"&&(Ae[Oe]=ge.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Ae.join("")}for(var Xe=[],Re=0,Ce=ye.length;Re<Ce;++Re){var Le=ye[Re];if(Le.global||Le.multiline)throw new Error(""+Le);Xe.push("(?:"+qe(Le)+")")}return new RegExp(Xe.join("|"),De?"gi":"g")}function I(ye,ve){var Te=/(?:^|\s)nocode(?:\s|$)/,De=[],Re=0,Ce=[],Le=0;function ze(Ve){var Be=Ve.nodeType;if(Be==1){if(Te.test(Ve.className))return;for(var je=Ve.firstChild;je;je=je.nextSibling)ze(je);var qe=Ve.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(De[Le]=`
|
|
`,Ce[Le<<1]=Re++,Ce[Le++<<1|1]=Ve)}else if(Be==3||Be==4){var Xe=Ve.nodeValue;Xe.length&&(ve?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),De[Le]=Xe,Ce[Le<<1]=Re,Re+=Xe.length,Ce[Le++<<1|1]=Ve)}}return ze(ye),{sourceCode:De.join("").replace(/\n$/,""),spans:Ce}}function H(ye,ve,Te,De,Re){if(!Te)return;var Ce={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Te,spans:null,basePos:ve,decorations:null};De(Ce),Re.push.apply(Re,Ce.decorations)}var X=/\S/;function ee(ye){for(var ve=void 0,Te=ye.firstChild;Te;Te=Te.nextSibling){var De=Te.nodeType;ve=De===1?ve?ye:Te:De===3&&X.test(Te.nodeValue)?ye:ve}return ve===ye?void 0:ve}function ae(ye,ve){var Te={},De;(function(){for(var Le=ye.concat(ve),ze=[],Ve={},Be=0,je=Le.length;Be<je;++Be){var qe=Le[Be],Xe=qe[3];if(Xe)for(var Qe=Xe.length;--Qe>=0;)Te[Xe.charAt(Qe)]=qe;var Ae=qe[1],tt=""+Ae;Ve.hasOwnProperty(tt)||(ze.push(Ae),Ve[tt]=null)}ze.push(/[\0-\uffff]/),De=M(ze)})();var Re=ve.length,Ce=function(Le){for(var ze=Le.sourceCode,Ve=Le.basePos,Be=Le.sourceNode,je=[Ve,a],qe=0,Xe=ze.match(De)||[],Qe={},Ae=0,tt=Xe.length;Ae<tt;++Ae){var Je=Xe[Ae],Oe=Qe[Je],Ue=void 0,ge;if(typeof Oe=="string")ge=!1;else{var ce=Te[Je.charAt(0)];if(ce)Ue=Je.match(ce[1]),Oe=ce[0];else{for(var he=0;he<Re;++he)if(ce=ve[he],Ue=Je.match(ce[1]),Ue){Oe=ce[0];break}Ue||(Oe=a)}ge=Oe.length>=5&&Oe.substring(0,5)==="lang-",ge&&!(Ue&&typeof Ue[1]=="string")&&(ge=!1,Oe=m),ge||(Qe[Je]=Oe)}var Y=qe;if(qe+=Je.length,!ge)je.push(Ve+Y,Oe);else{var Z=Ue[1],re=Je.indexOf(Z),le=re+Z.length;Ue[2]&&(le=Je.length-Ue[2].length,re=le-Z.length);var Se=Oe.substring(5);H(Be,Ve+Y,Je.substring(0,re),Ce,je),H(Be,Ve+Y+re,Z,me(Se,Z),je),H(Be,Ve+Y+le,Je.substring(le),Ce,je)}}Le.decorations=je};return Ce}function be(ye){var ve=[],Te=[];ye.tripleQuotedStrings?ve.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?ve.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ve.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Te.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var De=ye.hashComments;De&&(ye.cStyleComments?(De>1?ve.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ve.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Te.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ve.push([T,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Te.push([T,/^\/\/[^\r\n]*/,null]),Te.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Re=ye.regexLiterals;if(Re){var Ce=Re>1?"":`
|
|
\r`,Le=Ce?".":"[\\S\\s]",ze="/(?=[^/*"+Ce+"])(?:[^/\\x5B\\x5C"+Ce+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+Ce+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";Te.push(["lang-regex",RegExp("^"+W+"("+ze+")")])}var Ve=ye.types;Ve&&Te.push([p,Ve]);var Be=(""+ye.keywords).replace(/^ | $/g,"");Be.length&&Te.push([A,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),ve.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(je+="(?!s*/)"),Te.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[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],[s,new RegExp(je),null]),ae(ve,Te)}var pe=be({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ue(ye,ve,Te){for(var De=/(?:^|\s)nocode(?:\s|$)/,Re=/\r\n?|\n/,Ce=ye.ownerDocument,Le=Ce.createElement("li");ye.firstChild;)Le.appendChild(ye.firstChild);var ze=[Le];function Ve(Ae){var tt=Ae.nodeType;if(tt==1&&!De.test(Ae.className))if(Ae.nodeName==="br")Be(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)Ve(Je);else if((tt==3||tt==4)&&Te){var Oe=Ae.nodeValue,Ue=Oe.match(Re);if(Ue){var ge=Oe.substring(0,Ue.index);Ae.nodeValue=ge;var ce=Oe.substring(Ue.index+Ue[0].length);if(ce){var he=Ae.parentNode;he.insertBefore(Ce.createTextNode(ce),Ae.nextSibling)}Be(Ae),ge||Ae.parentNode.removeChild(Ae)}}}function Be(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function tt(Ue,ge){var ce=ge?Ue.cloneNode(!1):Ue,he=Ue.parentNode;if(he){var Y=tt(he,1),Z=Ue.nextSibling;Y.appendChild(ce);for(var re=Z;re;re=Z)Z=re.nextSibling,Y.appendChild(re)}return ce}for(var Je=tt(Ae.nextSibling,0),Oe;(Oe=Je.parentNode)&&Oe.nodeType===1;)Je=Oe;ze.push(Je)}for(var je=0;je<ze.length;++je)Ve(ze[je]);ve===(ve|0)&&ze[0].setAttribute("value",ve);var qe=Ce.createElement("ol");qe.className="linenums";for(var Xe=Math.max(0,ve-1|0)||0,je=0,Qe=ze.length;je<Qe;++je)Le=ze[je],Le.className="L"+(je+Xe)%10,Le.firstChild||Le.appendChild(Ce.createTextNode("\xA0")),qe.appendChild(Le);ye.appendChild(qe)}function se(ye){var ve=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ve=ve&&+ve[1]<=8;var Te=/\n/g,De=ye.sourceCode,Re=De.length,Ce=0,Le=ye.spans,ze=Le.length,Ve=0,Be=ye.decorations,je=Be.length,qe=0;Be[je]=Re;var Xe,Qe;for(Qe=Xe=0;Qe<je;)Be[Qe]!==Be[Qe+2]?(Be[Xe++]=Be[Qe++],Be[Xe++]=Be[Qe++]):Qe+=2;for(je=Xe,Qe=Xe=0;Qe<je;){for(var Ae=Be[Qe],tt=Be[Qe+1],Je=Qe+2;Je+2<=je&&Be[Je+1]===tt;)Je+=2;Be[Xe++]=Ae,Be[Xe++]=tt,Qe=Je}je=Be.length=Xe;var Oe=ye.sourceNode,Ue="";Oe&&(Ue=Oe.style.display,Oe.style.display="none");try{for(var ge=null;Ve<ze;){var ce=Le[Ve],he=Le[Ve+2]||Re,Y=Be[qe+2]||Re,Je=Math.min(he,Y),Z=Le[Ve+1],re;if(Z.nodeType!==1&&(re=De.substring(Ce,Je))){ve&&(re=re.replace(Te,"\r")),Z.nodeValue=re;var le=Z.ownerDocument,Se=le.createElement("span");Se.className=Be[qe+1];var Pe=Z.parentNode;Pe.replaceChild(Se,Z),Se.appendChild(Z),Ce<he&&(Le[Ve+1]=Z=le.createTextNode(De.substring(Je,he)),Pe.insertBefore(Z,Se.nextSibling))}Ce=Je,Ce>=he&&(Ve+=2),Ce>=Y&&(qe+=2)}}finally{Oe&&(Oe.style.display=Ue)}}var fe={};function ne(ye,ve){for(var Te=ve.length;--Te>=0;){var De=ve[Te];fe.hasOwnProperty(De)?k.console&&console.warn("cannot override language handler %s",De):fe[De]=ye}}function me(ye,ve){return ye&&fe.hasOwnProperty(ye)||(ye=/^\s*</.test(ve)?"default-markup":"default-code"),fe[ye]}ne(pe,["default-code"]),ne(ae([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ne(ae([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["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"]),ne(ae([],[[U,/^[\s\S]+/]]),["uq.val"]),ne(be({keywords:b,hashComments:!0,cStyleComments:!0,types:E}),["c","cc","cpp","cxx","cyc","m"]),ne(be({keywords:"null,true,false"}),["json"]),ne(be({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:E}),["cs"]),ne(be({keywords:P,cStyleComments:!0}),["java"]),ne(be({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(be({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(be({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(be({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(be({keywords:g,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ae([],[[f,/^[\s\S]+/]]),["regex"]);function Q(ye){var ve=ye.langExtension;try{var Te=I(ye.sourceNode,ye.pre),De=Te.sourceCode;ye.sourceCode=De,ye.spans=Te.spans,ye.basePos=0,me(ve,De)(ye),se(ye)}catch(Re){k.console&&console.log(Re&&Re.stack||Re)}}function ie(ye,ve,Te){var De=Te||!1,Re=ve||null,Ce=document.createElement("div");Ce.innerHTML="<pre>"+ye+"</pre>",Ce=Ce.firstChild,De&&ue(Ce,De,!0);var Le={langExtension:Re,numberLines:De,sourceNode:Ce,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Q(Le),Ce.innerHTML}function te(ye,ve){var Te=ve||document.body,De=Te.ownerDocument||document;function Re(ce){return Te.getElementsByTagName(ce)}for(var Ce=[Re("pre"),Re("code"),Re("xmp")],Le=[],ze=0;ze<Ce.length;++ze)for(var Ve=0,Be=Ce[ze].length;Ve<Be;++Ve)Le.push(Ce[ze][Ve]);Ce=null;var je=Date;je.now||(je={now:function(){return+new Date}});var qe=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,tt=/pre|xmp/i,Je=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Ue={};function ge(){for(var ce=k.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;qe<Le.length&&je.now()<ce;qe++){for(var he=Le[qe],Y=Ue,Z=he;Z=Z.previousSibling;){var re=Z.nodeType,le=(re===7||re===8)&&Z.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(Z.nodeValue))break;if(le){Y={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(At,pt,or){Y[pt]=or});break}}var Se=he.className;if((Y!==Ue||Qe.test(Se))&&!Ae.test(Se)){for(var Pe=!1,ke=he.parentNode;ke;ke=ke.parentNode){var Ge=ke.tagName;if(Oe.test(Ge)&&ke.className&&Qe.test(ke.className)){Pe=!0;break}}if(!Pe){he.className+=" prettyprinted";var it=Y.lang;if(!it){it=Se.match(Xe);var Me;!it&&(Me=ee(he))&&Je.test(Me.tagName)&&(it=Me.className.match(Xe)),it&&(it=it[1])}var ct;if(tt.test(he.tagName))ct=1;else{var at=he.currentStyle,rt=De.defaultView,xt=at?at.whiteSpace:rt&&rt.getComputedStyle?rt.getComputedStyle(he,null).getPropertyValue("white-space"):0;ct=xt&&xt.substring(0,3)==="pre"}var Et=Y.linenums;(Et=Et==="true"||+Et)||(Et=Se.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&ue(he,Et,ct);var Rt={langExtension:it,sourceNode:he,numberLines:Et,pre:ct,sourceCode:null,basePos:null,spans:null,decorations:null};Q(Rt)}}}qe<Le.length?k.setTimeout(ge,250):typeof ye=="function"&&ye()}ge()}var Ee=k.PR={createSimpleLexer:ae,registerLangHandler:ne,sourceDecorator:be,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:y,PR_KEYWORD:A,PR_LITERAL:c,PR_NOCODE:F,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:m,PR_STRING:f,PR_TAG:x,PR_TYPE:p,prettyPrintOne:L?k.prettyPrintOne=ie:O=ie,prettyPrint:B=L?k.prettyPrint=te:B=te},_e=k.define;typeof _e=="function"&&_e.amd&&_e("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(Ze,We,J){(function(q,z){Ze.exports=z()})(this,function(){"use strict";var q=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(q),K=/MSIE \d/.test(q),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),O=/Edge\/(\d+)/.exec(q),B=K||N||O,k=B&&(K?document.documentMode||6:+(O||N)[1]),R=!O&&/WebKit\//.test(q),S=R&&/Qt\/\d+\.\d+/.test(q),h=!O&&/Chrome\//.test(q),b=/Opera\//.test(q),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),g=/PhantomJS/.test(q),v=!O&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),d=/Android/.test(q),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),l=v||/Mac/.test(z),u=/\bCrOS\b/.test(q),C=/win/i.test(z),E=b&&q.match(/Version\/(\d*\.\d*)/);E&&(E=Number(E[1])),E&&E>=15&&(b=!1,R=!0);var f=l&&(S||b&&(E==null||E<12.11)),A=L||B&&k>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=function(e,t){var n=e.className,r=T(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 s(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 _=0;_<t.length;++_)i.appendChild(t[_]);return i}function x(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function m(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function F(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,j=i||0;;){var G=e.indexOf(" ",_);if(G<0||G>=t)return j+(t-_);j+=G-_,j+=n-j%n,_=G+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ae=50,be={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},ue={origin:"*mouse"},se={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var j=_-r;if(_==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=_-r,i+=n-i%n,r=_+1,i>=t)return r}}var ne=[""];function me(e){for(;ne.length<=e;)ne.push(Q(ne)+" ");return ne[e]}function Q(e){return e[e.length-1]}function ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function te(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function _e(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&I(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ve(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Te(e,t){return t?t.source.indexOf("\\w")>-1&&ve(e)?!0:t.test(e):ve(e)}function De(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Re=/[\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 Ce(e){return e.charCodeAt(0)>=768&&Re.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&Ce(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,_=r<0?Math.ceil(i):Math.floor(i);if(_==t)return e(_)?t:n;e(_)?n=_:t=_+r}}function Ve(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,_=0;_<e.length;++_){var j=e[_];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",_),i=!0)}i||r(t,n,"ltr")}var Be=null;function je(e,t,n){var r;Be=null;for(var i=0;i<e.length;++i){var _=e[i];if(_.from<t&&_.to>t)return i;_.to==t&&(_.from!=_.to&&n=="before"?r=i:Be=i),_.from==t&&(_.from!=_.to&&n!="before"?r=i:Be=i)}return r!=null?r:Be}var qe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n($){return $<=247?e.charAt($):1424<=$&&$<=1524?"R":1536<=$&&$<=1785?t.charAt($-1536):1774<=$&&$<=2220?"r":8192<=$&&$<=8203?"w":$==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,_=/[LRr]/,j=/[Lb1n]/,G=/[1n]/;function V($,oe,de){this.level=$,this.from=oe,this.to=de}return function($,oe){var de=oe=="ltr"?"L":"R";if($.length==0||oe=="ltr"&&!r.test($))return!1;for(var we=$.length,xe=[],Ie=0;Ie<we;++Ie)xe.push(n($.charCodeAt(Ie)));for(var Ne=0,Ke=de;Ne<we;++Ne){var Ye=xe[Ne];Ye=="m"?xe[Ne]=Ke:Ke=Ye}for(var et=0,$e=de;et<we;++et){var nt=xe[et];nt=="1"&&$e=="r"?xe[et]="n":_.test(nt)&&($e=nt,nt=="r"&&(xe[et]="R"))}for(var dt=1,lt=xe[0];dt<we-1;++dt){var gt=xe[dt];gt=="+"&<=="1"&&xe[dt+1]=="1"?xe[dt]="1":gt==","&<==xe[dt+1]&&(lt=="1"||lt=="n")&&(xe[dt]=lt),lt=gt}for(var Ot=0;Ot<we;++Ot){var Vt=xe[Ot];if(Vt==",")xe[Ot]="N";else if(Vt=="%"){var kt=void 0;for(kt=Ot+1;kt<we&&xe[kt]=="%";++kt);for(var dr=Ot&&xe[Ot-1]=="!"||kt<we&&xe[kt]=="1"?"1":"N",nr=Ot;nr<kt;++nr)xe[nr]=dr;Ot=kt-1}}for(var Bt=0,ir=de;Bt<we;++Bt){var Yt=xe[Bt];ir=="L"&&Yt=="1"?xe[Bt]="L":_.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<we;++Ht)if(i.test(xe[Ht])){var jt=void 0;for(jt=Ht+1;jt<we&&i.test(xe[jt]);++jt);for(var Ut=(Ht?xe[Ht-1]:de)=="L",ar=(jt<we?xe[jt]:de)=="L",zn=Ut==ar?Ut?"L":"R":de,Qr=Ht;Qr<jt;++Qr)xe[Qr]=zn;Ht=jt-1}for(var Jt=[],Lr,Xt=0;Xt<we;)if(j.test(xe[Xt])){var Xa=Xt;for(++Xt;Xt<we&&j.test(xe[Xt]);++Xt);Jt.push(new V(0,Xa,Xt))}else{var Ir=Xt,pn=Jt.length,gn=oe=="rtl"?1:0;for(++Xt;Xt<we&&xe[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(G.test(xe[er])){Ir<er&&(Jt.splice(pn,0,new V(1,Ir,er)),pn+=gn);var Gn=er;for(++er;er<Xt&&G.test(xe[er]);++er);Jt.splice(pn,0,new V(2,Gn,er)),pn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(pn,0,new V(1,Ir,Xt))}return oe=="ltr"&&(Jt[0].level==1&&(Lr=$.match(/^\s+/))&&(Jt[0].from=Lr[0].length,Jt.unshift(new V(0,0,Lr[0].length))),Q(Jt).level==1&&(Lr=$.match(/\s+$/))&&(Q(Jt).to-=Lr[0].length,Jt.push(new V(0,we-Lr[0].length,we)))),oe=="rtl"?Jt.reverse():Jt}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=qe(e.text,t)),n}var Qe=[],Ae=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Qe).concat(n)}};function tt(e,t){return e._handlers&&e._handlers[t]||Qe}function Je(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var _=ee(i,n);_>-1&&(r[t]=i.slice(0,_).concat(i.slice(_+1)))}}}function Oe(e,t){var n=tt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ue(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(n,t[r])==-1&&n.push(t[r])}function ce(e,t){return tt(e,t).length>0}function he(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Y(e),Z(e)}function Se(e){return e.target||e.srcElement}function Pe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var ke=function(){if(B&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ge;function it(e){if(Ge==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ge=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&k<8))}var n=Ge?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Me;function ct(e){if(Me!=null)return Me;var t=s(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Me=r.right-n.right<3}var at=`
|
|
|
|
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 _=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=_.indexOf("\r");j!=-1?(n.push(_.slice(0,j)),t+=j+1):(n.push(_),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},rt=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},xt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Rt(e){if(Et!=null)return Et;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var At={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),At[e]=t}function Kt(e,t){pt[e]=t}function Ft(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=_e(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ft("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ft("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ft(t);var n=At[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var _ in i){if(!i.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=i[_]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};I(t,n)}function mr(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 vn(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 Jr(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=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};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var _=this.string.slice(this.pos).match(e);return _&&_.index>0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function st(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],_=i.chunkSize();if(t<_){n=i;break}t-=_}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(_){var j=_.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],_=i.height;if(t<_){e=i;continue e}t-=_,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var G=e.lines[j],V=G.height;if(t<V)break;t-=V}return n+j}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function en(e){return Fe(e.line,e.ch)}function tn(e,t){return ft(e,t)<0?t:e}function bn(e,t){return ft(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,st(e,n).text.length):Ci(t,st(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function _i(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.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}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,mr(e.mode,t.state),n,t.lookAhead):new sr(e,mr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?mr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Ai(e,t,n,r){var i=[e.state.modeGen],_={};Qn(e,t.text,e.doc.mode,n,function($,oe){return i.push($,oe)},_,r);for(var j=n.state,G=function($){n.baseTokens=i;var oe=e.state.overlays[$],de=1,we=0;n.state=!0,Qn(e,t.text,oe.mode,n,function(xe,Ie){for(var Ne=de;we<xe;){var Ke=i[de];Ke>xe&&i.splice(de,1,xe,i[de+1],Ke),de+=2,we=Math.min(xe,Ke)}if(!Ie)return;if(oe.opaque)i.splice(Ne,de-Ne,xe,"overlay "+Ie),de=Ne+2;else for(;Ne<de;Ne+=2){var Ye=i[Ne+1];i[Ne+1]=(Ye?Ye+" ":"")+"overlay "+Ie}},_),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)G(V);return{styles:i,classes:_.bgClass||_.textClass?_:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=He(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&mr(e.doc.mode,r.state),_=Ai(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=_.styles,_.classes?t.styleClasses=_.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 He(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var _=Dr(e,t,n),j=_>r.first&&st(r,_-1).stateAfter,G=j?sr.fromSaved(r,j,_):new sr(r,Jr(r.mode),_);return r.iter(_,t,function(V){$n(e,V.text,G);var $=G.line;V.stateAfter=$==t-1||$%5==0||$>=i.viewFrom&&$<i.viewTo?G.save():null,G.nextLine()}),n&&(r.modeFrontier=G.line),G}function $n(e,t,n,r){var i=e.doc.mode,_=new Mt(t,e.options.tabSize,n);for(_.start=_.pos=r||0,t==""&&Li(i,n.state);!_.eol();)En(i,_,n.state),_.start=_.pos}function Li(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var _=e.token(t,n);if(t.pos>t.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ur(e,t,n,r){var i=e.doc,_=i.mode,j;t=mt(i,t);var G=st(i,t.line),V=He(e,t.line,n),$=new Mt(G.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||$.pos<t.ch)&&!$.eol();)$.start=$.pos,j=En(_,$,V.state),r&&oe.push(new nn($,j,mr(i.mode,V.state)));return r?oe:new nn($,j,V.state)}function Di(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Qn(e,t,n,r,i,_,j){var G=n.flattenSpans;G==null&&(G=e.options.flattenSpans);var V=0,$=null,oe=new Mt(t,e.options.tabSize,r),de,we=e.options.addModeClass&&[null];for(t==""&&Di(Li(n,r.state),_);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(G=!1,j&&$n(e,t,r,oe.pos),oe.pos=t.length,de=null):de=Di(En(n,oe,r.state,we),_),we){var xe=we[0].name;xe&&(de="m-"+(de?xe+" "+de:xe))}if(!G||$!=de){for(;V<oe.start;)V=Math.min(oe.start,V+5e3),i(V,$);$=de}oe.start=oe.pos}for(;V<oe.pos;){var Ie=Math.min(oe.pos,V+5e3);i(Ie,$),V=Ie}}function Dr(e,t,n){for(var r,i,_=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>j;--G){if(G<=_.first)return _.first;var V=st(_,G-1),$=V.stateAfter;if($&&(!n||G+($ instanceof rn?$.lookAhead:0)<=_.modeFrontier))return G;var oe=H(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=G-1,r=oe)}return i}function Oi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=st(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ri=!1,pr=!1;function Cr(){Ri=!0}function Pi(){pr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Nr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],j=_.marker,G=_.from==null||(j.inclusiveLeft?_.from<=t:_.from<t);if(G||_.from==t&&j.type=="bookmark"&&(!n||!_.marker.insertLeft)){var V=_.to==null||(j.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new xn(j,_.from,V?null:_.to))}}return r}function Mi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],j=_.marker,G=_.to==null||(j.inclusiveRight?_.to>=t:_.to>t);if(G||_.from==t&&j.type=="bookmark"&&(!n||_.marker.insertLeft)){var V=_.from==null||(j.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new xn(j,V?null:_.from-t,_.to==null?null:_.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&st(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&st(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,_=t.to.ch,j=ft(t.from,t.to)==0,G=aa(n,i,j),V=Mi(r,_,j),$=t.text.length==1,oe=Q(t.text).length+($?i:0);if(G)for(var de=0;de<G.length;++de){var we=G[de];if(we.to==null){var xe=Nr(V,we.marker);xe?$&&(we.to=xe.to==null?null:xe.to+oe):we.to=i}}if(V)for(var Ie=0;Ie<V.length;++Ie){var Ne=V[Ie];if(Ne.to!=null&&(Ne.to+=oe),Ne.from==null){var Ke=Nr(G,Ne.marker);Ke||(Ne.from=oe,$&&(G||(G=[])).push(Ne))}else Ne.from+=oe,$&&(G||(G=[])).push(Ne)}G&&(G=Tn(G)),V&&V!=G&&(V=Tn(V));var Ye=[G];if(!$){var et=t.text.length-2,$e;if(et>0&&G)for(var nt=0;nt<G.length;++nt)G[nt].to==null&&($e||($e=[])).push(new xn(G[nt].marker,null,null));for(var dt=0;dt<et;++dt)Ye.push($e);Ye.push(V)}return Ye}function Tn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(xe){if(xe.markedSpans)for(var Ie=0;Ie<xe.markedSpans.length;++Ie){var Ne=xe.markedSpans[Ie].marker;Ne.readOnly&&(!r||ee(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var i=[{from:t,to:n}],_=0;_<r.length;++_)for(var j=r[_],G=j.find(0),V=0;V<i.length;++V){var $=i[V];if(ft($.to,G.from)<0||ft($.from,G.to)>0)continue;var oe=[V,1],de=ft($.from,G.from),we=ft($.to,G.to);(de<0||!j.inclusiveLeft&&!de)&&oe.push({from:$.from,to:G.from}),(we>0||!j.inclusiveRight&&!we)&&oe.push({from:G.to,to:$.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Jn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),_=ft(r.from,i.from)||an(e)-an(t);if(_)return-_;var j=ft(r.to,i.to)||Sn(e)-Sn(t);return j||t.id-e.id}function sa(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=void 0,_=0;_<n.length;++_)i=n[_],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Cn(e){return sa(e,!0)}function on(e){return sa(e,!1)}function ki(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var _=n[i];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||wn(r,_.marker)<0)&&(r=_.marker)}return r}function qn(e,t,n,r,i){var _=st(e,t),j=pr&&_.markedSpans;if(j)for(var G=0;G<j.length;++G){var V=j[G];if(!V.marker.collapsed)continue;var $=V.marker.find(0),oe=ft($.from,n)||an(V.marker)-an(i),de=ft($.to,r)||Sn(V.marker)-Sn(i);if(oe>=0&&de<=0||oe<=0&&de>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft($.to,n)>=0:ft($.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft($.from,r)<=0:ft($.from,r)<0))return!0}}function $t(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function _n(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=st(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=st(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=pr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&An(e,t,r))return!0}}function An(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return An(e,r.line,Nr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,_=0;_<t.markedSpans.length;++_)if(i=t.markedSpans[_],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&An(e,t,i))return!0}function lr(e){e=$t(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var _=n.parent;_;n=_,_=n.parent)for(var j=0;j<_.children.length;++j){var G=_.children[j];if(G==n)break;t+=G.height}return t}function Ln(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Cn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var _=n.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.to.ch}return t}function Rr(e){var t=e.display,n=e.doc;t.maxLine=st(n,n.first),t.maxLineLength=Ln(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Ln(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},he(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ui(e,t){var n=x("span",null,null,R?"padding-right: .1px":null),r={pre:x("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 _=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ht,ct(e.display.measure)&&(j=Xe(_,e.doc.direction))&&(r.addToken=vt(r.addToken,j)),r.map=[];var G=t!=e.display.externalMeasured&&St(_);Dt(_,r,Yn(e,_,G)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=F(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=F(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(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(R){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=F(r.pre.className,r.textClass||"")),r}function ot(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ht(e,t,n,r,i,_,j){if(!t)return;var G=e.splitSpaces?ut(t,e.trailingSpace):t,V=e.cm.state.specialChars,$=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(G),e.map.push(e.pos,e.pos+t.length,oe),B&&k<9&&($=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var de=0;;){V.lastIndex=de;var we=V.exec(t),xe=we?we.index-de:t.length-de;if(xe){var Ie=document.createTextNode(G.slice(de,de+xe));B&&k<9?oe.appendChild(a("span",[Ie])):oe.appendChild(Ie),e.map.push(e.pos,e.pos+xe,Ie),e.col+=xe,e.pos+=xe}if(!we)break;de+=xe+1;var Ne=void 0;if(we[0]==" "){var Ke=e.cm.options.tabSize,Ye=Ke-e.col%Ke;Ne=oe.appendChild(a("span",me(Ye),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Ye}else we[0]=="\r"||we[0]==`
|
|
`?(Ne=oe.appendChild(a("span",we[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",we[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(we[0]),Ne.setAttribute("cm-text",we[0]),B&&k<9?oe.appendChild(a("span",[Ne])):oe.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,n||r||i||$||_||j){var et=n||"";r&&(et+=r),i&&(et+=i);var $e=a("span",[oe],et,_);if(j)for(var nt in j)j.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&$e.setAttribute(nt,j[nt]);return e.content.appendChild($e)}e.content.appendChild(oe)}function ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var _=e.charAt(i);_==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(_="\xA0"),r+=_,n=_==" "}return r}function vt(e,t){return function(n,r,i,_,j,G,V){i=i?i+" cm-force-border":"cm-force-border";for(var $=n.pos,oe=$+r.length;;){for(var de=void 0,we=0;we<t.length&&!(de=t[we],de.to>$&&de.from<=$);we++);if(de.to>=oe)return e(n,r,i,_,j,G,V);e(n,r.slice(0,de.to-$),i,_,null,G,V),_=null,r=r.slice(de.to-$),$=de.to}}}function Tt(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 Dt(e,t,n){var r=e.markedSpans,i=e.text,_=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(_,_=n[j]),da(n[j+1],t.cm.options));return}for(var G=i.length,V=0,$=1,oe="",de,we,xe=0,Ie,Ne,Ke,Ye,et;;){if(xe==V){Ie=Ne=Ke=we="",et=null,Ye=null,xe=Infinity;for(var $e=[],nt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],gt=lt.marker;if(gt.type=="bookmark"&<.from==V&>.widgetNode)$e.push(gt);else if(lt.from<=V&&(lt.to==null||lt.to>V||gt.collapsed&<.to==V&<.from==V)){if(lt.to!=null&<.to!=V&&xe>lt.to&&(xe=lt.to,Ne=""),gt.className&&(Ie+=" "+gt.className),gt.css&&(we=(we?we+";":"")+gt.css),gt.startStyle&<.from==V&&(Ke+=" "+gt.startStyle),gt.endStyle&<.to==xe&&(nt||(nt=[])).push(gt.endStyle,lt.to),gt.title&&((et||(et={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(et||(et={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!Ye||wn(Ye.marker,gt)<0)&&(Ye=lt)}else lt.from>V&&xe>lt.from&&(xe=lt.from)}if(nt)for(var Vt=0;Vt<nt.length;Vt+=2)nt[Vt+1]==xe&&(Ne+=" "+nt[Vt]);if(!Ye||Ye.from==V)for(var kt=0;kt<$e.length;++kt)Tt(t,0,$e[kt]);if(Ye&&(Ye.from||0)==V){if(Tt(t,(Ye.to==null?G+1:Ye.to)-V,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==V&&(Ye=!1)}}if(V>=G)break;for(var dr=Math.min(G,xe);;){if(oe){var nr=V+oe.length;if(!Ye){var Bt=nr>dr?oe.slice(0,dr-V):oe;t.addToken(t,Bt,de?de+Ie:Ie,Ke,V+Bt.length==xe?Ne:"",we,et)}if(nr>=dr){oe=oe.slice(dr-V),V=dr;break}V=nr,Ke=""}oe=i.slice(_,_=n[$++]),de=da(n[$++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=_n(t),this.size=this.rest?St(Q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,_=t;_<n;_=i){var j=new yt(e.doc,st(e.doc,_),_);i=_+j.size,r.push(j)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Pr(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ct(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Wt=null,t(n)}}var Zt=null;function Lt(e,t){var n=tt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(gr,0));for(var _=function(G){i.push(function(){return n[G].apply(null,r)})},j=0;j<n.length;++j)_(j)}function gr(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var _=t.changes[i];_=="text"?ks(e,t):_=="gutter"?qa(e,t,n,r):_=="class"?ca(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function ei(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ei(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ui(e,t)}function ks(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?ei(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ei(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var _=t.line.gutterMarkers;if(e.options.lineNumbers||_){var j=ei(t),G=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),j.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(a("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var V=0;V<e.display.gutterSpecs.length;++V){var $=e.display.gutterSpecs[V].className,oe=_.hasOwnProperty($)&&_[$];oe&&G.appendChild(a("div",[oe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[$]+"px; width: "+r.gutterWidth[$]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=T("CodeMirror-linewidget"),i=t.node.firstChild,_=void 0;i;i=_)_=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Us(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var _=ei(n),j=0,G=t.widgets;j<G.length;++j){var V=G[j],$=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||$.setAttribute("cm-ignore-events","true"),Ns(V,$,n,r),e.display.input.setUneditable($),i&&V.above?_.insertBefore($,n.gutter||n.text):_.appendChild($),Lt(V,"redraw")}}function Ns(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!m(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var n=Se(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ni(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function _r(e){return ae-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-_r(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-_r(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var _=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),G=0;G<j.length-1;G++){var V=j[G],$=j[G+1];Math.abs(V.bottom-$.bottom)>2&&_.push((V.bottom+$.top)/2-n.top)}}_.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Ui(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Ar(e,Dn(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Dn(e,t){var n=St(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ar(e,t,n,r,i){t.before&&(n=-1);var _=n+(r||""),j;return t.cache.hasOwnProperty(_)?j=t.cache[_]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[_]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,_,j,G,V,$=0;$<e.length;$+=3)if(G=e[$],V=e[$+1],t<G?(i=0,_=1,j="left"):t<V?(i=t-G,_=i+1):($==e.length-3||t==V&&e[$+3]>t)&&(_=V-G,i=_-1,t>=V&&(j="right")),i!=null){if(r=e[$+2],G==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;$&&e[$-2]==e[$-3]&&e[$-1].insertLeft;)r=e[($-=3)+2],j="left";if(n=="right"&&i==V-G)for(;$<e.length-3&&e[$+3]==e[$+4]&&!e[$+5].insertLeft;)r=e[($+=3)+2],j="right";break}return{node:r,start:i,end:_,collapse:j,coverStart:G,coverEnd:V}}function js(e,t){var n=ao;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),_=i.node,j=i.start,G=i.end,V=i.collapse,$;if(_.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Ce(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+G<i.coverEnd&&Ce(t.line.text.charAt(i.coverStart+G));)++G;if(B&&k<9&&j==0&&G==i.coverEnd-i.coverStart?$=_.parentNode.getBoundingClientRect():$=js(y(_,j,G).getClientRects(),r),$.left||$.right||j==0)break;G=j,j=j-1,V="right"}B&&k<11&&($=Hs(e.display.measure,$))}else{j>0&&(V=r="right");var de;e.options.lineWrapping&&(de=_.getClientRects()).length>1?$=de[r=="right"?de.length-1:0]:$=_.getBoundingClientRect()}if(B&&k<9&&!j&&(!$||!$.left&&!$.right)){var we=_.parentNode.getClientRects()[0];we?$={left:we.left,right:we.left+Rn(e.display),top:we.top,bottom:we.bottom}:$=ao}for(var xe=$.top-t.rect.top,Ie=$.bottom-t.rect.top,Ne=(xe+Ie)/2,Ke=t.view.measure.heights,Ye=0;Ye<Ke.length-1&&!(Ne<Ke[Ye]);Ye++);var et=Ye?Ke[Ye-1]:0,$e=Ke[Ye],nt={left:(V=="right"?$.right:$.left)-t.rect.left,right:(V=="left"?$.left:$.right)-t.rect.left,top:et,bottom:$e};return!$.left&&!$.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=xe,nt.rbottom=Ie),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return h&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return h&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ti(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var _=pa(t);n.top+=_,n.bottom+=_}if(r=="line")return n;r||(r="local");var j=lr(t);if(r=="local"?j+=Ni(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var G=e.display.lineSpace.getBoundingClientRect();j+=G.top+(r=="window"?0:co());var V=G.left+(r=="window"?0:uo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var _=e.display.sizer.getBoundingClientRect();r+=_.left,i+=_.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=st(e.doc,t.line)),Fi(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,_){r=r||st(e.doc,t.line),i||(i=Dn(e,r));function j(Ie,Ne){var Ke=Ar(e,i,Ie,Ne?"right":"left",_);return Ne?Ke.left=Ke.right:Ke.right=Ke.left,Fi(e,r,Ke,n)}var G=Xe(r,e.doc.direction),V=t.ch,$=t.sticky;if(V>=r.text.length?(V=r.text.length,$="before"):V<=0&&(V=0,$="after"),!G)return j($=="before"?V-1:V,$=="before");function oe(Ie,Ne,Ke){var Ye=G[Ne],et=Ye.level==1;return j(Ke?Ie-1:Ie,et!=Ke)}var de=je(G,V,$),we=Be,xe=oe(V,de,$=="before");return we!=null&&(xe.other=oe(V,we,$!="before")),xe}function ho(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=Rn(e.display)*t.ch);var r=st(e.doc,t.line),i=lr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var _=Fe(e,t,n);return _.xRel=i,r&&(_.outside=r),_}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),_=r.first+r.size-1;if(i>_)return va(r.first+r.size-1,st(r,_).text.length,null,1,1);t<0&&(t=0);for(var j=st(r,i);;){var G=Ks(e,j,i,t,n),V=ki(j,G.ch+(G.xRel>0||G.outside>0?1:0));if(!V)return G;var $=V.find(1);if($.line==i)return $;j=st(r,i=$.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,_=ze(function(j){return Ar(e,n,j-1).bottom<=r},i,0);return i=ze(function(j){return Ar(e,n,j).top>r},_,i),{begin:_,end:i}}function po(e,t,n,r){n||(n=Dn(e,t));var i=Fi(e,t,Ar(e,n,r),"line").top;return mo(e,t,n,i)}function ba(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-=lr(t);var _=Dn(e,t),j=pa(t),G=0,V=t.text.length,$=!0,oe=Xe(t,e.doc.direction);if(oe){var de=(e.options.lineWrapping?Gs:zs)(e,t,n,_,oe,r,i);$=de.level!=1,G=$?de.from:de.to-1,V=$?de.to:de.from-1}var we=null,xe=null,Ie=ze(function(dt){var lt=Ar(e,_,dt);return lt.top+=j,lt.bottom+=j,ba(lt,r,i,!1)?(lt.top<=i&<.left<=r&&(we=dt,xe=lt),!0):!1},G,V),Ne,Ke,Ye=!1;if(xe){var et=r-xe.left<xe.right-r,$e=et==$;Ie=we+($e?0:1),Ke=$e?"after":"before",Ne=et?xe.left:xe.right}else{!$&&(Ie==V||Ie==G)&&Ie++,Ke=Ie==0?"after":Ie==t.text.length?"before":Ar(e,_,Ie-($?1:0)).bottom+j<=i==$?"after":"before";var nt=br(e,Fe(n,Ie,Ke),"line",t,_);Ne=nt.left,Ye=i<nt.top?-1:i>=nt.bottom?1:0}return Ie=Le(t.text,Ie,1),va(n,Ie,Ke,Ye,r-Ne)}function zs(e,t,n,r,i,_,j){var G=ze(function(de){var we=i[de],xe=we.level!=1;return ba(br(e,Fe(n,xe?we.to:we.from,xe?"before":"after"),"line",t,r),_,j,!0)},0,i.length-1),V=i[G];if(G>0){var $=V.level!=1,oe=br(e,Fe(n,$?V.from:V.to,$?"after":"before"),"line",t,r);ba(oe,_,j,!0)&&oe.top>j&&(V=i[G-1])}return V}function Gs(e,t,n,r,i,_,j){var G=mo(e,t,r,j),V=G.begin,$=G.end;/\s/.test(t.text.charAt($-1))&&$--;for(var oe=null,de=null,we=0;we<i.length;we++){var xe=i[we];if(xe.from>=$||xe.to<=V)continue;var Ie=xe.level!=1,Ne=Ar(e,r,Ie?Math.min($,xe.to)-1:Math.max(V,xe.from)).right,Ke=Ne<_?_-Ne+1e9:Ne-_;(!oe||de>Ke)&&(oe=xe,de=Ke)}return oe||(oe=i[i.length-1]),oe.from<V&&(oe={from:V,to:oe.to,level:oe.level}),oe.to>$&&(oe={from:oe.from,to:$,level:oe.level}),oe}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(a("br"));ln.appendChild(document.createTextNode("x"))}s(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Rn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,_=t.gutters.firstChild,j=0;_;_=_.nextSibling,++j){var G=e.display.gutterSpecs[j].className;n[G]=_.offsetLeft+_.clientLeft+i,r[G]=_.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Rn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var _=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(_+=i.widgets[j].height);return n?_+(Math.ceil(i.text.length/r)||1)*t:_+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&Se(t).getAttribute("cm-not-content")=="true")return null;var _,j,G=i.lineSpace.getBoundingClientRect();try{_=t.clientX-G.left,j=t.clientY-G.top}catch(de){return null}var V=ya(e,_,j),$;if(r&&V.xRel>0&&($=st(e.doc,V.line).text).length==V.ch){var oe=H($,$.length,e.options.tabSize)-$.length;V=Fe(V.line,Math.max(0,Math.round((_-ro(e.display).left)/Rn(e.display))-oe))}return V}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)pr&&Wr(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)pr&&Ii(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var _=Bi(e,n,n+r,1);_?(i.view=i.view.slice(_.index),i.viewFrom=_.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):zr(e)}else{var G=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);G&&V?(i.view=i.view.slice(0,G.index).concat(It(e,G.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):zr(e)}var $=i.externalMeasured;$&&(n<$.lineN?$.lineN+=r:t<$.lineN+$.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var _=r.view[dn(e,t)];if(_.node==null)return;var j=_.changes||(_.changes=[]);ee(j,n)==-1&&j.push(n)}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),_,j=e.display.view;if(!pr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var G=e.display.viewFrom,V=0;V<i;V++)G+=j[V].size;if(G!=t){if(r>0){if(i==j.length-1)return null;_=G+j[i].size-t,i++}else _=G-t;t+=_,n+=_}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[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=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),_=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var G=n.sel.ranges[j];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var V=G.empty();(V||e.options.showCursorWhenSelecting)&&bo(e,G.head,i),V||Xs(e,G,_)}return r}function bo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var _=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=r.other.left+"px",_.style.top=r.other.top+"px",_.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,_=document.createDocumentFragment(),j=ro(e.display),G=j.left,V=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-j.right,$=i.direction=="ltr";function oe($e,nt,dt,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),_.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+nt+"px; width: "+(dt==null?V-$e:dt)+`px;
|
|
height: `+(lt-nt)+"px"))}function de($e,nt,dt){var lt=st(i,$e),gt=lt.text.length,Ot,Vt;function kt(Bt,ir){return ga(e,Fe($e,Bt),"div",lt,ir)}function dr(Bt,ir,Yt){var Ht=po(e,lt,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Ut=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(lt.text.charAt(Ht.end-1))?2:1);return kt(Ut,jt)[jt]}var nr=Xe(lt,i.direction);return Ve(nr,nt||0,dt==null?gt:dt,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Ut=kt(Bt,jt?"left":"right"),ar=kt(ir-1,jt?"right":"left"),zn=nt==null&&Bt==0,Qr=dt==null&&ir==gt,Jt=Ht==0,Lr=!nr||Ht==nr.length-1;if(ar.top-Ut.top<=3){var Xt=($?zn:Qr)&&Jt,Xa=($?Qr:zn)&&Lr,Ir=Xt?G:(jt?Ut:ar).left,pn=Xa?V:(jt?ar:Ut).right;oe(Ir,Ut.top,pn-Ir,Ut.bottom)}else{var gn,er,Gn,Ya;jt?(gn=$&&zn&&Jt?G:Ut.left,er=$?V:dr(Bt,Yt,"before"),Gn=$?G:dr(ir,Yt,"after"),Ya=$&&Qr&&Lr?V:ar.right):(gn=$?dr(Bt,Yt,"before"):G,er=!$&&zn&&Jt?V:Ut.right,Gn=!$&&Qr&&Lr?G:ar.left,Ya=$?dr(ir,Yt,"after"):V),oe(gn,Ut.top,er-gn,Ut.bottom),Ut.bottom<ar.top&&oe(G,Ut.bottom,null,ar.top),oe(Gn,ar.top,Ya-Gn,ar.bottom)}(!Ot||ji(Ut,Ot)<0)&&(Ot=Ut),ji(ar,Ot)<0&&(Ot=ar),(!Vt||ji(Ut,Vt)<0)&&(Vt=Ut),ji(ar,Vt)<0&&(Vt=ar)}),{start:Ot,end:Vt}}var we=t.from(),xe=t.to();if(we.line==xe.line)de(we.line,we.ch,xe.ch);else{var Ie=st(i,we.line),Ne=st(i,xe.line),Ke=$t(Ie)==$t(Ne),Ye=de(we.line,we.ch,Ke?Ie.text.length+1:null).end,et=de(xe.line,Ke?0:null,xe.ch).start;Ke&&(Ye.top<et.top-2?(oe(Ye.right,Ye.top,null,Ye.bottom),oe(G,et.top,et.left,et.bottom)):oe(Ye.right,Ye.top,et.left-Ye.right,Ye.bottom)),Ye.bottom<et.top&&oe(G,Ye.bottom,null,et.top)}n.appendChild(_)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],_=e.options.lineWrapping,j=void 0,G=0;if(i.hidden)continue;if(B&&k<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var $=i.node.getBoundingClientRect();j=$.bottom-$.top,!_&&i.text.firstChild&&(G=i.text.firstChild.getBoundingClientRect().right-$.left-1)}var oe=i.line.height-j;if((oe>.005||oe<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var de=0;de<i.rest.length;de++)To(i.rest[de]);if(G>e.display.sizerWidth){var we=Math.ceil(G/Rn(e.display));we>e.display.maxLineLength&&(e.display.maxLineLength=we,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ni(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,_=wr(t,r),j=wr(t,i);if(n&&n.ensure){var G=n.ensure.from.line,V=n.ensure.to.line;G<_?(_=G,j=wr(t,lr(st(t,G))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(_=wr(t,lr(st(t,V))-e.wrapper.clientHeight),j=V)}return{from:_,to:Math.max(j,_+1)}}function Ys(e,t){if(Ue(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&&!g){var _=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
|
|
height: `+(t.bottom-t.top+_r(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(i),e.display.lineSpace.removeChild(_)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var j=!1,G=br(e,t),V=!n||n==t?G:br(e,n);i={left:Math.min(G.left,V.left),top:Math.min(G.top,V.top)-r,right:Math.max(G.left,V.left),bottom:Math.max(G.bottom,V.bottom)+r};var $=Ca(e,i),oe=e.doc.scrollTop,de=e.doc.scrollLeft;if($.scrollTop!=null&&(ai(e,$.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),$.scrollLeft!=null&&(cn(e,$.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,_=ha(e),j={};t.bottom-t.top>_&&(t.bottom=t.top+_);var G=e.doc.height+fa(n),V=t.top<r,$=t.bottom>G-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+_){var oe=Math.min(t.top,($?G:t.bottom)-_);oe!=i&&(j.scrollTop=oe)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,we=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,xe=sn(e)-n.gutters.offsetWidth,Ie=t.right-t.left>xe;return Ie&&(t.right=t.left+xe),t.left<10?j.scrollLeft=0:t.left<we?j.scrollLeft=Math.max(0,t.left+de-(Ie?0:10)):t.right>xe+we-3&&(j.scrollLeft=t.right+(Ie?0:10)-xe),j}function _a(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Mn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(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});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),wo(e,t,!0),L&&La(e),li(e,100)}function wo(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 cn(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,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(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+_r(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=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),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.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 _=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"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}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=l&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),_=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function kn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(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 _o={native:fn,null:si};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new _o[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(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"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(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:++Zs},bt(e.curOp)}function mn(e){var t=e.curOp;t&&Ct(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var _=0;_<t.length;_++)nl(t[_]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Rr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new zi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+_r(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(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<t.doc.scrollLeft&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&kn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var _=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(_)for(var G=0;G<_.length;++G)_[G].lines.length||Oe(_[G],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&Oe(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{mn(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{mn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{mn(this)}}}function Gt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{mn(t)}}}function li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=He(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var j=_.styles,G=_.text.length>e.options.maxHighlightLength?mr(t.mode,r.state):null,V=Ai(e,_,r,!0);G&&(r.state=G),_.styles=V.styles;var $=_.styleClasses,oe=V.classes;oe?_.styleClasses=oe:$&&(_.styleClasses=null);for(var de=!j||j.length!=_.styles.length||$!=oe&&(!$||!oe||$.bgClass!=oe.bgClass||$.textClass!=oe.textClass),we=0;!de&&we<j.length;++we)de=j[we]!=_.styles[we];de&&i.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&$n(e,_.text,r),_.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var _=0;_<i.length;_++)Kr(e,i[_],"text")})}var zi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=Ea(e),this.events=[]};zi.prototype.signal=function(e,t){ce(e,t)&&this.events.push(arguments)},zi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=_r(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=_r(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!m(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&m(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&m(document.body,e.anchorNode)&&m(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&vo(e)==0)return!1;Oo(e)&&(zr(e),t.dims=Ea(e));var i=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<_&&_-n.viewFrom<20&&(_=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),pr&&(_=Wr(e.doc,_),j=Ii(e.doc,j));var G=_!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,_,j),n.viewOffset=lr(st(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!G&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var $=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll($),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,G&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Lo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!Aa(e,t))break;Wi(e);var i=oi(e);ni(e),kn(e,i),Oa(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 La(e,t){var n=new zi(e,t);if(Aa(e,n)){Wi(e),Lo(e,n);var r=oi(e);ni(e),kn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,_=r.lineDiv,j=_.firstChild;function G(Ie){var Ne=Ie.nextSibling;return R&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Ne}for(var V=r.view,$=r.viewFrom,oe=0;oe<V.length;oe++){var de=V[oe];if(!de.hidden)if(!de.node||de.node.parentNode!=_){var we=Us(e,de,$,n);_.insertBefore(we,j)}else{for(;j!=de.node;)j=G(j);var xe=i&&t!=null&&t<=$&&de.lineNumber;de.changes&&(ee(de.changes,"gutter")>-1&&(xe=!1),Ja(e,de,$,n)),xe&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(yn(e.options,$)))),j=de.node.nextSibling}$+=de.size}for(;j;)j=G(j)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+_r(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,_=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=_),n[j].gutterBackground&&(n[j].gutterBackground.style.left=_));var G=n[j].alignable;if(G)for(var V=0;V<G.length;V++)G[V].style.left=_}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=i.firstChild.offsetWidth,j=i.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var _=e[i],j=null;if(typeof _!="string"&&(j=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:_,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],_=i.className,j=i.style,G=t.appendChild(a("div",null,"CodeMirror-gutter "+_));j&&(G.style.cssText=j),_=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ui(e){Ro(e.display),tr(e),Do(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=x("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=x("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var _=x("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[_],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ae+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var Gi=0,fr=null;B?fr=-.53:L?fr=15:h?fr=-.7:P&&(fr=-1/3);function Po(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Po(e);return t.x*=fr,t.y*=fr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,_=e.display,j=_.scroller,G=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&G||i&&V))return;if(i&&l&&R){e:for(var $=t.target,oe=_.view;$!=j;$=$.parentNode)for(var de=0;de<oe.length;de++)if(oe[de].node==$){e.display.currentWheelTarget=$;break e}}if(r&&!L&&!b&&fr!=null){i&&V&&ai(e,Math.max(0,j.scrollTop+i*fr)),cn(e,Math.max(0,j.scrollLeft+r*fr)),(!i||i&&V)&&Y(t),_.wheelStartX=null;return}if(i&&fr!=null){var we=i*fr,xe=e.doc.scrollTop,Ie=xe+_.wrapper.clientHeight;we<0?xe=Math.max(0,xe+we-50):Ie=Math.min(e.doc.height,Ie+we+50),La(e,{top:xe,bottom:Ie})}Gi<20&&(_.wheelStartX==null?(_.wheelStartX=j.scrollLeft,_.wheelStartY=j.scrollTop,_.wheelDX=r,_.wheelDY=i,setTimeout(function(){if(_.wheelStartX==null)return;var Ne=j.scrollLeft-_.wheelStartX,Ke=j.scrollTop-_.wheelStartY,Ye=Ke&&_.wheelDY&&Ke/_.wheelDY||Ne&&_.wheelDX&&Ne/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!Ye)return;fr=(fr*Gi+Ye)/(Gi+1),++Gi},200)):(_.wheelDX+=r,_.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(we,xe){return ft(we.from(),xe.from())}),n=ee(t,i);for(var _=1;_<t.length;_++){var j=t[_],G=t[_-1],V=ft(G.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var $=bn(G.from(),j.from()),oe=tn(G.to(),j.to()),de=G.empty()?j.from()==j.head:G.from()==G.head;_<=n&&--n,t.splice(--_,2,new wt(de?oe:$,de?$:oe))}}return new hr(t,n)}function Gr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Fe(e.from.line+e.text.length-1,Q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(ft(e,t.from)<0)return e;if(ft(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),Fe(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(ko(i.anchor,t),ko(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),_=i,j=0;j<t.length;j++){var G=t[j],V=Io(G.from,i,_),$=Io(Vr(G),i,_);if(i=G.to,_=$,n=="around"){var oe=e.sel.ranges[j],de=ft(oe.head,oe.anchor)<0;r[j]=new wt(de?$:V,de?V:$)}else r[j]=new wt(V,V)}return new hr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,li(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&Q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,r){function i(et){return n?n[et]:null}function _(et,$e,nt){la(et,$e,nt,r),Lt(et,"change",et,t)}function j(et,$e){for(var nt=[],dt=et;dt<$e;++dt)nt.push(new Hr($[dt],i(dt),r));return nt}var G=t.from,V=t.to,$=t.text,oe=st(e,G.line),de=st(e,V.line),we=Q($),xe=i($.length-1),Ie=V.line-G.line;if(t.full)e.insert(0,j(0,$.length)),e.remove($.length,e.size-$.length);else if(Uo(e,t)){var Ne=j(0,$.length-1);_(de,de.text,xe),Ie&&e.remove(G.line,Ie),Ne.length&&e.insert(G.line,Ne)}else if(oe==de)if($.length==1)_(oe,oe.text.slice(0,G.ch)+we+oe.text.slice(V.ch),xe);else{var Ke=j(1,$.length-1);Ke.push(new Hr(we+oe.text.slice(V.ch),xe,r)),_(oe,oe.text.slice(0,G.ch)+$[0],i(0)),e.insert(G.line+1,Ke)}else if($.length==1)_(oe,oe.text.slice(0,G.ch)+$[0]+de.text.slice(V.ch),i(0)),e.remove(G.line+1,Ie);else{_(oe,oe.text.slice(0,G.ch)+$[0],i(0)),_(de,we+de.text.slice(V.ch),xe);var Ye=j(1,$.length-1);Ie>1&&e.remove(G.line+1,Ie-1),e.insert(G.line+1,Ye)}Lt(e,"change",e,t)}function Xr(e,t,n){function r(i,_,j){if(i.linked)for(var G=0;G<i.linked.length;++G){var V=i.linked[G];if(V.doc==_)continue;var $=j&&V.sharedHist;if(n&&!$)continue;t(V.doc,$),r(V.doc,i,$)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ma(e),Fo(e),e.options.lineWrapping||Rr(e),e.options.mode=t.modeOption,tr(e)}function Fo(e){(e.doc.direction=="rtl"?U:p)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){Fo(e),tr(e)})}function Vi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=Q(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),Q(e.done);if(e.done.length&&!Q(e.done).ranges)return Q(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Q(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var _=+new Date,j,G;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=ml(i,i.lastOp==r)))G=Q(j.changes),ft(t.from,t.to)==0&&ft(t.from,G.to)==0?G.to=Vr(t):j.changes.push(Ia(e,t));else{var V=Q(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);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=_,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,G||Oe(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,_=r&&r.origin;n==i.lastSelOp||_&&i.lastSelOrigin==_&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==_||pl(e,_,Q(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=_,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=Q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[_]=j.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ho(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var _=n[i],j=r[i];if(_&&j){e:for(var G=0;G<j.length;++G){for(var V=j[G],$=0;$<_.length;++$)if(_[$].marker==V.marker)continue e;_.push(V)}}else j&&(n[i]=j)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var _=e[i];if(_.ranges){r.push(n?hr.prototype.deepCopy.call(_):_);continue}var j=_.changes,G=[];r.push({changes:G});for(var V=0;V<j.length;++V){var $=j[V],oe=void 0;if(G.push({from:$.from,to:$.to,text:$.text}),t)for(var de in $)(oe=de.match(/^spans_(\d+)$/))&&(ee(t,Number(oe[1]))>-1&&(Q(G)[de]=$[de],delete $[de]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var _=ft(t,i)<0;_!=ft(n,i)<0?(i=t,t=n):_!=ft(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),_=0;_<e.sel.ranges.length;_++)r[_]=Ua(e.sel.ranges[_],t[_],null,i);var j=Er(e.cm,r,e.sel.primIndex);Qt(e,j,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,Er(e.cm,i,e.sel.primIndex),r)}function zo(e,t,n,r){Qt(e,Gr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var _=0;_<i.length;_++)this.ranges[_]=new wt(mt(e,i[_].anchor),mt(e,i[_].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,r),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function Go(e,t,n){var r=e.history.done,i=Q(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(ce(e,"beforeSelectionChange")||e.cm&&ce(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Mn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Lt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,_=0;_<t.ranges.length;_++){var j=t.ranges[_],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],V=Qi(e,j.anchor,G&&G.anchor,n,r),$=Qi(e,j.head,G&&G.head,n,r);(i||V!=j.anchor||$!=j.head)&&(i||(i=t.ranges.slice(0,_)),i[_]=new wt(V,$))}return i?Er(e.cm,i,t.primIndex):t}function Un(e,t,n,r,i){var _=st(e,t.line);if(_.markedSpans)for(var j=0;j<_.markedSpans.length;++j){var G=_.markedSpans[j],V=G.marker,$="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,oe="selectRight"in V?!V.selectRight:V.inclusiveRight;if((G.from==null||($?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(oe?G.to>=t.ch:G.to>t.ch))){if(i&&(Oe(V,"beforeCursorEnter"),V.explicitlyCleared))if(_.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var de=V.find(r<0?1:-1),we=void 0;if((r<0?oe:$)&&(de=$o(e,de,-r,de&&de.line==t.line?_:null)),de&&de.line==t.line&&(we=ft(de,n))&&(r<0?we<0:we>0))return Un(e,de,t,r,i)}var xe=V.find(r<0?-1:1);return(r<0?$:oe)&&(xe=$o(e,xe,r,xe.line==t.line?_:null)),xe?Un(e,xe,t,r,i):null}}return t}function Qi(e,t,n,r,i){var _=r||1,j=Un(e,t,n,_,i)||!i&&Un(e,t,n,_,!0)||Un(e,t,n,-_,i)||!i&&Un(e,t,n,-_,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?mt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||st(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Qo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),pe)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,_,j,G){i&&(r.from=mt(e,i)),_&&(r.to=mt(e,_)),j&&(r.text=j),G!==void 0&&(r.origin=G)}),Oe(e,"beforeChange",e,r),e.cm&&Oe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Nn(e,t,n){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Nn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ri&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,_){!_&&ee(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,_,j=e.sel,G=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,$=0;$<G.length&&!(_=G[$],n?_.ranges&&!_.equals(e.sel):!_.ranges);$++);if($==G.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(_=G.pop(),_.ranges){if(Xi(_,V),n&&!_.equals(e.sel)){Qt(e,_,{clearRedo:!1});return}j=_}else if(r){G.push(_);return}else break;var oe=[];Xi(j,V),V.push({changes:oe,generation:i.generation}),i.generation=_.generation||++i.maxGeneration;for(var de=ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"),we=function(Ne){var Ke=_.changes[Ne];if(Ke.origin=t,de&&!Jo(e,Ke,!1))return G.length=0,{};oe.push(Ia(e,Ke));var Ye=Ne?Pa(e,Ke):Q(G);ci(e,Ke,Ye,Ho(e,Ke)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Vr(Ke)});var et=[];Xr(e,function($e,nt){!nt&&ee(et,$e.history)==-1&&(rs($e.history,Ke),et.push($e.history)),ci($e,Ke,null,Ho($e,Ke))})},xe=_.changes.length-1;xe>=0;--xe){var Ie=we(xe);if(Ie)return Ie.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(ie(e.sel.ranges,function(i){return new wt(Fe(i.anchor.line+t,i.anchor.ch),Fe(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;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,ci)(e,t,n,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);qo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[Q(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:Fe(_,st(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):ka(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,_=t.from,j=t.to,G=!1,V=_.line;e.options.lineWrapping||(V=St($t(st(r,_.line))),r.iter(V,j.line+1,function(xe){if(xe==i.maxLine)return G=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),ka(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,_.line+t.text.length,function(xe){var Ie=Ln(xe);Ie>i.maxLineLength&&(i.maxLine=xe,i.maxLineLength=Ie,i.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),Oi(r,_.line),li(e,400);var $=t.text.length-(j.line-_.line)-1;t.full?tr(e):_.line==j.line&&t.text.length==1&&!Uo(e.doc,t)?Kr(e,_.line,"text"):tr(e,_.line,j.line+1,$);var oe=ce(e,"changes"),de=ce(e,"change");if(de||oe){var we={from:_,to:j,text:t.text,removed:t.removed,origin:t.origin};de&&Lt(e,"change",e,we),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function Fn(e,t,n,r,i){var _;r||(r=n),ft(r,n)<0&&(_=[r,n],n=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),Nn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var _=e[i],j=!0;if(_.ranges){_.copied||(_=e[i]=_.deepCopy(),_.copied=!0);for(var G=0;G<_.ranges.length;G++)es(_.ranges[G].anchor,t,n,r),es(_.ranges[G].head,t,n,r);continue}for(var V=0;V<_.changes.length;++V){var $=_.changes[V];if(n<$.from.line)$.from=Fe($.from.line+r,$.from.ch),$.to=Fe($.to.line+r,$.to.ch);else if(t<=$.to.line){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,_=t;return typeof t=="number"?_=st(e,Xn(e,t)):i=St(t),i==null?null:(r(_,i)&&e.cm&&Kr(e.cm,i,n),_)}function hi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),Lt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function mi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}mi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var _=Math.min(t,i-e),j=r.height;if(r.removeInner(e,_),this.height-=j-r.height,i==_&&(this.children.splice(n--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var G=[];this.collapse(G),this.children=[new hi(G)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<=_){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,G=j;G<i.lines.length;){var V=new hi(i.lines.slice(G,G+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=_}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new mi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new mi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<_){var j=Math.min(t,_-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=_}}};var pi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};pi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var _=ti(this);cr(n,Math.max(0,n.height-_)),e&&(ur(e,function(){ns(e,n,-_),Kr(e,r,"widget")}),Lt(e,"lineWidgetCleared",e,this,r))},pi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Lt(n,"lineWidgetChanged",n,e,St(r))})},he(pi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,n)}function xl(e,t,n,r){var i=new pi(e,n,r),_=e.cm;return _&&i.noHScroll&&(_.display.alignWidgets=!0),fi(e,t,"widget",function(j){var G=j.widgets||(j.widgets=[]);if(i.insertAt==null?G.push(i):G.splice(Math.min(G.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,_&&!yr(e,j)){var V=lr(j)<e.scrollTop;cr(j,j.height+ti(i)),V&&_a(_,i.height),_.curOp.forceUpdate=!0}return!0}),_&&Lt(_,"lineWidgetAdded",_,i,typeof t=="number"?t:St(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),ce(this,"clear")){var n=this.find();n&&Lt(this,"clear",n.from,n.to)}for(var r=null,i=null,_=0;_<this.lines.length;++_){var j=this.lines[_],G=Nr(j.markedSpans,this);e&&!this.collapsed?Kr(e,St(j),"text"):e&&(G.to!=null&&(i=St(j)),G.from!=null&&(r=St(j))),j.markedSpans=Fr(j.markedSpans,G),G.from==null&&this.collapsed&&!yr(this.doc,j)&&e&&cr(j,On(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var $=$t(this.lines[V]),oe=Ln($);oe>e.display.maxLineLength&&(e.display.maxLine=$,e.display.maxLineLength=oe,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&&Xo(e.doc)),e&&Lt(e,"markerCleared",e,this,r,i),t&&mn(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;i<this.lines.length;++i){var _=this.lines[i],j=Nr(_.markedSpans,this);if(j.from!=null&&(n=Fe(t?_:St(_),j.from),e==-1))return n;if(j.to!=null&&(r=Fe(t?_:St(_),j.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ur(r,function(){var i=t.line,_=St(t.line),j=ma(r,_);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var G=n.height;n.height=null;var V=ti(n)-G;V&&cr(i,i.height+V)}Lt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},he(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return zt(e.cm,Bn)(e,t,n,r,i);var _=new Yr(e,i),j=ft(t,n);if(r&&I(r,_,!1),j>0||j==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=x("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(qn(e,t.line,t,n,_)||t.line!=n.line&&qn(e,n.line,t,n,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}_.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var G=t.line,V=e.cm,$;if(e.iter(G,n.line+1,function(de){V&&_.collapsed&&!V.options.lineWrapping&&$t(de)==V.display.maxLine&&($=!0),_.collapsed&&G!=t.line&&cr(de,0),Br(de,new xn(_,G==t.line?t.ch:null,G==n.line?n.ch:null)),++G}),_.collapsed&&e.iter(t.line,n.line+1,function(de){yr(e,de)&&cr(de,0)}),_.clearOnEnter&&Ae(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++is,_.atomic=!0),V){if($&&(V.curOp.updateMaxLine=!0),_.collapsed)tr(V,t.line,n.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var oe=t.line;oe<=n.line;oe++)Kr(V,oe,"text");_.atomic&&Xo(V.doc),Lt(V,"markerAdded",V,_)}return _}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Lt(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},he(gi);function Tl(e,t,n,r,i){r=I(r),r.shared=!1;var _=[Bn(e,t,n,r,i)],j=_[0],G=r.widgetNode;return Xr(e,function(V){G&&(r.widgetNode=G.cloneNode(!0)),_.push(Bn(V,mt(V,t),mt(V,n),r,i));for(var $=0;$<V.linked.length;++$)if(V.linked[$].isParent)return;j=Q(_)}),new gi(_,j)}function as(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),_=e.clipPos(i.from),j=e.clipPos(i.to);if(ft(_,j)){var G=Bn(e,_,j,r.primary,r.primary.type);r.markers.push(G),G.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],_=[i.primary.doc];Xr(i.primary.doc,function(V){return _.push(V)});for(var j=0;j<i.markers.length;j++){var G=i.markers[j];ee(_,G.doc)==-1&&(G.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),mi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var _=Fe(n,0);this.sel=Gr(_),this.history=new Vi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:_,to:_,text:e}),Qt(this,Gr(_),pe)};rr.prototype=_e(mi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Gt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Nn(this,{from:t,to:Fe(n,st(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Qt(this,Gr(t),pe)}),replaceRange:function(e,t,n,r){t=mt(this,t),n=n?mt(this,n):t,Fn(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,mt(this,e),mt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zr(this,e))return st(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=st(this,e)),$t(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Gt(function(e,t,n){zo(this,mt(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Gt(function(e,t,n){zo(this,mt(this,e),mt(this,t||e),n)}),extendSelection:Gt(function(e,t,n){Yi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:Gt(function(e,t){Ko(this,_i(this,e),t)}),extendSelectionsBy:Gt(function(e,t){var n=ie(this.sel.ranges,e);Ko(this,_i(this,n),t)}),setSelections:Gt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(mt(this,e[i].anchor),mt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qt(this,Er(this.cm,r,t),n)}),addSelection:Gt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(mt(this,e),mt(this,t||e))),Qt(this,Er(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Sr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Sr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Gt(function(e,t,n){for(var r=[],i=this.sel,_=0;_<i.ranges.length;_++){var j=i.ranges[_];r[_]={from:j.from(),to:j.to(),text:this.splitLines(e[_]),origin:n}}for(var G=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Nn(this,r[V]);G?Go(this,G):this.cm&&Mn(this.cm)}),undo:Gt(function(){Ji(this,"undo")}),redo:Gt(function(){Ji(this,"redo")}),undoSelection:Gt(function(){Ji(this,"undo",!0)}),redoSelection:Gt(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.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:Gt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&De(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Gt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,De(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=st(this,e),!e)return null}else if(t=St(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Gt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Gt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[i];if(_)if(n==null)r[i]=null;else{var j=_.match(T(n));if(!j)return!1;var G=j.index+j[0].length;r[i]=_.slice(0,j.index)+(!j.index||G==_.length?"":" ")+_.slice(G)||null}else return!1;return!0})}),addLineWidget:Gt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(this,mt(this,e),mt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=mt(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=mt(this,e);var t=[],n=st(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=mt(this,e),t=mt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(_){var j=_.markedSpans;if(j)for(var G=0;G<j.length;G++){var V=j[G];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var _=i.text.length+r;if(_>e)return t=e,!0;e-=_,++n}),mt(this,Fe(n,t))},indexFromPos:function(e){e=mt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(Vn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(Vn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Gt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var os=0;function _l(e){var t=this;if(ss(t),Ue(t,e)||Mr(t.display,e))return;Y(e),B&&(os=+new Date);var n=un(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,_=Array(i),j=0,G=function(){++j==i&&zt(t,function(){n=mt(t.doc,n);var xe={from:n,to:n,text:t.doc.splitLines(_.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};Nn(t.doc,xe),Go(t.doc,Gr(mt(t.doc,n),mt(t.doc,Vr(xe))))})()},V=function(xe,Ie){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,xe.type)==-1){G();return}var Ne=new FileReader;Ne.onerror=function(){return G()},Ne.onload=function(){var Ke=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){G();return}_[Ie]=Ke,G()},Ne.readAsText(xe)},$=0;$<r.length;$++)V(r[$],$);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var oe=e.dataTransfer.getData("Text");if(oe){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),$i(t.doc,Gr(n,n)),de)for(var we=0;we<de.length;++we)Fn(t.doc,"",de[we].anchor,de[we].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(xe){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-os<100)){le(t);return}if(Ue(e,t)||Mr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),b&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var _=0;_<n.length;_++)e(n[_])})}var us=!1;function Dl(){if(us)return;Ol(),us=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Ae(window,"blur",function(){return ls(Pn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var kr={};kr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},kr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},kr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},kr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},kr.default=l?kr.macDefault:kr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,_,j=0;j<t.length-1;j++){var G=t[j];if(/^(cmd|meta|m)$/i.test(G))_=!0;else if(/^a(lt)?$/i.test(G))n=!0;else if(/^(c|ctrl|control)$/i.test(G))r=!0;else if(/^s(hift)?$/i.test(G))i=!0;else throw new Error("Unrecognized modifier name: "+G)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ie(n.split(" "),Pl),_=0;_<i.length;_++){var j=void 0,G=void 0;_==i.length-1?(G=i.join(" "),j=r):(G=i.slice(0,_+1).join(" "),j="...");var V=t[G];if(!V)t[G]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+G)}delete e[n]}for(var $ in t)e[$]=t[$];return e}function jn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jn(e,t.fallthrough,n,r);for(var _=0;_<t.fallthrough.length;_++){var j=jn(e,t.fallthrough[_],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?kr[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var _=t(n[i]);r.length&&ft(_.from,Q(r).to)<=0;){var j=r.pop();if(ft(j.from,_.from)<0){_.from=j.from;break}}r.push(_)}ur(e,function(){for(var G=r.length-1;G>=0;G--)Fn(e.doc,"",r[G].from,r[G].to,"+delete");Mn(e)})}function Fa(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var _=Xe(n,t.doc.direction);if(_){var j=i<0?Q(_):_[0],G=i<0==(j.level==1),V=G?"after":"before",$;if(j.level>0||t.doc.direction=="rtl"){var oe=Dn(t,n);$=i<0?n.text.length-1:0;var de=Ar(t,oe,$).top;$=ze(function(we){return Ar(t,oe,we).top==de},i<0==(j.level==1)?j.from:j.to-1,$),V=="before"&&($=Fa(n,$,1))}else $=i<0?j.to:j.from;return new Fe(r,$,V)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Xe(t,e.doc.direction);if(!i)return Ba(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 _=je(i,n.ch,n.sticky),j=i[_];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var G=function(Ye,et){return Fa(t,Ye instanceof Fe?Ye.ch:Ye,et)},V,$=function(Ye){return e.options.lineWrapping?(V=V||Dn(e,t),po(e,t,V,Ye)):{begin:0,end:t.text.length}},oe=$(n.sticky=="before"?G(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var de=j.level==1==r<0,we=G(n,de?1:-1);if(we!=null&&(de?we<=j.to&&we<=oe.end:we>=j.from&&we>=oe.begin)){var xe=de?"before":"after";return new Fe(n.line,we,xe)}}var Ie=function(Ye,et,$e){for(var nt=function(Ot,Vt){return Vt?new Fe(n.line,G(Ot,1),"before"):new Fe(n.line,Ot,"after")};Ye>=0&&Ye<i.length;Ye+=et){var dt=i[Ye],lt=et>0==(dt.level!=1),gt=lt?$e.begin:G($e.end,-1);if(dt.from<=gt&><dt.to)return nt(gt,lt);if(gt=lt?dt.from:G(dt.to,-1),$e.begin<=gt&><$e.end)return nt(gt,lt)}},Ne=Ie(_+r,r,oe);if(Ne)return Ne;var Ke=r>0?oe.end:G(oe.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ne=Ie(r>0?0:i.length-1,r,$(Ke)),Ne)?Ne:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=st(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:mt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},se)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ms(e,t.head):r},se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var _=n[i].from(),j=H(e.getLine(_.line),_.ch,r);t.push(me(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,_=st(e.doc,i.line).text;if(_){if(i.ch==_.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(_.charAt(i.ch-1)+_.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=st(e.doc,i.line-1).text;j&&(i=new Fe(i.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(i.line-1,j.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Mn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=st(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=st(e.doc,t),r=jr(n);return r!=n&&(t=St(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=st(e.doc,n.line),i=Xe(r,e.doc.direction);if(!i||i[0].level==0){var _=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=_&&t.ch;return Fe(n.line,j?0:_,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=be}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Nl=new X;function Ei(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Lt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ei(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Ei(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Ei(e,n,t,function(r){return ea(e,r)}):!1}function Fl(e,t,n){return Ei(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),Ue(t,e))return;B&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);b&&(Wa=r?n:null,!r&&n==88&&!xt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(p(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Mr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(b&&n==Wa){Wa=null,Y(e);return}if(b&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(e){var t=this,n=t.display;if(Ue(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Mr(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Pe(e),_=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,_,e))return;i==1?r?zl(t,r,_,e):Se(e)==n.scroller&&Y(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,Ei(e,cs(_,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=j(e,n)!=be}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var _=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=_?"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=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){B?setTimeout(M(Eo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),_=e.doc.sel,j;e.options.dragDrop&&ke&&!e.isReadOnly()&&n=="single"&&(j=_.contains(t))>-1&&(ft((j=_.ranges[j]).from(),t)<0||t.xRel>0)&&(ft(j.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,_=!1,j=zt(e,function($){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",j),Je(i.wrapper.ownerDocument,"mousemove",G),Je(i.scroller,"dragstart",V),Je(i.scroller,"drop",j),_||(Y($),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!P||B&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),G=function($){_=_||Math.abs(t.clientX-$.clientX)+Math.abs(t.clientY-$.clientY)>=10},V=function(){return _=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",j),Ae(i.wrapper.ownerDocument,"mousemove",G),Ae(i.scroller,"dragstart",V),Ae(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Fe(t.line,0),mt(e.doc,Fe(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,_=e.doc;Y(t);var j,G,V=_.sel,$=V.ranges;if(r.addNew&&!r.extend?(G=_.sel.contains(n),G>-1?j=$[G]:j=new wt(n,n)):(j=_.sel.primary(),G=_.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new wt(n,n)),n=un(e,t,!0,!0),G=-1;else{var oe=xs(e,n,r.unit);r.extend?j=Ua(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?G==-1?(G=$.length,Qt(_,Er(e,$.concat([j]),G),{scroll:!1,origin:"*mouse"})):$.length>1&&$[G].empty()&&r.unit=="char"&&!r.extend?(Qt(_,Er(e,$.slice(0,G).concat($.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),V=_.sel):Na(_,G,j,ue):(G=0,Qt(_,new hr([j],0),ue),V=_.sel);var de=n;function we($e){if(ft(de,$e)==0)return;if(de=$e,r.unit=="rectangle"){for(var nt=[],dt=e.options.tabSize,lt=H(st(_,n.line).text,n.ch,dt),gt=H(st(_,$e.line).text,$e.ch,dt),Ot=Math.min(lt,gt),Vt=Math.max(lt,gt),kt=Math.min(n.line,$e.line),dr=Math.min(e.lastLine(),Math.max(n.line,$e.line));kt<=dr;kt++){var nr=st(_,kt).text,Bt=fe(nr,Ot,dt);Ot==Vt?nt.push(new wt(Fe(kt,Bt),Fe(kt,Bt))):nr.length>Bt&&nt.push(new wt(Fe(kt,Bt),Fe(kt,fe(nr,Vt,dt))))}nt.length||nt.push(new wt(n,n)),Qt(_,Er(e,V.ranges.slice(0,G).concat(nt),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var ir=j,Yt=xs(e,$e,r.unit),Ht=ir.anchor,jt;ft(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ut=V.ranges.slice(0);Ut[G]=Xl(e,new wt(mt(_,Ht),jt)),Qt(_,Er(e,Ut,G),ue)}}var xe=i.wrapper.getBoundingClientRect(),Ie=0;function Ne($e){var nt=++Ie,dt=un(e,$e,!0,r.unit=="rectangle");if(!dt)return;if(ft(dt,de)!=0){e.curOp.focus=D(),we(dt);var lt=Hi(i,_);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(zt(e,function(){Ie==nt&&Ne($e)}),150)}else{var gt=$e.clientY<xe.top?-20:$e.clientY>xe.bottom?20:0;gt&&setTimeout(zt(e,function(){if(Ie!=nt)return;i.scroller.scrollTop+=gt,Ne($e)}),50)}}function Ke($e){e.state.selectingText=!1,Ie=Infinity,$e&&(Y($e),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",Ye),Je(i.wrapper.ownerDocument,"mouseup",et),_.history.lastSelOrigin=null}var Ye=zt(e,function($e){$e.buttons===0||!Pe($e)?Ke($e):Ne($e)}),et=zt(e,Ke);e.state.selectingText=et,Ae(i.wrapper.ownerDocument,"mousemove",Ye),Ae(i.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var n=t.anchor,r=t.head,i=st(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var _=Xe(i);if(!_)return t;var j=je(_,n.ch,n.sticky),G=_[j];if(G.from!=n.ch&&G.to!=n.ch)return t;var V=j+(G.from==n.ch==(G.level!=1)?0:1);if(V==0||V==_.length)return t;var $;if(r.line!=n.line)$=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=je(_,r.ch,r.sticky),de=oe-j||(r.ch-n.ch)*(G.level==1?-1:1);oe==V-1||oe==V?$=de<0:$=de>0}var we=_[V+($?-1:0)],xe=$==(we.level==1),Ie=xe?we.from:we.to,Ne=xe?"after":"before";return n.ch==Ie&&n.sticky==Ne?t:new wt(new Fe(n.line,Ie,Ne),r)}function Ts(e,t,n,r){var i,_;if(t.touches)i=t.touches[0].clientX,_=t.touches[0].clientY;else try{i=t.clientX,_=t.clientY}catch(we){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var j=e.display,G=j.lineDiv.getBoundingClientRect();if(_>G.bottom||!ce(e,n))return re(t);_-=G.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var $=j.gutters.childNodes[V];if($&&$.getBoundingClientRect().right>=i){var oe=wr(e.doc,_),de=e.display.gutterSpecs[V];return Oe(e,n,e,oe,de.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(Mr(e.display,t)||Yl(e,t))return;if(Ue(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,_,j){e.defaults[r]=i,_&&(t[r]=j?function(G,V,$){$!=Hn&&_(G,V,$)}:_)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var _=[],j=r.doc.first;r.doc.iter(function(V){for(var $=0;;){var oe=V.text.indexOf(i,$);if(oe==-1)break;$=oe+i.length,_.push(Fe(j,oe))}j++});for(var G=_.length-1;G>=0;G--)Fn(r.doc,i,_[G],Fe(_[G].line,_[G].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,_){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),_!=Hn&&r.refresh()}),n("specialCharPlaceholder",ot,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",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,_){var j=qi(i),G=_!=Hn&&qi(_);G&&G.detach&&G.detach(r,j),j.attach&&j.attach(r,G||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return kn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),kn(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=Ra(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!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,di,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,_=t?Ae:Je;_(e.display.scroller,"dragstart",i.start),_(e.display.scroller,"dragenter",i.enter),_(e.display.scroller,"dragover",i.over),_(e.display.scroller,"dragleave",i.leave),_(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),Rr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return kn(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?I(t):{},I(Cs,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 Pt.inputStyles[t.inputStyle](this),_=this.display=new dl(e,r,i,t);_.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!o&&_.input.focus(),B&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),hn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var G=0;G<za.length;++G)za[G](this);mn(this),R&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}Pt.defaults=Cs,Pt.optionHandlers=ta;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",zt(e,Es)),B&&k<11?Ae(t.scroller,"dblclick",zt(e,function(V){if(Ue(e,V))return;var $=un(e,V);if(!$||Ka(e,V)||Mr(e.display,V))return;Y(V);var oe=e.findWordAt($);Yi(e.doc,oe.anchor,oe.head)})):Ae(t.scroller,"dblclick",function(V){return Ue(e,V)||Y(V)}),Ae(t.scroller,"contextmenu",function(V){return Ss(e,V)}),Ae(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ss(e,V)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function _(V){if(V.touches.length!=1)return!1;var $=V.touches[0];return $.radiusX<=1&&$.radiusY<=1}function j(V,$){if($.left==null)return!0;var oe=$.left-V.left,de=$.top-V.top;return oe*oe+de*de>20*20}Ae(t.scroller,"touchstart",function(V){if(!Ue(e,V)&&!_(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var $=+new Date;t.activeTouch={start:$,moved:!1,prev:$-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(V){var $=t.activeTouch;if($&&!Mr(t,V)&&$.left!=null&&!$.moved&&new Date-$.start<300){var oe=e.coordsChar(t.activeTouch,"page"),de;!$.prev||j($,$.prev)?de=new wt(oe,oe):!$.prev.prev||j($,$.prev.prev)?de=e.findWordAt(oe):de=new wt(Fe(oe.line,0),mt(e.doc,Fe(oe.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),Y(V)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(V){return Mo(e,V)}),Ae(t.scroller,"DOMMouseScroll",function(V){return Mo(e,V)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ue(e,V)||le(V)},over:function(V){Ue(e,V)||(Ll(e,V),le(V))},start:function(V){return Al(e,V)},drop:zt(e,_l),leave:function(V){Ue(e,V)||ss(e)}};var G=t.input.getField();Ae(G,"keyup",function(V){return ys.call(e,V)}),Ae(G,"keydown",zt(e,vs)),Ae(G,"keypress",zt(e,bs)),Ae(G,"focus",function(V){return wa(e,V)}),Ae(G,"blur",function(V){return Pn(e,V)})}var za=[];Pt.defineInitHook=function(e){return za.push(e)};function Si(e,t,n,r){var i=e.doc,_;n==null&&(n="add"),n=="smart"&&(i.mode.indent?_=He(e,t).state:n="prev");var j=e.options.tabSize,G=st(i,t),V=H(G.text,null,j);G.stateAfter&&(G.stateAfter=null);var $=G.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(G.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(_,G.text.slice($.length),G.text),oe==be||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=H(st(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var de="",we=0;if(e.options.indentWithTabs)for(var xe=Math.floor(oe/j);xe;--xe)we+=j,de+=" ";if(we<oe&&(de+=me(oe-we)),de!=$)return Fn(i,de,Fe(t,0),Fe(t,$.length),"+input"),G.stateAfter=null,!0;for(var Ie=0;Ie<i.sel.ranges.length;Ie++){var Ne=i.sel.ranges[Ie];if(Ne.head.line==t&&Ne.head.ch<$.length){var Ke=Fe(t,$.length);Na(i,Ie,new wt(Ke,Ke));break}}}var xr=null;function ra(e){xr=e}function Ga(e,t,n,r,i){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var j=+new Date-200,G=i=="paste"||e.state.pasteIncoming>j,V=at(t),$=null;if(G&&r.ranges.length>1)if(xr&&xr.text.join(`
|
|
`)==t){if(r.ranges.length%xr.text.length==0){$=[];for(var oe=0;oe<xr.text.length;oe++)$.push(_.splitLines(xr.text[oe]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&($=ie(V,function(Ye){return[Ye]}));for(var de=e.curOp.updateInput,we=r.ranges.length-1;we>=0;we--){var xe=r.ranges[we],Ie=xe.from(),Ne=xe.to();xe.empty()&&(n&&n>0?Ie=Fe(Ie.line,Ie.ch-n):e.state.overwrite&&!G?Ne=Fe(Ne.line,Math.min(st(_,Ne.line).text.length,Ne.ch+Q(V).length)):G&&xr&&xr.lineWise&&xr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Ie=Ne=Fe(Ie.line,0)));var Ke={from:Ie,to:Ne,text:$?$[we%$.length]:V,origin:i||(G?"paste":e.state.cutIncoming>j?"cut":"+input")};Nn(e.doc,Ke),Lt(e,"inputRead",e,Ke)}t&&!G&&As(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function _s(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return Ga(t,n,0,null,"paste")}),!0}function As(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 _=e.getModeAt(i.head),j=!1;if(_.electricChars){for(var G=0;G<_.electricChars.length;G++)if(t.indexOf(_.electricChars.charAt(G))>-1){j=Si(e,i.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(st(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Lt(e,"electricInput",e,i.head.line)}}function Ls(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,_={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(_),t.push(e.getRange(_.anchor,_.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var _=this.options,j=_[r];if(_[r]==i&&r!="mode")return;_[r]=i,t.hasOwnProperty(r)&&zt(this,t[r])(this,i,j),Oe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,_=0;_<i.length;++_)if(i[_]==r||i[_].name==r)return i.splice(_,1),!0},addOverlay:qt(function(r,i){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");te(this.state.overlays,{mode:_,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,_=0;_<i.length;++_){var j=i[_].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(_,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,_){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,_)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,_=-1,j=0;j<i.length;j++){var G=i[j];if(G.empty())G.head.line>_&&(Si(this,G.head.line,r,!0),_=G.head.line,j==this.doc.sel.primIndex&&Mn(this));else{var V=G.from(),$=G.to(),oe=Math.max(_,V.line);_=Math.min(this.lastLine(),$.line-($.ch?0:1))+1;for(var de=oe;de<_;++de)Si(this,de,r);var we=this.doc.sel.ranges;V.ch==0&&i.length==we.length&&we[j].from().ch>0&&Na(this.doc,j,new wt(V,we[j].to()),pe)}}}),getTokenAt:function(r,i){return Ur(this,r,i)},getLineTokens:function(r,i){return Ur(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=mt(this.doc,r);var i=Yn(this,st(this.doc,r.line)),_=0,j=(i.length-1)/2,G=r.ch,V;if(G==0)V=i[2];else for(;;){var $=_+j>>1;if(($?i[$*2-1]:0)>=G)j=$;else if(i[$*2+1]<G)_=$+1;else{V=i[$*2+2];break}}var oe=V?V.indexOf("overlay "):-1;return oe<0?V:oe==0?null:V.slice(0,oe-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var _=[];if(!n.hasOwnProperty(i))return _;var j=n[i],G=this.getModeAt(r);if(typeof G[i]=="string")j[G[i]]&&_.push(j[G[i]]);else if(G[i])for(var V=0;V<G[i].length;V++){var $=j[G[i][V]];$&&_.push($)}else G.helperType&&j[G.helperType]?_.push(j[G.helperType]):j[G.name]&&_.push(j[G.name]);for(var oe=0;oe<j._global.length;oe++){var de=j._global[oe];de.pred(G,this)&&ee(_,de.val)==-1&&_.push(de.val)}return _},getStateAfter:function(r,i){var _=this.doc;return r=Xn(_,r==null?_.first+_.size-1:r),He(this,r+1,i).state},cursorCoords:function(r,i){var _,j=this.doc.sel.primary();return r==null?_=j.head:typeof r=="object"?_=mt(this.doc,r):_=r?j.from():j.to(),br(this,_,i||"page")},charCoords:function(r,i){return ga(this,mt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,_){var j=!1,G;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,j=!0),G=st(this.doc,r)}else G=r;return Fi(this,G,{top:0,left:0},i||"page",_||j).top+(j?this.doc.height-lr(G):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,_,j,G){var V=this.display;r=br(this,mt(this.doc,r));var $=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),j=="over")$=r.top;else if(j=="above"||j=="near"){var de=Math.max(V.wrapper.clientHeight,this.doc.height),we=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?$=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&($=r.bottom),oe+i.offsetWidth>we&&(oe=we-i.offsetWidth)}i.style.top=$+"px",i.style.left=i.style.right="",G=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(G=="left"?oe=0:G=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),_&&Qs(this,{left:oe,top:$,right:oe+i.offsetWidth,bottom:$+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){As(this,r)}),findPosH:function(r,i,_,j){var G=1;i<0&&(G=-1,i=-i);for(var V=mt(this.doc,r),$=0;$<i&&!(V=Va(this.doc,V,G,_,j),V.hitSide);++$);return V},moveH:qt(function(r,i){var _=this;this.extendSelectionsBy(function(j){return _.display.shift||_.doc.extend||j.empty()?Va(_.doc,j.head,r,i,_.options.rtlMoveVisually):r<0?j.from():j.to()},se)}),deleteH:qt(function(r,i){var _=this.doc.sel,j=this.doc;_.somethingSelected()?j.replaceSelection("",null,"+delete"):Wn(this,function(G){var V=Va(j,G.head,r,i,!1);return r<0?{from:V,to:G.head}:{from:G.head,to:V}})}),findPosV:function(r,i,_,j){var G=1,V=j;i<0&&(G=-1,i=-i);for(var $=mt(this.doc,r),oe=0;oe<i;++oe){var de=br(this,$,"div");if(V==null?V=de.left:de.left=V,$=Rs(this,de,G,_),$.hitSide)break}return $},moveV:qt(function(r,i){var _=this,j=this.doc,G=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(oe){if(V)return r<0?oe.from():oe.to();var de=br(_,oe.head,"div");oe.goalColumn!=null&&(de.left=oe.goalColumn),G.push(de.left);var we=Rs(_,de,r,i);return i=="page"&&oe==j.sel.primary()&&_a(_,ga(_,we,"div").top-de.top),we},se),G.length)for(var $=0;$<j.sel.ranges.length;$++)j.sel.ranges[$].goalColumn=G[$]}),findWordAt:function(r){var i=this.doc,_=st(i,r.line).text,j=r.ch,G=r.ch;if(_){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||G==_.length)&&j?--j:++G;for(var $=_.charAt(j),oe=Te($,V)?function(de){return Te(de,V)}:/\s/.test($)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!Te(de)};j>0&&oe(_.charAt(j-1));)--j;for(;G<_.length&&oe(_.charAt(G));)++G}return new wt(Fe(r.line,j),Fe(r.line,G))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):p(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-_r(this)-this.display.barHeight,width:r.scrollWidth-_r(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(this)}},scrollIntoView:qt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var _=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(V){if(V.widgets){for(var $=0;$<V.widgets.length;$++)if(V.widgets[$].noHScroll){Kr(_,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return mn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-On(this.display))>.5||this.options.lineWrapping)&&Ta(this),Oe(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Lt(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}},he(e),e.registerHelper=function(r,i,_){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=_},e.registerGlobalHelper=function(r,i,_,j){e.registerHelper(r,i,j),n[r]._global.push({pred:_,val:j})}}function Va(e,t,n,r,i){var _=t,j=n,G=st(e,t.line),V=i&&e.direction=="rtl"?-n:n;function $(){var et=t.line+V;return et<e.first||et>=e.first+e.size?!1:(t=new Fe(et,t.ch,t.sticky),G=st(e,et))}function oe(et){var $e;if(r=="codepoint"){var nt=G.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(G.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?$e=kl(e.cm,G,t,n):$e=Ba(G,t,n);if($e==null)if(!et&&$())t=ja(i,e.cm,G,t.line,V);else return!1;else t=$e;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var de=null,we=r=="group",xe=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(n<0&&!oe(!Ie));Ie=!1){var Ne=G.text.charAt(t.ch)||`
|
|
`,Ke=Te(Ne,xe)?"w":we&&Ne==`
|
|
`?"n":!we||/\s/.test(Ne)?null:"p";if(we&&!Ie&&!Ke&&(Ke="s"),de&&de!=Ke){n<0&&(n=1,oe(),t.sticky="after");break}if(Ke&&(de=Ke),n>0&&!oe(!Ie))break}var Ye=Qi(e,t,_,j,!0);return qr(_,Ye)&&(Ye.hitSide=!0),Ye}function Rs(e,t,n,r){var i=e.doc,_=t.left,j;if(r=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(G-.5*On(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var $;!($=ya(e,_,j),!$.outside);){if(n<0?j<=0:j>=i.height){$.hitSide=!0;break}j+=n*5}return $}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,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;Ds(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(G){for(var V=G.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Ae(i,"paste",function(G){if(!_(G)||Ue(r,G)||_s(G,r))return;k<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),Ae(i,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),Ae(i,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(G){if(!_(G)||Ue(r,G))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),G.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ls(r);ra({lineWise:!0,text:V.text}),G.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var $=xr.text.join(`
|
|
`);if(G.clipboardData.setData("Text",$),G.clipboardData.getData("Text")==$){G.preventDefault();return}}var oe=Os(),de=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),de.value=xr.text.join(`
|
|
`);var we=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(oe),we.focus(),we==i&&n.showPrimarySelection()},50)}Ae(i,"copy",j),Ae(i,"cut",j)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=yo(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){e.removeAllRanges();return}var _=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&j&&!j.bad&&ft(bn(_,j),r)==0&&ft(tn(_,j),i)==0)return;var G=t.display.view,V=r.line>=t.display.viewFrom&&Ps(t,r)||{node:G[0].measure.map[2],offset:0},$=i.line<t.display.viewTo&&Ps(t,i);if(!$){var oe=G[G.length-1].measure,de=oe.maps?oe.maps[oe.maps.length-1]:oe.map;$={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!V||!$){e.removeAllRanges();return}var we=e.rangeCount&&e.getRangeAt(0),xe;try{xe=y(V.node,V.offset,$.offset,$.node)}catch(Ie){}xe&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),xe.collapsed||(e.removeAllRanges(),e.addRange(xe))):(e.removeAllRanges(),e.addRange(xe)),we&&e.anchorNode==null?e.addRange(we):L&&this.startGracePeriod()),this.rememberSelection()},_t.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},_t.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},_t.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_t.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return m(this.div,t)},_t.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_t.prototype.blur=function(){this.div.blur()},_t.prototype.getField=function(){return this.div},_t.prototype.supportsTouch=function(){return!0},_t.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ur(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},_t.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_t.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&h&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Qt(t.doc,Gr(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},_t.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,st(e.doc,r.line-1).length)),i.ch==st(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var _,j,G;r.line==t.viewFrom||(_=dn(e,r.line))==0?(j=St(t.view[0].line),G=t.view[0].node):(j=St(t.view[_].line),G=t.view[_-1].node.nextSibling);var V=dn(e,i.line),$,oe;if(V==t.view.length-1?($=t.viewTo-1,oe=t.lineDiv.lastChild):($=St(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!G)return!1;for(var de=e.doc.splitLines(tu(e,G,oe,j,$)),we=Sr(e.doc,Fe(j,0),Fe($,st(e.doc,$).text.length));de.length>1&&we.length>1;)if(Q(de)==Q(we))de.pop(),we.pop(),$--;else if(de[0]==we[0])de.shift(),we.shift(),j++;else break;for(var xe=0,Ie=0,Ne=de[0],Ke=we[0],Ye=Math.min(Ne.length,Ke.length);xe<Ye&&Ne.charCodeAt(xe)==Ke.charCodeAt(xe);)++xe;for(var et=Q(de),$e=Q(we),nt=Math.min(et.length-(de.length==1?xe:0),$e.length-(we.length==1?xe:0));Ie<nt&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)++Ie;if(de.length==1&&we.length==1&&j==r.line)for(;xe&&xe>r.ch&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)xe--,Ie++;de[de.length-1]=et.slice(0,et.length-Ie).replace(/^\u200b+/,""),de[0]=de[0].slice(xe).replace(/\u200b+$/,"");var dt=Fe(j,xe),lt=Fe($,we.length?Q(we).length-Ie:0);if(de.length>1||de[0]||ft(dt,lt))return Fn(e.doc,de,dt,lt,"+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())&&ur(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()||zt(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 Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=st(e.doc,t.line),i=no(n,r,t.line),_=Xe(r,e.doc.direction),j="left";if(_){var G=je(_,t.ch);j=G%2?"right":"left"}var V=oo(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var _="",j=!1,G=e.doc.lineSeparator(),V=!1;function $(xe){return function(Ie){return Ie.id==xe}}function oe(){j&&(_+=G,V&&(_+=G),j=V=!1)}function de(xe){xe&&(oe(),_+=xe)}function we(xe){if(xe.nodeType==1){var Ie=xe.getAttribute("cm-text");if(Ie){de(Ie);return}var Ne=xe.getAttribute("cm-marker"),Ke;if(Ne){var Ye=e.findMarks(Fe(r,0),Fe(i+1,0),$(+Ne));Ye.length&&(Ke=Ye[0].find(0))&&de(Sr(e.doc,Ke.from,Ke.to).join(G));return}if(xe.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(xe.nodeName);if(!/^br$/i.test(xe.nodeName)&&xe.textContent.length==0)return;et&&oe();for(var $e=0;$e<xe.childNodes.length;$e++)we(xe.childNodes[$e]);/^(pre|p)$/i.test(xe.nodeName)&&(V=!0),et&&(j=!0)}else xe.nodeType==3&&de(xe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(we(t),t==n);)t=t.nextSibling,V=!1;return _}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var _=e.display.view[i];if(_.node==r)return ru(_,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!m(r,t))return Kn(Fe(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var _=e.rest?Q(e.rest):e.line;return Kn(Fe(St(_),_.text.length),i)}var j=t.nodeType==3?t:null,G=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));G.parentNode!=r;)G=G.parentNode;var V=e.measure,$=V.maps;function oe(Ke,Ye,et){for(var $e=-1;$e<($?$.length:0);$e++)for(var nt=$e<0?V.map:$[$e],dt=0;dt<nt.length;dt+=3){var lt=nt[dt+2];if(lt==Ke||lt==Ye){var gt=St($e<0?e.line:e.rest[$e]),Ot=nt[dt]+et;return(et<0||lt!=Ke)&&(Ot=nt[dt+(et?1:0)]),Fe(gt,Ot)}}}var de=oe(j,G,n);if(de)return Kn(de,i);for(var we=G.nextSibling,xe=j?j.nodeValue.length-n:0;we;we=we.nextSibling){if(de=oe(we,we.firstChild,0),de)return Kn(Fe(de.line,de.ch-xe),i);xe+=we.textContent.length}for(var Ie=G.previousSibling,Ne=n;Ie;Ie=Ie.previousSibling){if(de=oe(Ie,Ie.firstChild,-1),de)return Kn(Fe(de.line,de.ch+Ne),i);Ne+=Ie.textContent.length}}var Nt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Nt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),Ae(i,"input",function(){B&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(j){if(Ue(r,j)||_s(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function _(j){if(Ue(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var G=Ls(r);ra({lineWise:!0,text:G.text}),j.type=="cut"?r.setSelections(G.ranges,null,pe):(n.prevInput="",i.value=G.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",_),Ae(i,"copy",_),Ae(e.scroller,"paste",function(j){if(Mr(e,j)||Ue(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var G=new Event("paste");G.clipboardData=j.clipboardData,i.dispatchEvent(G)}),Ae(e.lineSpace,"selectstart",function(j){Mr(e,j)||Y(j)}),Ae(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nt.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Nt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Nt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-_.left))}return r},Nt.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nt.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&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&k>=9&&(this.hasSelection=null))},Nt.prototype.getField=function(){return this.textarea},Nt.prototype.supportsTouch=function(){return!1},Nt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nt.prototype.blur=function(){this.textarea.blur()},Nt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nt.prototype.receivedFocus=function(){this.slowPoll()},Nt.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()})},Nt.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)},Nt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||rt(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&&k>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=i.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,G=Math.min(r.length,i.length);j<G&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return ur(t,function(){Ga(t,i.slice(j),r.length-j,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Nt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nt.prototype.onKeyPress=function(){B&&k>=9&&(this.hasSelection=null),this.fastPoll()},Nt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=un(n,e),j=r.scroller.scrollTop;if(!_||b)return;var G=n.options.resetSelectionOnContextMenu;G&&n.doc.sel.contains(_)==-1&&zt(n,Qt)(n.doc,Gr(_),pe);var V=i.style.cssText,$=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.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 de;R&&(de=window.scrollY),r.input.focus(),R&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=xe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function we(){if(i.selectionStart!=null){var Ne=n.somethingSelected(),Ke="\u200B"+(Ne?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Ne?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function xe(){if(t.contextMenuPending!=xe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=$,i.style.cssText=V,B&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!B||B&&k<9)&&we();var Ne=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(n,Qo)(n):Ne++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(B&&k>=9&&we(),A){le(e);var Ie=function(){Je(window,"mouseup",Ie),setTimeout(xe,20)};Ae(window,"mouseup",Ie)}else setTimeout(xe,50)},Nt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Nt.prototype.setUneditable=function(){},Nt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?I(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=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=G.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;i=_.submit;try{var j=_.submit=function(){r(),_.submit=i,_.submit(),_.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var G=Pt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return G}function iu(e){e.off=Je,e.on=Ae,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=H,e.findColumn=fe,e.isWordChar=ve,e.Pass=be,e.signal=Oe,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=_o,e.Pos=Fe,e.cmpPos=ft,e.modes=At,e.mimeModes=pt,e.resolveMode=Ft,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=mr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=kr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=pi,e.e_preventDefault=Y,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=U,e.contains=m,e.rmClass=p,e.keyNames=$r}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&ee(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return he(rr),Pt.inputStyles={textarea:Nt,contenteditable:_t},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),or.apply(this,arguments)},Pt.defineMIME=Kt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){rr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(Ze,We,J){"use strict";J.r(We),J.d(We,"ResizableTextArea",function(){return ee});var q=J("wx14"),z=J("1OyB"),L=J("vuIU"),K=J("Ji7U"),N=J("LK+K"),O=J("cDcd"),B=J("VTBJ"),k=J("rePB"),R=J("Zm9Q"),S=J("Kwbf"),h=J("c+Xe"),b=J("m+aA"),P=J("bdgK"),w=new Map;function g(pe){pe.forEach(function(ue){var se,fe=ue.target;(se=w.get(fe))===null||se===void 0||se.forEach(function(ne){return ne(fe)})})}var v=new P.default(g),d=null,o=null;function l(pe,ue){w.has(pe)||(w.set(pe,new Set),v.observe(pe)),w.get(pe).add(ue)}function u(pe,ue){w.has(pe)&&(w.get(pe).delete(ue),w.get(pe).size||(v.unobserve(pe),w.delete(pe)))}var C=function(pe){Object(K.a)(se,pe);var ue=Object(N.a)(se);function se(){return Object(z.a)(this,se),ue.apply(this,arguments)}return Object(L.a)(se,[{key:"render",value:function(){return this.props.children}}]),se}(O.Component),E=O.createContext(null);function f(pe){var ue=pe.children,se=pe.onBatchResize,fe=O.useRef(0),ne=O.useRef([]),me=O.useContext(E),Q=O.useCallback(function(ie,te,Ee){fe.current+=1;var _e=fe.current;ne.current.push({size:ie,element:te,data:Ee}),Promise.resolve().then(function(){_e===fe.current&&(se==null||se(ne.current),ne.current=[])}),me==null||me(ie,te,Ee)},[se,me]);return O.createElement(E.Provider,{value:Q},ue)}function A(pe){var ue=pe.children,se=pe.disabled,fe=O.useRef(null),ne=O.useRef(null),me=O.useContext(E),Q=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=O.isValidElement(ue)&&Object(h.c)(ue),te=ie?ue.ref:null,Ee=O.useMemo(function(){return Object(h.a)(te,fe)},[te,fe]),_e=O.useRef(pe);_e.current=pe;var ye=O.useCallback(function(ve){var Te=_e.current,De=Te.onResize,Re=Te.data,Ce=ve.getBoundingClientRect(),Le=Ce.width,ze=Ce.height,Ve=ve.offsetWidth,Be=ve.offsetHeight,je=Math.floor(Le),qe=Math.floor(ze);if(Q.current.width!==je||Q.current.height!==qe||Q.current.offsetWidth!==Ve||Q.current.offsetHeight!==Be){var Xe={width:je,height:qe,offsetWidth:Ve,offsetHeight:Be};Q.current=Xe;var Qe=Ve===Math.round(Le)?Le:Ve,Ae=Be===Math.round(ze)?ze:Be,tt=Object(B.a)(Object(B.a)({},Xe),{},{offsetWidth:Qe,offsetHeight:Ae});me==null||me(tt,ve,Re),De&&Promise.resolve().then(function(){De(tt,ve)})}},[]);return O.useEffect(function(){var ve=Object(b.a)(fe.current)||Object(b.a)(ne.current);return ve&&!se&&l(ve,ye),function(){return u(ve,ye)}},[fe.current,se]),O.createElement(C,{ref:ne},ie?O.cloneElement(ue,{ref:Ee}):ue)}var T="rc-observer-key";function p(pe){var ue=pe.children,se=Object(R.a)(ue);return se.map(function(fe,ne){var me=(fe==null?void 0:fe.key)||"".concat(T,"-").concat(ne);return O.createElement(A,Object(q.a)({},pe,{key:me}),fe)})}p.Collection=f;var c=p,s=J("bT9E"),a=J("TSYQ"),x=J.n(a),y=`
|
|
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
|
|
`,m=["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"],D={},U;function F(pe){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(ue&&D[se])return D[se];var fe=window.getComputedStyle(pe),ne=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")),Q=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ie=m.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),te={sizingStyle:ie,paddingSize:me,borderSize:Q,boxSizing:ne};return ue&&se&&(D[se]=te),te}function W(pe){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),pe.getAttribute("wrap")?U.setAttribute("wrap",pe.getAttribute("wrap")):U.removeAttribute("wrap");var ne=F(pe,ue),me=ne.paddingSize,Q=ne.borderSize,ie=ne.boxSizing,te=ne.sizingStyle;U.setAttribute("style","".concat(te,";").concat(y)),U.value=pe.value||pe.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,_e=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,ve;if(ie==="border-box"?ye+=Q:ie==="content-box"&&(ye-=me),se!==null||fe!==null){U.value=" ";var Te=U.scrollHeight-me;se!==null&&(Ee=Te*se,ie==="border-box"&&(Ee=Ee+me+Q),ye=Math.max(Ee,ye)),fe!==null&&(_e=Te*fe,ie==="border-box"&&(_e=_e+me+Q),ve=ye>_e?"":"hidden",ye=Math.min(_e,ye))}return{height:ye,minHeight:Ee,maxHeight:_e,overflowY:ve,resize:"none"}}var M=J("Gytx"),I=J.n(M),H;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(pe){Object(K.a)(se,pe);var ue=Object(N.a)(se);function se(fe){var ne;return Object(z.a)(this,se),ne=ue.call(this,fe),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(me){ne.textArea=me},ne.handleResize=function(me){var Q=ne.state.resizeStatus,ie=ne.props,te=ie.autoSize,Ee=ie.onResize;if(Q!==H.NONE)return;typeof Ee=="function"&&Ee(me),te&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var me=ne.props.autoSize;if(!me||!ne.textArea)return;var Q=me.minRows,ie=me.maxRows,te=W(ne.textArea,!1,Q,ie);ne.setState({textareaStyles:te,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var me=ne.props,Q=me.prefixCls,ie=Q===void 0?"rc-textarea":Q,te=me.autoSize,Ee=me.onResize,_e=me.className,ye=me.disabled,ve=ne.state,Te=ve.textareaStyles,De=ve.resizeStatus,Re=Object(s.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ce=x()(ie,_e,Object(k.a)({},"".concat(ie,"-disabled"),ye));"value"in Re&&(Re.value=Re.value||"");var Le=Object(B.a)(Object(B.a)(Object(B.a)({},ne.props.style),Te),De===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ne.handleResize,disabled:!(te||Ee)},O.createElement("textarea",Object(q.a)({},Re,{className:Ce,style:Le,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:H.NONE},ne}return Object(L.a)(se,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!I()(ne.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 ne=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,me)}}catch(Q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(O.Component),ee=X,ae=function(pe){Object(K.a)(se,pe);var ue=Object(N.a)(se);function se(fe){var ne;Object(z.a)(this,se),ne=ue.call(this,fe),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function(Q){ne.resizableTextArea=Q},ne.handleChange=function(Q){var ie=ne.props.onChange;ne.setValue(Q.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ie&&ie(Q)},ne.handleKeyDown=function(Q){var ie=ne.props,te=ie.onPressEnter,Ee=ie.onKeyDown;Q.keyCode===13&&te&&te(Q),Ee&&Ee(Q)};var me=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ne.state={value:me},ne}return Object(L.a)(se,[{key:"setValue",value:function(ne,me){"value"in this.props||this.setState({value:ne},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ee,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),se}(O.Component),be=We.default=ae},ZW9T:function(Ze,We,J){"use strict";J.d(We,"a",function(){return E});var q=J("k1fw"),z=J("miYZ"),L=J("tsqr"),K=J("rAM+"),N=J("tJVT"),O=J("PpiC"),B=J("cDcd"),k=J.n(B),R=J("bdgK");function S(f,A,T,p,c){var s=A.getWordUntilPosition(T),a={startLineNumber:T.lineNumber,endLineNumber:T.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},x=p.map(function(y){return{label:y,kind:f.languages.CompletionItemKind.Keyword,insertText:y,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(y){x.push(Object(q.a)(Object(q.a)({},y),{},{range:a}))}),x}var h=function(f){var A={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},T=["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,x){var y=S(f,a,x,T,[A]);return{suggestions:y}}});var p=["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,x){var y=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],m=S(f,a,x,p,y);return{suggestions:m}}});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,x){var y=[A,{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}],m=S(f,a,x,c,y);return{suggestions:m}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=J("LvDl"),w=J("+ua5");function g(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}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 l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],A=f;if(Array.isArray(f)){for(var T=0;T<f.length;T++){var p=o[f[T]];if(p)return p}return A[0]}return o[A]||A}var u=null,C=We.b=function(f){var A=f.width,T=A===void 0?"100%":A,p=f.height,c=p===void 0?"100%":p,s=f.value,a=f.language,x=a===void 0?"javascript":a,y=f.style,m=y===void 0?{}:y,D=f.options,U=D===void 0?{}:D,F=f.overrideServices,W=F===void 0?{}:F,M=f.theme,I=M===void 0?"vs-dark":M,H=f.onEditBlur,X=f.onSave,ee=f.autoHeight,ae=ee===void 0?!1:ee,be=f.forbidCopy,pe=be===void 0?!1:be,ue=f.onChange,se=ue===void 0?v:ue,fe=f.editorDidMount,ne=fe===void 0?v:fe,me=f.onFocus,Q=me===void 0?v:me,ie=f.filename,te=ie===void 0?"educoder.txt":ie,Ee=f.errorLine,_e=f.errorContent,ye=_e===void 0?"":_e,ve=Object(O.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Te=Object(B.useRef)(),De=Object(B.useRef)({}),Re=Object(B.useRef)(),Ce=Object(B.useRef)(!1),Le=Object(B.useRef)(),ze=Object(B.useState)(!1),Ve=Object(N.a)(ze,2),Be=Ve[0],je=Ve[1];function qe(){var ke;return Te.current&&(ke=new R.default(function(Ge){var it=Object(K.a)(Ge),Me;try{for(it.s();!(Me=it.n()).done;){var ct=Me.value;(ct.target.offsetHeight>0||ct.target.offsetWidth>0)&&De.current.instance.layout()}}catch(at){it.e(at)}finally{it.f()}}),ke.observe(Te.current)),ke}function Xe(){L.b.warn(decodeURIComponent(b))}var Qe=function(){var Ge=De.current.instance;if(s!=null&&Ge&&Be){var it=Ge.getModel();it&&s!==it.getValue()&&(d=!0,it.setValue(s),Ge.layout(),d=!1)}};Object(B.useEffect)(function(){Re.current&&clearTimeout(Re.current),Re.current=setTimeout(function(){Qe()},500)},[s,Be,De.current]),Object(B.useEffect)(function(){if(Ee&&De.current&&De.current.instance){var ke=De.current.instance;ke.changeViewZones(function(it){var Me=document.createElement("div");Me.style.padding="10px 20px",Me.style.width="calc(100% - 20px)",Me.className="my-error-line-wrp",Me.innerHTML=ye,it.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:Me})});var Ge={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}};ke.addOverlayWidget(Ge),ke.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,De.current,Be]);function Ae(){var ke=De.current.instance;if(ke){var Ge=ke.getSelection(),it=De.current.pastePos||{},Me=new u.Range(it.startLineNumber||Ge.endLineNumber,it.startColumn||Ge.endColumn,it.endLineNumber||Ge.endLineNumber,it.endColumn||Ge.endColumn);setTimeout(function(){ke.executeEdits("",[{range:Me,text:""}])},300)}}function tt(ke){(window.navigator.platform.match("Mac")?ke.metaKey:ke.ctrlKey)&&ke.keyCode==83&&(ke.preventDefault(),X())}var Je=function(){if(ae&&De.current.instance){var Ge=De.current.instance.getContentHeight();Se(Ge<c?c:Ge)}else Se(c)};function Oe(ke){var Ge=document.createEvent("MouseEvents");Ge.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ke.dispatchEvent(Ge)}function Ue(ke,Ge){var it=window.URL||window.webkitURL||window,Me=new Blob([Ge]),ct=document.createElementNS("http://www.w3.org/1999/xhtml","a");ct.href=it.createObjectURL(Me),ct.download=ke,Oe(ct)}Object(B.useEffect)(function(){Je()},[Je]),Object(B.useEffect)(function(){Te.current&&!Be&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ke){try{u=ke,De.current.instance=u.editor.create(Te.current,{value:s,language:l(x),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ge=De.current.instance;if(ne(Ge,u),setTimeout(function(){Je(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ue(te||"educoder.txt",Ge.getValue())}})},500),De.current.subscription=Ge.onDidChangeModelContent(function(Me){Ce.current?clearTimeout(Le.current):(Je(),se(Ge.getValue(),Me)),Le.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||h(u),pe&&(Ge.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return Xe(),null}),Ge.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return Xe(),null})),window.Monaco=u,H&&Ge.onDidBlurEditorWidget(function(){H(Ge.getValue())}),Q&&Ge.onDidFocusEditorText(function(){Q(Ge.getValue())}),pe){Ge.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return Xe(),null}),Ge.onDidPaste(function(Me){De.current.pastePos=Me});try{window.addEventListener("paste",Ae)}catch(Me){}}var it=qe();return je(!0),function(){var Me=De.current.instance;Me.dispose();var ct=Me.getModel();ct&&ct.dispose(),De.current.subscription&&De.current.subscription.dispose(),pe&&window.removeEventListener("paste",Ae),it.unobserve(Te.current)}}catch(Me){}})},[]),Object(B.useEffect)(function(){var ke=De.current.instance;if(ke&&Be)return document.addEventListener("keydown",tt,!1),function(){document.removeEventListener("keydown",tt)}},[X,Be]),Object(B.useEffect)(function(){var ke=De.current.instance;if(ke&&Be){var Ge=l(x);u.editor.setModelLanguage(ke.getModel(),Ge),console.log("language:",x,ke.getModel(),Ge)}},[x,Be]),Object(B.useEffect)(function(){var ke=De.current.instance;ke&&Be&&u.editor.setTheme(I)},[I,Be]),Object(B.useEffect)(function(){var ke=De.current.instance;ke&&Be&&(ke.updateOptions(Object(q.a)({},U)),setTimeout(function(){ke.getModel().updateOptions(Object(q.a)({},U))},200))},[JSON.stringify(U),Be]),Object(B.useEffect)(function(){var ke=De.current.instance;ke&&Be&&ke.layout()},[T,c,Be]);var ge=Object(B.useState)(g(T)),ce=Object(N.a)(ge,2),he=ce[0],Y=ce[1],Z=Object(B.useState)(g(c)),re=Object(N.a)(Z,2),le=re[0],Se=re[1],Pe=Object(q.a)(Object(q.a)({},m),{},{width:he,height:le});return k.a.createElement("div",{className:"my-monaco-editor",ref:Te,style:Pe})};function E(f){var A=f.width,T=A===void 0?"100%":A,p=f.height,c=p===void 0?"100%":p,s=f.original,a=f.modified,x=f.language,y=f.options,m=y===void 0?{}:y,D=Object(B.useRef)(),U=Object(B.useState)(null),F=Object(N.a)(U,2),W=F[0],M=F[1];function I(ae){var be;return D.current&&(be=new R.default(function(pe){var ue=Object(K.a)(pe),se;try{for(ue.s();!(se=ue.n()).done;){var fe=se.value;(fe.target.offsetHeight>0||fe.target.offsetWidth>0)&&ae.layout()}}catch(ne){ue.e(ne)}finally{ue.f()}}),be.observe(D.current)),be}Object(B.useEffect)(function(){D.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ae){u=ae;var be=u.editor.createDiffEditor(D.current,Object(q.a)(Object(q.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},m),{},{wordWrap:!0}));M(be);var pe=I(be);return function(){be.dispose();var ue=be.getModel();ue&&ue.dispose(),pe.unobserve(D.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:u.editor.createModel(s,x),modified:u.editor.createModel(a,x)})},[s,a,x,W]);var H=g(T),X=g(c),ee={width:H,height:X};return k.a.createElement("div",{className:"my-diff-editor",ref:D,style:ee})}},ZpRC:function(Ze,We,J){"use strict";function q(h){return typeof h=="object"&&h!=null&&h.nodeType===1}function z(h,b){return(!b||h!=="hidden")&&h!=="visible"&&h!=="clip"}function L(h,b){if(h.clientHeight<h.scrollHeight||h.clientWidth<h.scrollWidth){var P=getComputedStyle(h,null);return z(P.overflowY,b)||z(P.overflowX,b)||function(w){var g=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(w);return!!g&&(g.clientHeight<w.scrollHeight||g.clientWidth<w.scrollWidth)}(h)}return!1}function K(h,b,P,w,g,v,d,o){return v<h&&d>b||v>h&&d<b?0:v<=h&&o<=P||d>=b&&o>=P?v-h-w:d>b&&o<P||v<h&&o>P?d-b+g:0}var N=function(h,b){var P=window,w=b.scrollMode,g=b.block,v=b.inline,d=b.boundary,o=b.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Te){return Te!==d};if(!q(h))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,C=[],E=h;q(E)&&l(E);){if((E=E.parentElement)===u){C.push(E);break}E!=null&&E===document.body&&L(E)&&!L(document.documentElement)||E!=null&&L(E,o)&&C.push(E)}for(var f=P.visualViewport?P.visualViewport.width:innerWidth,A=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,p=window.scrollY||pageYOffset,c=h.getBoundingClientRect(),s=c.height,a=c.width,x=c.top,y=c.right,m=c.bottom,D=c.left,U=g==="start"||g==="nearest"?x:g==="end"?m:x+s/2,F=v==="center"?D+a/2:v==="end"?y:D,W=[],M=0;M<C.length;M++){var I=C[M],H=I.getBoundingClientRect(),X=H.height,ee=H.width,ae=H.top,be=H.right,pe=H.bottom,ue=H.left;if(w==="if-needed"&&x>=0&&D>=0&&m<=A&&y<=f&&x>=ae&&m<=pe&&D>=ue&&y<=be)return W;var se=getComputedStyle(I),fe=parseInt(se.borderLeftWidth,10),ne=parseInt(se.borderTopWidth,10),me=parseInt(se.borderRightWidth,10),Q=parseInt(se.borderBottomWidth,10),ie=0,te=0,Ee="offsetWidth"in I?I.offsetWidth-I.clientWidth-fe-me:0,_e="offsetHeight"in I?I.offsetHeight-I.clientHeight-ne-Q:0;if(u===I)ie=g==="start"?U:g==="end"?U-A:g==="nearest"?K(p,p+A,A,ne,Q,p+U,p+U+s,s):U-A/2,te=v==="start"?F:v==="center"?F-f/2:v==="end"?F-f:K(T,T+f,f,fe,me,T+F,T+F+a,a),ie=Math.max(0,ie+p),te=Math.max(0,te+T);else{ie=g==="start"?U-ae-ne:g==="end"?U-pe+Q+_e:g==="nearest"?K(ae,pe,X,ne,Q+_e,U,U+s,s):U-(ae+X/2)+_e/2,te=v==="start"?F-ue-fe:v==="center"?F-(ue+ee/2)+Ee/2:v==="end"?F-be+me+Ee:K(ue,be,ee,fe,me+Ee,F,F+a,a);var ye=I.scrollLeft,ve=I.scrollTop;U+=ve-(ie=Math.max(0,Math.min(ve+ie,I.scrollHeight-X+_e))),F+=ye-(te=Math.max(0,Math.min(ye+te,I.scrollWidth-ee+Ee)))}W.push({el:I,top:ie,left:te})}return W};function O(h){return h===Object(h)&&Object.keys(h).length!==0}function B(h,b){b===void 0&&(b="auto");var P="scrollBehavior"in document.body.style;h.forEach(function(w){var g=w.el,v=w.top,d=w.left;g.scroll&&P?g.scroll({top:v,left:d,behavior:b}):(g.scrollTop=v,g.scrollLeft=d)})}function k(h){return h===!1?{block:"end",inline:"nearest"}:O(h)?h:{block:"start",inline:"nearest"}}function R(h,b){var P=!h.ownerDocument.documentElement.contains(h);if(O(b)&&typeof b.behavior=="function")return b.behavior(P?[]:N(h,b));if(P)return;var w=k(b);return B(N(h,w),w.behavior)}var S=We.a=R},Zss7:function(Ze,We,J){var q;(function(z){var L=/^\s+/,K=/\s+$/,N=0,O=z.round,B=z.min,k=z.max,R=z.random;function S(Q,ie){if(Q=Q||"",ie=ie||{},Q instanceof S)return Q;if(!(this instanceof S))return new S(Q,ie);var te=h(Q);this._originalInput=Q,this._r=te.r,this._g=te.g,this._b=te.b,this._a=te.a,this._roundA=O(100*this._a)/100,this._format=ie.format||te.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=te.ok,this._tc_id=N++}S.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 Q=this.toRgb();return(Q.r*299+Q.g*587+Q.b*114)/1e3},getLuminance:function(){var Q=this.toRgb(),ie,te,Ee,_e,ye,ve;return ie=Q.r/255,te=Q.g/255,Ee=Q.b/255,ie<=.03928?_e=ie/12.92:_e=z.pow((ie+.055)/1.055,2.4),te<=.03928?ye=te/12.92:ye=z.pow((te+.055)/1.055,2.4),Ee<=.03928?ve=Ee/12.92:ve=z.pow((Ee+.055)/1.055,2.4),.2126*_e+.7152*ye+.0722*ve},setAlpha:function(Q){return this._a=W(Q),this._roundA=O(100*this._a)/100,this},toHsv:function(){var Q=g(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,v:Q.v,a:this._a}},toHsvString:function(){var Q=g(this._r,this._g,this._b),ie=O(Q.h*360),te=O(Q.s*100),Ee=O(Q.v*100);return this._a==1?"hsv("+ie+", "+te+"%, "+Ee+"%)":"hsva("+ie+", "+te+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var Q=P(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,l:Q.l,a:this._a}},toHslString:function(){var Q=P(this._r,this._g,this._b),ie=O(Q.h*360),te=O(Q.s*100),Ee=O(Q.l*100);return this._a==1?"hsl("+ie+", "+te+"%, "+Ee+"%)":"hsla("+ie+", "+te+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(Q){return d(this._r,this._g,this._b,Q)},toHexString:function(Q){return"#"+this.toHex(Q)},toHex8:function(Q){return o(this._r,this._g,this._b,this._a,Q)},toHex8String:function(Q){return"#"+this.toHex8(Q)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(M(this._r,255)*100)+"%",g:O(M(this._g,255)*100)+"%",b:O(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%)":"rgba("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(Q){var ie="#"+l(this._r,this._g,this._b,this._a),te=ie,Ee=this._gradientType?"GradientType = 1, ":"";if(Q){var _e=S(Q);te="#"+l(_e._r,_e._g,_e._b,_e._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ie+",endColorstr="+te+")"},toString:function(Q){var ie=!!Q;Q=Q||this._format;var te=!1,Ee=this._a<1&&this._a>=0,_e=!ie&&Ee&&(Q==="hex"||Q==="hex6"||Q==="hex3"||Q==="hex4"||Q==="hex8"||Q==="name");return _e?Q==="name"&&this._a===0?this.toName():this.toRgbString():(Q==="rgb"&&(te=this.toRgbString()),Q==="prgb"&&(te=this.toPercentageRgbString()),(Q==="hex"||Q==="hex6")&&(te=this.toHexString()),Q==="hex3"&&(te=this.toHexString(!0)),Q==="hex4"&&(te=this.toHex8String(!0)),Q==="hex8"&&(te=this.toHex8String()),Q==="name"&&(te=this.toName()),Q==="hsl"&&(te=this.toHslString()),Q==="hsv"&&(te=this.toHsvString()),te||this.toHexString())},clone:function(){return S(this.toString())},_applyModification:function(Q,ie){var te=Q.apply(null,[this].concat([].slice.call(ie)));return this._r=te._r,this._g=te._g,this._b=te._b,this.setAlpha(te._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(E,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(Q,ie){return Q.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(m,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(s,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},S.fromRatio=function(Q,ie){if(typeof Q=="object"){var te={};for(var Ee in Q)Q.hasOwnProperty(Ee)&&(Ee==="a"?te[Ee]=Q[Ee]:te[Ee]=be(Q[Ee]));Q=te}return S(Q,ie)};function h(Q){var ie={r:0,g:0,b:0},te=1,Ee=null,_e=null,ye=null,ve=!1,Te=!1;return typeof Q=="string"&&(Q=ne(Q)),typeof Q=="object"&&(fe(Q.r)&&fe(Q.g)&&fe(Q.b)?(ie=b(Q.r,Q.g,Q.b),ve=!0,Te=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):fe(Q.h)&&fe(Q.s)&&fe(Q.v)?(Ee=be(Q.s),_e=be(Q.v),ie=v(Q.h,Ee,_e),ve=!0,Te="hsv"):fe(Q.h)&&fe(Q.s)&&fe(Q.l)&&(Ee=be(Q.s),ye=be(Q.l),ie=w(Q.h,Ee,ye),ve=!0,Te="hsl"),Q.hasOwnProperty("a")&&(te=Q.a)),te=W(te),{ok:ve,format:Q.format||Te,r:B(255,k(ie.r,0)),g:B(255,k(ie.g,0)),b:B(255,k(ie.b,0)),a:te}}function b(Q,ie,te){return{r:M(Q,255)*255,g:M(ie,255)*255,b:M(te,255)*255}}function P(Q,ie,te){Q=M(Q,255),ie=M(ie,255),te=M(te,255);var Ee=k(Q,ie,te),_e=B(Q,ie,te),ye,ve,Te=(Ee+_e)/2;if(Ee==_e)ye=ve=0;else{var De=Ee-_e;ve=Te>.5?De/(2-Ee-_e):De/(Ee+_e);switch(Ee){case Q:ye=(ie-te)/De+(ie<te?6:0);break;case ie:ye=(te-Q)/De+2;break;case te:ye=(Q-ie)/De+4;break}ye/=6}return{h:ye,s:ve,l:Te}}function w(Q,ie,te){var Ee,_e,ye;Q=M(Q,360),ie=M(ie,100),te=M(te,100);function ve(Re,Ce,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Re+(Ce-Re)*6*Le:Le<1/2?Ce:Le<2/3?Re+(Ce-Re)*(2/3-Le)*6:Re}if(ie===0)Ee=_e=ye=te;else{var Te=te<.5?te*(1+ie):te+ie-te*ie,De=2*te-Te;Ee=ve(De,Te,Q+1/3),_e=ve(De,Te,Q),ye=ve(De,Te,Q-1/3)}return{r:Ee*255,g:_e*255,b:ye*255}}function g(Q,ie,te){Q=M(Q,255),ie=M(ie,255),te=M(te,255);var Ee=k(Q,ie,te),_e=B(Q,ie,te),ye,ve,Te=Ee,De=Ee-_e;if(ve=Ee===0?0:De/Ee,Ee==_e)ye=0;else{switch(Ee){case Q:ye=(ie-te)/De+(ie<te?6:0);break;case ie:ye=(te-Q)/De+2;break;case te:ye=(Q-ie)/De+4;break}ye/=6}return{h:ye,s:ve,v:Te}}function v(Q,ie,te){Q=M(Q,360)*6,ie=M(ie,100),te=M(te,100);var Ee=z.floor(Q),_e=Q-Ee,ye=te*(1-ie),ve=te*(1-_e*ie),Te=te*(1-(1-_e)*ie),De=Ee%6,Re=[te,ve,ye,ye,Te,te][De],Ce=[Te,te,te,ve,ye,ye][De],Le=[ye,ye,Te,te,te,ve][De];return{r:Re*255,g:Ce*255,b:Le*255}}function d(Q,ie,te,Ee){var _e=[ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16))];return Ee&&_e[0].charAt(0)==_e[0].charAt(1)&&_e[1].charAt(0)==_e[1].charAt(1)&&_e[2].charAt(0)==_e[2].charAt(1)?_e[0].charAt(0)+_e[1].charAt(0)+_e[2].charAt(0):_e.join("")}function o(Q,ie,te,Ee,_e){var ye=[ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16)),ae(pe(Ee))];return _e&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l(Q,ie,te,Ee){var _e=[ae(pe(Ee)),ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16))];return _e.join("")}S.equals=function(Q,ie){return!Q||!ie?!1:S(Q).toRgbString()==S(ie).toRgbString()},S.random=function(){return S.fromRatio({r:R(),g:R(),b:R()})};function u(Q,ie){ie=ie===0?0:ie||10;var te=S(Q).toHsl();return te.s-=ie/100,te.s=I(te.s),S(te)}function C(Q,ie){ie=ie===0?0:ie||10;var te=S(Q).toHsl();return te.s+=ie/100,te.s=I(te.s),S(te)}function E(Q){return S(Q).desaturate(100)}function f(Q,ie){ie=ie===0?0:ie||10;var te=S(Q).toHsl();return te.l+=ie/100,te.l=I(te.l),S(te)}function A(Q,ie){ie=ie===0?0:ie||10;var te=S(Q).toRgb();return te.r=k(0,B(255,te.r-O(255*-(ie/100)))),te.g=k(0,B(255,te.g-O(255*-(ie/100)))),te.b=k(0,B(255,te.b-O(255*-(ie/100)))),S(te)}function T(Q,ie){ie=ie===0?0:ie||10;var te=S(Q).toHsl();return te.l-=ie/100,te.l=I(te.l),S(te)}function p(Q,ie){var te=S(Q).toHsl(),Ee=(te.h+ie)%360;return te.h=Ee<0?360+Ee:Ee,S(te)}function c(Q){var ie=S(Q).toHsl();return ie.h=(ie.h+180)%360,S(ie)}function s(Q){var ie=S(Q).toHsl(),te=ie.h;return[S(Q),S({h:(te+120)%360,s:ie.s,l:ie.l}),S({h:(te+240)%360,s:ie.s,l:ie.l})]}function a(Q){var ie=S(Q).toHsl(),te=ie.h;return[S(Q),S({h:(te+90)%360,s:ie.s,l:ie.l}),S({h:(te+180)%360,s:ie.s,l:ie.l}),S({h:(te+270)%360,s:ie.s,l:ie.l})]}function x(Q){var ie=S(Q).toHsl(),te=ie.h;return[S(Q),S({h:(te+72)%360,s:ie.s,l:ie.l}),S({h:(te+216)%360,s:ie.s,l:ie.l})]}function y(Q,ie,te){ie=ie||6,te=te||30;var Ee=S(Q).toHsl(),_e=360/te,ye=[S(Q)];for(Ee.h=(Ee.h-(_e*ie>>1)+720)%360;--ie;)Ee.h=(Ee.h+_e)%360,ye.push(S(Ee));return ye}function m(Q,ie){ie=ie||6;for(var te=S(Q).toHsv(),Ee=te.h,_e=te.s,ye=te.v,ve=[],Te=1/ie;ie--;)ve.push(S({h:Ee,s:_e,v:ye})),ye=(ye+Te)%1;return ve}S.mix=function(Q,ie,te){te=te===0?0:te||50;var Ee=S(Q).toRgb(),_e=S(ie).toRgb(),ye=te/100,ve={r:(_e.r-Ee.r)*ye+Ee.r,g:(_e.g-Ee.g)*ye+Ee.g,b:(_e.b-Ee.b)*ye+Ee.b,a:(_e.a-Ee.a)*ye+Ee.a};return S(ve)},S.readability=function(Q,ie){var te=S(Q),Ee=S(ie);return(z.max(te.getLuminance(),Ee.getLuminance())+.05)/(z.min(te.getLuminance(),Ee.getLuminance())+.05)},S.isReadable=function(Q,ie,te){var Ee=S.readability(Q,ie),_e,ye;ye=!1,_e=me(te);switch(_e.level+_e.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},S.mostReadable=function(Q,ie,te){var Ee=null,_e=0,ye,ve,Te,De;te=te||{},ve=te.includeFallbackColors,Te=te.level,De=te.size;for(var Re=0;Re<ie.length;Re++)ye=S.readability(Q,ie[Re]),ye>_e&&(_e=ye,Ee=S(ie[Re]));return S.isReadable(Q,Ee,{level:Te,size:De})||!ve?Ee:(te.includeFallbackColors=!1,S.mostReadable(Q,["#fff","#000"],te))};var D=S.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"},U=S.hexNames=F(D);function F(Q){var ie={};for(var te in Q)Q.hasOwnProperty(te)&&(ie[Q[te]]=te);return ie}function W(Q){return Q=parseFloat(Q),(isNaN(Q)||Q<0||Q>1)&&(Q=1),Q}function M(Q,ie){X(Q)&&(Q="100%");var te=ee(Q);return Q=B(ie,k(0,parseFloat(Q))),te&&(Q=parseInt(Q*ie,10)/100),z.abs(Q-ie)<1e-6?1:Q%ie/parseFloat(ie)}function I(Q){return B(1,k(0,Q))}function H(Q){return parseInt(Q,16)}function X(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1}function ee(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}function ae(Q){return Q.length==1?"0"+Q:""+Q}function be(Q){return Q<=1&&(Q=Q*100+"%"),Q}function pe(Q){return z.round(parseFloat(Q)*255).toString(16)}function ue(Q){return H(Q)/255}var se=function(){var Q="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",te="(?:"+ie+")|(?:"+Q+")",Ee="[\\s|\\(]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")\\s*\\)?",_e="[\\s|\\(]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")\\s*\\)?";return{CSS_UNIT:new RegExp(te),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+_e),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+_e),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+_e),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(Q){return!!se.CSS_UNIT.exec(Q)}function ne(Q){Q=Q.replace(L,"").replace(K,"").toLowerCase();var ie=!1;if(D[Q])Q=D[Q],ie=!0;else if(Q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var te;return(te=se.rgb.exec(Q))?{r:te[1],g:te[2],b:te[3]}:(te=se.rgba.exec(Q))?{r:te[1],g:te[2],b:te[3],a:te[4]}:(te=se.hsl.exec(Q))?{h:te[1],s:te[2],l:te[3]}:(te=se.hsla.exec(Q))?{h:te[1],s:te[2],l:te[3],a:te[4]}:(te=se.hsv.exec(Q))?{h:te[1],s:te[2],v:te[3]}:(te=se.hsva.exec(Q))?{h:te[1],s:te[2],v:te[3],a:te[4]}:(te=se.hex8.exec(Q))?{r:H(te[1]),g:H(te[2]),b:H(te[3]),a:ue(te[4]),format:ie?"name":"hex8"}:(te=se.hex6.exec(Q))?{r:H(te[1]),g:H(te[2]),b:H(te[3]),format:ie?"name":"hex"}:(te=se.hex4.exec(Q))?{r:H(te[1]+""+te[1]),g:H(te[2]+""+te[2]),b:H(te[3]+""+te[3]),a:ue(te[4]+""+te[4]),format:ie?"name":"hex8"}:(te=se.hex3.exec(Q))?{r:H(te[1]+""+te[1]),g:H(te[2]+""+te[2]),b:H(te[3]+""+te[3]),format:ie?"name":"hex"}:!1}function me(Q){var ie,te;return Q=Q||{level:"AA",size:"small"},ie=(Q.level||"AA").toUpperCase(),te=(Q.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),te!=="small"&&te!=="large"&&(te="small"),{level:ie,size:te}}Ze.exports?Ze.exports=S:!(q=function(){return S}.call(We,J,We,Ze),q!==void 0&&(Ze.exports=q))})(Math)},aRTE:function(Ze,We){Ze.exports={L:1,M:0,Q:3,H:2}},bT9E:function(Ze,We,J){"use strict";J.d(We,"a",function(){return z});var q=J("VTBJ");function z(L,K){var N=Object(q.a)({},L);return Array.isArray(K)&&K.forEach(function(O){delete N[O]}),N}},c5Ni:function(Ze,We,J){},dQei:function(Ze,We){for(var J={glog:function(z){if(z<1)throw new Error("glog("+z+")");return J.LOG_TABLE[z]},gexp:function(z){for(;z<0;)z+=255;for(;z>=256;)z-=255;return J.EXP_TABLE[z]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},q=0;q<8;q++)J.EXP_TABLE[q]=1<<q;for(var q=8;q<256;q++)J.EXP_TABLE[q]=J.EXP_TABLE[q-4]^J.EXP_TABLE[q-5]^J.EXP_TABLE[q-6]^J.EXP_TABLE[q-8];for(var q=0;q<255;q++)J.LOG_TABLE[J.EXP_TABLE[q]]=q;Ze.exports=J},dWSS:function(Ze,We,J){var q=J("dQei");function z(L,K){if(L.length==null)throw new Error(L.length+"/"+K);for(var N=0;N<L.length&&L[N]==0;)N++;this.num=new Array(L.length-N+K);for(var O=0;O<L.length-N;O++)this.num[O]=L[O+N]}z.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var K=new Array(this.getLength()+L.getLength()-1),N=0;N<this.getLength();N++)for(var O=0;O<L.getLength();O++)K[N+O]^=q.gexp(q.glog(this.get(N))+q.glog(L.get(O)));return new z(K,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var K=q.glog(this.get(0))-q.glog(L.get(0)),N=new Array(this.getLength()),O=0;O<this.getLength();O++)N[O]=this.get(O);for(var O=0;O<L.getLength();O++)N[O]^=q.gexp(q.glog(L.get(O))+K);return new z(N,0).mod(L)}},Ze.exports=z},dejd:function(Ze,We,J){},dmUQ:function(Ze,We,J){"use strict";var q=J("Ff2n"),z=J("rePB"),L=J("1OyB"),K=J("vuIU"),N=J("Ji7U"),O=J("md7G"),B=J("foSv"),k=J("cDcd"),R=J.n(k),S=J("TSYQ"),h=J.n(S),b=J("4IlW");function P(s,a){var x=Object.keys(s);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(s);a&&(y=y.filter(function(m){return Object.getOwnPropertyDescriptor(s,m).enumerable})),x.push.apply(x,y)}return x}function w(s){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?P(Object(x),!0).forEach(function(y){Object(z.a)(s,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(x)):P(Object(x)).forEach(function(y){Object.defineProperty(s,y,Object.getOwnPropertyDescriptor(x,y))})}return s}function g(s){var a=v();return function(){var y=Object(B.a)(s),m;if(a){var D=Object(B.a)(this).constructor;m=Reflect.construct(y,arguments,D)}else m=y.apply(this,arguments);return Object(O.a)(this,m)}}function v(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function d(){}function o(s){s.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,C=600,E=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},A=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},T=function(s){Object(N.a)(x,s);var a=g(x);function x(y){var m;Object(L.a)(this,x),m=a.call(this,y),m.onKeyDown=function(F){var W=m.props,M=W.onKeyDown,I=W.onPressEnter;if(F.keyCode===b.a.UP){var H=m.getRatio(F);m.up(F,H,null),m.stop()}else if(F.keyCode===b.a.DOWN){var X=m.getRatio(F);m.down(F,X,null),m.stop()}else F.keyCode===b.a.ENTER&&I&&I(F);if(m.recordCursorPosition(),m.lastKeyCode=F.keyCode,M){for(var ee=arguments.length,ae=new Array(ee>1?ee-1:0),be=1;be<ee;be++)ae[be-1]=arguments[be];M.apply(void 0,[F].concat(ae))}},m.onKeyUp=function(F){var W=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),W){for(var M=arguments.length,I=new Array(M>1?M-1:0),H=1;H<M;H++)I[H-1]=arguments[H];W.apply(void 0,[F].concat(I))}},m.onChange=function(F){var W=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(F)),m.setState({inputValue:m.rawInput}),W(m.toNumber(m.rawInput))},m.onMouseUp=function(){var F=m.props.onMouseUp;m.recordCursorPosition(),F&&F.apply(void 0,arguments)},m.onFocus=function(){var F;m.setState({focused:!0}),(F=m.props).onFocus.apply(F,arguments)},m.onBlur=function(){var F=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var W=m.getCurrentValidValue(m.state.inputValue),M=m.setValue(W,d);if(F){var I=m.input.value,H=m.getInputDisplayValue({focus:!1,value:M});m.input.value=H&&Number(H),F.apply(void 0,arguments),m.input.value=I}},m.getRatio=function(F){var W=1;return F.metaKey||F.ctrlKey?W=.1:F.shiftKey&&(W=10),W},m.getFullNum=function(F){return isNaN(F)?F:/e/i.test(String(F))?Number(F).toFixed(18).replace(/\.?0+$/,""):F},m.getPrecision=function(F){if(f(m.props.precision))return m.props.precision;var W=String(F);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var M=0;return W.indexOf(".")>=0&&(M=W.length-W.indexOf(".")-1),M},m.getInputDisplayValue=function(F){var W=F||m.state,M=W.focused,I=W.inputValue,H=W.value,X;M?X=I:X=m.toPrecisionAsStep(H),X==null&&(X="");var ee=m.formatWrapper(X);return f(m.props.decimalSeparator)&&(ee=ee.toString().replace(".",m.props.decimalSeparator)),ee},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(F){}},m.restoreByAfter=function(F){if(F===void 0)return!1;var W=m.input.value,M=W.lastIndexOf(F);if(M===-1)return!1;var I=m.cursorBefore.length;return m.lastKeyCode===b.a.DELETE&&m.cursorBefore.charAt(I-1)===F[0]?(m.fixCaret(I,I),!0):M+F.length===W.length?(m.fixCaret(M,M),!0):!1},m.partRestoreByAfter=function(F){return F===void 0?!1:Array.prototype.some.call(F,function(W,M){var I=F.substring(M);return m.restoreByAfter(I)})},m.isNotCompleteNumber=function(F){return isNaN(F)||F===""||F===null||F&&F.toString().indexOf(".")===F.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(F,W,M){m.pressingUpOrDown=!0,m.step("down",F,W,M)},m.up=function(F,W,M){m.pressingUpOrDown=!0,m.step("up",F,W,M)},m.saveInput=function(F){m.input=F};var D=y.value;D===void 0&&(D=y.defaultValue),m.state={focused:y.autoFocus};var U=m.getValidValue(m.toNumber(D));return m.state=w(w({},m.state),{},{inputValue:m.toPrecisionAsStep(U),value:U}),m}return Object(K.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var D=this.props,U=D.value,F=D.onChange,W=D.max,M=D.min,I=this.state.focused;if(m){if(!A(m.value,U)||!A(m.max,W)||!A(m.min,M)){var H=I?U:this.getValidValue(U),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var ee="value"in this.props?U:this.state.value;"max"in this.props&&m.max!==W&&typeof ee=="number"&&ee>W&&F&&F(W),"min"in this.props&&m.min!==M&&typeof ee=="number"&&ee<M&&F&&F(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ae=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(ae=this.cursorStart):ae=this.input.value.length,this.fixCaret(ae,ae)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(m){var D=m;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(m){var D=m.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(m){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,F=parseFloat(m);return isNaN(F)?m:(F<D&&(F=D),F>U&&(F=U),F)}},{key:"setValue",value:function(m,D){var U=this.props.precision,F=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),W=this.state.value,M=W===void 0?null:W,I=this.state.inputValue,H=I===void 0?null:I,X=typeof F=="number"?F.toFixed(U):"".concat(F),ee=F!==M||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},D)):this.setState({value:F,inputValue:this.toPrecisionAsStep(m)},D),ee&&this.props.onChange(F),F}},{key:"getMaxPrecision",value:function(m){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,F=U.precision,W=U.step;if(f(F))return F;var M=this.getPrecision(D),I=this.getPrecision(W),H=this.getPrecision(m);return m?Math.max(H,M+I):M+I}},{key:"getPrecisionFactor",value:function(m){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(m,D);return Math.pow(10,U)}},{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(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var D=Math.abs(this.getMaxPrecision(m));return isNaN(D)?m.toString():Number(m).toFixed(D)}},{key:"toNumber",value:function(m){var D=this.props.precision,U=this.state.focused,F=m&&m.length>16&&U;return this.isNotCompleteNumber(m)||F?m:f(D)?Math.round(m*Math.pow(10,D))/Math.pow(10,D):Number(m)}},{key:"upStep",value:function(m,D){var U=this.props.step,F=this.getPrecisionFactor(m,D),W=Math.abs(this.getMaxPrecision(m,D)),M=((F*m+F*U*D)/F).toFixed(W);return this.toNumber(M)}},{key:"downStep",value:function(m,D){var U=this.props.step,F=this.getPrecisionFactor(m,D),W=Math.abs(this.getMaxPrecision(m,D)),M=((F*m-F*U*D)/F).toFixed(W);return this.toNumber(M)}},{key:"step",value:function(m,D){var U=this,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var M=this.props;if(M.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var H=this["".concat(m,"Step")](I,F),X=H>M.max||H<M.min;if(H>M.max?H=M.max:H<M.min&&(H=M.min),this.setValue(H,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[m](D,F,!0)},W?u:C)}},{key:"fixCaret",value:function(m,D){if(m===void 0||D===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,F=this.input.selectionEnd;(m!==U||D!==F)&&this.input.setSelectionRange(m,D)}catch(W){}}},{key:"render",value:function(){var m,D=this.props,U=D.prefixCls,F=D.disabled,W=D.readOnly,M=D.useTouch,I=D.autoComplete,H=D.upHandler,X=D.downHandler,ee=D.className,ae=D.max,be=D.min,pe=D.style,ue=D.title,se=D.onMouseEnter,fe=D.onMouseLeave,ne=D.onMouseOver,me=D.onMouseOut,Q=D.required,ie=D.onClick,te=D.tabIndex,Ee=D.type,_e=D.placeholder,ye=D.id,ve=D.inputMode,Te=D.pattern,De=D.step,Re=D.maxLength,Ce=D.autoFocus,Le=D.name,ze=D.onPaste,Ve=D.onInput,Be=Object(q.a)(D,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),je=this.state,qe=je.value,Xe=je.focused,Qe=h()(U,(m={},Object(z.a)(m,ee,!!ee),Object(z.a)(m,"".concat(U,"-disabled"),F),Object(z.a)(m,"".concat(U,"-focused"),Xe),m)),Ae={};Object.keys(Be).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Ae[le]=Be[le])});var tt=!W&&!F,Je=this.getInputDisplayValue(null),Oe=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=ae),Ue=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=be),ge=Oe||F||W,ce=Ue||F||W,he=h()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(z.a)({},"".concat(U,"-handler-up-disabled"),ge)),Y=h()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(z.a)({},"".concat(U,"-handler-down-disabled"),ce)),Z=M?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=M?{onTouchStart:ce?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Qe,style:pe,title:ue,onMouseEnter:se,onMouseLeave:fe,onMouseOver:ne,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(U,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:he}),H||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:Y}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(U,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":ae,"aria-valuenow":qe,required:Q,type:Ee,placeholder:_e,onPaste:ze,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:te,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:tt?this.onKeyDown:d,onKeyUp:tt?this.onKeyUp:d,autoFocus:Ce,maxLength:Re,readOnly:W,disabled:F,max:ae,min:be,step:De,name:Le,title:ue,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Te,inputMode:ve,onInput:Ve},Ae))))}}]),x}(R.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:E,min:-E,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var p=T,c=We.a=p},f4xo:function(Ze,We,J){var q=J("nVVt");function z(L){this.mode=q.MODE_8BIT_BYTE,this.data=L}z.prototype={getLength:function(L){return this.data.length},write:function(L){for(var K=0;K<this.data.length;K++)L.put(this.data.charCodeAt(K),8)}},Ze.exports=z},gMzb:function(Ze,We,J){"use strict";var q=J("k1fw"),z=J("oBTY"),L=J("9og8"),K=J("tJVT"),N=J("sRBo"),O=J("kaz8"),B=J("WmNS"),k=J.n(B),R=J("cDcd"),S=J.n(R),h=J("9kvl"),b=J("wlus"),P=J("w5pM"),w=J("ErOA"),g=J("OaEy"),v=J("2fM7"),d=J("y8nQ"),o=J("Vl3Y"),l=J("Ty5D"),u=J("yQHh"),C=J.n(u),E=O.a.Group,f=function(a){var x,y,m,D,U,F,W,M,I=a.classroomList,H=a.loading,X=a.user,ee=a.exercise_id,ae=ee===void 0?null:ee,be=a.homework_common_id,pe=be===void 0?null:be,ue=a.setitem,se=a.item,fe=a.type,ne=a.rz,me=a.dispatch,Q=Object(R.useState)([]),ie=Object(K.a)(Q,2),te=ie[0],Ee=ie[1],_e=Object(R.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),ye=Object(K.a)(_e,2),ve=ye[0],Te=ye[1],De=Object(l.i)(),Re=Object(R.useState)(!1),Ce=Object(K.a)(Re,2),Le=Ce[0],ze=Ce[1],Ve=Object(R.useState)(!1),Be=Object(K.a)(Ve,2),je=Be[0],qe=Be[1],Xe=o.a.useForm(),Qe=Object(K.a)(Xe,1),Ae=Qe[0];Object(R.useEffect)(function(){ne&&(ve.zydatas=ne,Te(Object(q.a)({},ve)),se!=null&&se.ec_course_id&&tt())},[se,ne]);function tt(){return Je.apply(this,arguments)}function Je(){return Je=Object(L.a)(k.a.mark(function Y(){return k.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:return console.log("----",se),re.next=3,Oe(se==null?void 0:se.ec_major_school_id);case 3:return re.next=5,ge(se==null?void 0:se.ec_year_id);case 5:return re.next=7,he(se==null?void 0:se.ec_course_id);case 7:Ae.setFieldsValue({ec_course_id:se==null?void 0:se.ec_course_id,ec_major_school_id:se==null?void 0:se.ec_major_school_id,ec_point_ids:se==null?void 0:se.ec_point_ids,ec_year_id:se==null?void 0:se.ec_year_id});case 8:case"end":return re.stop()}},Y)})),Je.apply(this,arguments)}function Oe(Y){return Ue.apply(this,arguments)}function Ue(){return Ue=Object(L.a)(k.a.mark(function Y(Z){var re;return k.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,Object(w.a)("/api/ec_major_schools/".concat(Z,"/ec_years/get_year_list.json"),{method:"get"});case 2:re=Se.sent,ve.jbdatas=re==null?void 0:re.data,Te(Object(q.a)({},ve)),Ae.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Se.stop()}},Y)})),Ue.apply(this,arguments)}function ge(Y){return ce.apply(this,arguments)}function ce(){return ce=Object(L.a)(k.a.mark(function Y(Z){var re;return k.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,Object(w.a)("/api/ec_years/".concat(Z,"/ec_courses/get_courses.json"),{method:"get"});case 2:re=Se.sent,ve.kcdatas=re==null?void 0:re.data,Te(Object(q.a)({},ve)),Ae.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Se.stop()}},Y)})),ce.apply(this,arguments)}var he=function(){var Y=Object(L.a)(k.a.mark(function Z(re){var le;return k.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,Object(w.a)("/api/ec_courses/".concat(re,"/ec_points.json"),{method:"get",params:{ec_course_id:re}});case 2:le=Pe.sent,ve.zsdatas=le==null?void 0:le.data,Te(Object(q.a)({},ve));case 5:case"end":return Pe.stop()}},Z)}));return function(re){return Y.apply(this,arguments)}}();return S.a.createElement("div",{className:C.a.from},S.a.createElement(o.a,{form:Ae,layout:"inline",onValuesChange:function(Z){console.log("----",Z),Z.ec_major_school_id&&(ve.jbdatas=[],ve.kcdatas=[],ve.zsdatas=[],Te(Object(q.a)({},ve)),Oe(Z.ec_major_school_id)),Z.ec_year_id&&(ve.kcdatas=[],ve.zsdatas=[],Te(Object(q.a)({},ve)),ge(Z.ec_year_id)),Z.ec_course_id&&(ve.zsdatas=[],Te(Object(q.a)({},ve)),he(Z.ec_course_id))},onFinish:function(){var Y=Object(L.a)(k.a.mark(function Z(re){return k.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:ue(re);case 1:case"end":return Se.stop()}},Z)}));return function(Z){return Y.apply(this,arguments)}}()},S.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},S.a.createElement(v.a,{style:{width:150},disabled:((x=ve.zydatas)===null||x===void 0?void 0:x.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ve==null||((y=ve.zydatas)===null||y===void 0)?void 0:y.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.ec_major_school_id},Y==null?void 0:Y.name)}))),S.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},S.a.createElement(v.a,{style:{width:150},disabled:((m=ve.jbdatas)===null||m===void 0?void 0:m.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ve==null||((D=ve.jbdatas)===null||D===void 0)?void 0:D.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.ec_year_id},Y==null?void 0:Y.year)}))),S.a.createElement(o.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},S.a.createElement(v.a,{style:{width:150},disabled:((U=ve.kcdatas)===null||U===void 0?void 0:U.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ve==null||((F=ve.kcdatas)===null||F===void 0)?void 0:F.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)}))),S.a.createElement(o.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},S.a.createElement(v.a,{onChange:function(){Ae.submit()},style:{width:150},mode:"multiple",disabled:((W=ve.zsdatas)===null||W===void 0?void 0:W.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ve==null||((M=ve.zsdatas)===null||M===void 0)?void 0:M.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)})))))},A=Object(h.a)(function(s){var a=s.classroomList,x=s.loading,y=s.globalSetting,m=s.user;return{classroomList:a,globalSetting:y,loading:x.effects,user:m}})(f),T=O.a.Group,p=function(a){var x,y,m,D=a.classroomList,U=a.loading,F=a.user,W=a.exercise_id,M=W===void 0?null:W,I=a.homework_common_id,H=I===void 0?null:I,X=a.setitem,ee=a.type,ae=a.dispatch,be=Object(R.useState)([{}]),pe=Object(K.a)(be,2),ue=pe[0],se=pe[1],fe=Object(R.useState)([]),ne=Object(K.a)(fe,2),me=ne[0],Q=ne[1];function ie(){return te.apply(this,arguments)}function te(){return te=Object(L.a)(k.a.mark(function ye(){var ve,Te,De,Re,Ce;return k.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:return ze.next=2,Object(w.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:M,homework_common_id:H}});case 2:Te=ze.sent,(Te==null||((ve=Te.data)===null||ve===void 0)?void 0:ve.length)>0&&(Ce=[],Te==null||((De=Te.data)===null||De===void 0)||De.map(function(Ve){var Be;Ve==null||((Be=Ve.ec_point_ids)===null||Be===void 0)||Be.map(function(je){Ce.push(je)})}),X(Object(q.a)(Object(q.a)({},Te==null||((Re=Te.data)===null||Re===void 0)?void 0:Re[0]),{},{ec_point_ids:Ce})),se(Te==null?void 0:Te.data));case 4:case"end":return ze.stop()}},ye)})),te.apply(this,arguments)}Object(R.useEffect)(function(){var ye,ve;F!=null&&(ye=F.userInfo)!==null&&ye!==void 0&&(ve=ye.course)!==null&&ve!==void 0&&ve.course_school_id&&Ee()},[F==null||((x=F.userInfo)===null||x===void 0||((y=x.course)===null||y===void 0))?void 0:y.course_school_id]);function Ee(){return _e.apply(this,arguments)}function _e(){return _e=Object(L.a)(k.a.mark(function ye(){var ve,Te,De;return k.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.next=2,Object(w.a)("/api/schools/".concat(F==null||((ve=F.userInfo)===null||ve===void 0||((Te=ve.course)===null||Te===void 0))?void 0:Te.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:De=Ce.sent,Q(De==null?void 0:De.data),(H||M)&&ie();case 5:case"end":return Ce.stop()}},ye)})),_e.apply(this,arguments)}return console.log(ue),S.a.createElement("div",{style:{display:(m=F.userInfo.course)!==null&&m!==void 0&&m.is_openengineering?"":"none"}},S.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),ue==null?void 0:ue.map(function(ye,ve){return S.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},S.a.createElement(A,{rz:me,item:ye,type:ve,setitem:function(De){ue.splice(ve,1,De),se(Object(z.a)(ue));var Re=[];ue==null||ue.map(function(Ce){var Le;Ce==null||((Le=Ce.ec_point_ids)===null||Le===void 0)||Le.map(function(ze){Re.push(ze)})}),X(Object(q.a)(Object(q.a)({},De),{},{ec_point_ids:Re}))}}),ve!=0&&S.a.createElement(b.a,{onClick:function(){ue.splice(ve,1),se(Object(z.a)(ue))},style:{marginLeft:10,fontSize:"20px"}}),S.a.createElement(P.a,{onClick:function(){ue.push({}),se(Object(z.a)(ue))},style:{marginLeft:10,fontSize:"20px"}}))}))},c=We.a=Object(h.a)(function(s){var a=s.classroomList,x=s.loading,y=s.globalSetting,m=s.user;return{classroomList:a,globalSetting:y,loading:x.effects,user:m}})(p)},gnOq:function(Ze,We,J){"use strict";J.r(We);var q=J("+L6B"),z=J("2/Rp"),L=J("5NDa"),K=J("5rEg"),N=J("sPJy"),O=J("bE4q"),B=J("k1fw"),k=J("9og8"),R=J("y8nQ"),S=J("Vl3Y"),h=J("tJVT"),b=J("WmNS"),P=J.n(b),w=J("cDcd"),g=J.n(w),v=J("9kvl"),d=J("55Ip"),o=J("Ot1p"),l=J("XYT7"),u=J("we55"),C=J.n(u),E=J("500L"),f=J("1vsH"),A=J("gMzb"),T=J("ErOA"),p=function(s){var a,x=s.shixunHomeworks,y=s.newCourse,m=s.globalSetting,D=s.loading,U=s.dispatch,F=s.match,W=S.a.useForm(),M=Object(h.a)(W,1),I=M[0],H=Object(w.useState)({}),X=Object(h.a)(H,2),ee=X[0],ae=X[1],be=Object(w.useState)(),pe=Object(h.a)(be,2),ue=pe[0],se=pe[1],fe=Object(w.useRef)(),ne=x.commonHomeWorkAddDefaultData,me=Object(w.useState)({}),Q=Object(h.a)(me,2),ie=Q[0],te=Q[1];Object(w.useEffect)(function(){var Te;setTimeout(function(){document.body.scrollIntoView()},300);var De=F.params,Re=De.coursesId,Ce=De.categoryId;fe.current=(Te=F.params)===null||Te===void 0?void 0:Te.courseId,se(!!fe.current),fe.current&&Ee(),U({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:Ce,coursesId:Re,type:1}})},[]);var Ee=function(){var Te=Object(k.a)(P.a.mark(function De(){var Re;return P.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return Le.next=2,U({type:"newCourse/getEditCourseData",payload:{id:fe.current}});case 2:Re=Le.sent,Re&&(I.setFieldsValue({name:Re.name}),I.setFieldsValue({intro:Re.description}),I.setFieldsValue({notice:Re.learning_notes}),ae({name:Re.name,intro:Re.description,notice:Re.learning_notes}));case 4:case"end":return Le.stop()}},De)}));return function(){return Te.apply(this,arguments)}}(),_e=function(){var Te=Object(k.a)(P.a.mark(function De(Re){var Ce,Le,ze,Ve,Be,je,qe;return P.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Ce=Object(B.a)({},ee),Ce.attachment_ids&&(Ce.attachment_ids=Ce==null||((Le=Ce.attachment_ids)===null||Le===void 0)?void 0:Le.map(function(Ae){return Ae.response.id})),Ce.reference_attachment_ids&&(Ce.reference_attachment_ids=Ce==null||((ze=Ce.reference_attachment_ids)===null||ze===void 0)?void 0:ze.map(function(Ae){return Ae.response.id})),Ve=F.params,Be=Ve.coursesId,je=Ve.categoryId,Qe.next=6,Object(l.a)(Object(B.a)(Object(B.a)({coursesId:Be,category:je},Ce),{},{base_on_project:!0,type:1}));case 6:qe=Qe.sent,(qe==null?void 0:qe.status)===0&&(ye(qe.homework_id),Object(f.eb)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),v.d.push("/classrooms/".concat(F.params.coursesId,"/common_homework/").concat(qe.homework_id,"/detail")));case 8:case"end":return Qe.stop()}},De)}));return function(Re){return Te.apply(this,arguments)}}();function ye(Te){return ve.apply(this,arguments)}function ve(){return ve=Object(k.a)(P.a.mark(function Te(De){var Re;return P.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:if(ie!=null&&ie.ec_point_ids){Le.next=2;break}return Le.abrupt("return");case 2:return Le.next=4,Object(T.a)("/api/ec_courses/".concat(ie==null?void 0:ie.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(B.a)({homework_common_id:De},ie)});case 4:Re=Le.sent;case 5:case"end":return Le.stop()}},Te)})),ve.apply(this,arguments)}return g.a.createElement("section",{className:C.a.bg},ne.course_name&&g.a.createElement("section",{className:"animated fadeIn"},g.a.createElement("aside",{className:"mt10"},ne.category&&g.a.createElement(O.a,{separator:">"},g.a.createElement(O.a.Item,null,g.a.createElement(d.a,{to:"/classrooms/".concat(ne.course_id,"/common_homework")},ne.course_name)),g.a.createElement(O.a.Item,null,g.a.createElement(d.a,{to:"/classrooms/".concat(ne.course_id,"/common_homework")},ne.category.category_name)),g.a.createElement(O.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),g.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),g.a.createElement(S.a,{form:I,className:C.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",I.getFieldsValue()),ae(Object(B.a)({},I.getFieldsValue()))},onFinish:_e},g.a.createElement("div",{className:C.a.fieldWrap},g.a.createElement(S.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},g.a.createElement(K.a,{maxLength:60,suffix:"".concat(((a=ee.name)===null||a===void 0?void 0:a.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),g.a.createElement("div",{className:C.a.mdWrap},g.a.createElement(S.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},g.a.createElement(o.a,{watch:!0,defaultValue:ee.intro})),g.a.createElement("div",null,g.a.createElement(S.a.Item,{name:"attachment_ids"},g.a.createElement(E.b,null)))),g.a.createElement("div",{className:C.a.mdWrap},g.a.createElement(S.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},g.a.createElement(o.a,{watch:!0,defaultValue:ee.notice})),g.a.createElement("div",null,g.a.createElement(S.a.Item,{name:"reference_attachment_ids"},g.a.createElement(E.b,null))))),g.a.createElement("div",{className:C.a.mdWrap},g.a.createElement(A.a,{setitem:function(De){return te(Object(B.a)({},De))}})),g.a.createElement("div",{className:C.a.backgroundFa},g.a.createElement("div",{className:"pt40 mb30"},g.a.createElement(S.a.Item,null,g.a.createElement(z.a,{size:"large",type:"primary",className:"".concat(C.a.button," mr20"),htmlType:"submit",onClick:function(){I.submit()},loading:D["newCourse/editCourse"]||D["newCourse/submitCourse"]},"\u63D0\u4EA4"),g.a.createElement(z.a,{size:"large",type:"primary",ghost:!0,className:C.a.button,onClick:function(){return v.d.push("/classrooms/".concat(F.params.coursesId,"/common_homework"))}},"\u53D6\u6D88")))))};We.default=Object(v.a)(function(c){var s=c.shixunHomeworks,a=c.newCourse,x=c.loading,y=c.globalSetting;return{shixunHomeworks:s,newCourse:a,globalSetting:y,loading:x.effects}})(p)},h78n:function(Ze,We,J){"use strict";J.d(We,"a",function(){return m});var q=J("cDcd"),z=J.n(q),L=J("TSYQ"),K=J.n(L),N={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(F){var W=F.map(function(){return Object(q.useRef)()}),M=Object(q.useRef)();return Object(q.useEffect)(function(){var I=Date.now(),H=!1;Object.keys(W).forEach(function(X){var ee=W[X].current;if(!ee)return;H=!0;var ae=ee.style;ae.transitionDuration=".3s, .3s, .3s, .06s",M.current&&I-M.current<100&&(ae.transitionDuration="0s, 0s")}),H&&(M.current=Date.now())}),[W]};function B(){return B=Object.assign||function(U){for(var F=1;F<arguments.length;F++){var W=arguments[F];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},B.apply(this,arguments)}function k(U,F){return P(U)||b(U,F)||S(U,F)||R()}function R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(U,F){if(!U)return;if(typeof U=="string")return h(U,F);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return h(U,F)}function h(U,F){(F==null||F>U.length)&&(F=U.length);for(var W=0,M=new Array(F);W<F;W++)M[W]=U[W];return M}function b(U,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,I=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(M=(ee=X.next()).done)&&!(W.push(ee.value),F&&W.length===F);M=!0);}catch(ae){I=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(I)throw H}}return W}function P(U){if(Array.isArray(U))return U}function w(U,F){if(U==null)return{};var W=g(U,F),M,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(I=0;I<H.length;I++){if(M=H[I],F.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function g(U,F){if(U==null)return{};var W={},M=Object.keys(U),I,H;for(H=0;H<M.length;H++){if(I=M[H],F.indexOf(I)>=0)continue;W[I]=U[I]}return W}var v=function(F){var W=F.className,M=F.percent,I=F.prefixCls,H=F.strokeColor,X=F.strokeLinecap,ee=F.strokeWidth,ae=F.style,be=F.trailColor,pe=F.trailWidth,ue=F.transition,se=w(F,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete se.gapPosition;var fe=Array.isArray(M)?M:[M],ne=Array.isArray(H)?H:[H],me=O(fe),Q=k(me,1),ie=Q[0],te=ee/2,Ee=100-ee/2,_e="M ".concat(X==="round"?te:0,",").concat(te,`
|
|
L `).concat(X==="round"?Ee:100,",").concat(te),ye="0 0 100 ".concat(ee),ve=0;return z.a.createElement("svg",B({className:K()("".concat(I,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:ae},se),z.a.createElement("path",{className:"".concat(I,"-line-trail"),d:_e,strokeLinecap:X,stroke:be,strokeWidth:pe||ee,fillOpacity:"0"}),fe.map(function(Te,De){var Re={strokeDasharray:"".concat(Te,"px, 100px"),strokeDashoffset:"-".concat(ve,"px"),transition:ue||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ce=ne[De]||ne[ne.length-1];return ve+=Te,z.a.createElement("path",{key:De,className:"".concat(I,"-line-path"),d:_e,strokeLinecap:X,stroke:Ce,strokeWidth:ee,fillOpacity:"0",ref:ie[De],style:Re})}))};v.defaultProps=N;var d=v;function o(){return o=Object.assign||function(U){for(var F=1;F<arguments.length;F++){var W=arguments[F];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},o.apply(this,arguments)}function l(U,F){return A(U)||f(U,F)||C(U,F)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(U,F){if(!U)return;if(typeof U=="string")return E(U,F);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return E(U,F)}function E(U,F){(F==null||F>U.length)&&(F=U.length);for(var W=0,M=new Array(F);W<F;W++)M[W]=U[W];return M}function f(U,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,I=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(M=(ee=X.next()).done)&&!(W.push(ee.value),F&&W.length===F);M=!0);}catch(ae){I=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(I)throw H}}return W}function A(U){if(Array.isArray(U))return U}function T(U,F){if(U==null)return{};var W=p(U,F),M,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(I=0;I<H.length;I++){if(M=H[I],F.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function p(U,F){if(U==null)return{};var W={},M=Object.keys(U),I,H;for(H=0;H<M.length;H++){if(I=M[H],F.indexOf(I)>=0)continue;W[I]=U[I]}return W}var c=0;function s(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function x(U,F,W,M){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-M/2,ee=0,ae=-X,be=0,pe=-2*X;switch(H){case"left":ee=-X,ae=0,be=2*X,pe=0;break;case"right":ee=X,ae=0,be=-2*X,pe=0;break;case"bottom":ae=X,pe=2*X;break;default:}var ue="M 50,50 m ".concat(ee,",").concat(ae,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(be,",").concat(-pe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-be,",").concat(pe),se=Math.PI*2*X,fe={stroke:W,strokeDasharray:"".concat(F/100*(se-I),"px ").concat(se,"px"),strokeDashoffset:"-".concat(I/2+U/100*(se-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ue,pathStyle:fe}}var y=function(F){var W=F.prefixCls,M=F.strokeWidth,I=F.trailWidth,H=F.gapDegree,X=F.gapPosition,ee=F.trailColor,ae=F.strokeLinecap,be=F.style,pe=F.className,ue=F.strokeColor,se=F.percent,fe=T(F,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(q.useMemo)(function(){return c+=1,c},[]),me=x(0,100,ee,M,H,X),Q=me.pathString,ie=me.pathStyle,te=a(se),Ee=a(ue),_e=Ee.find(function(Re){return Object.prototype.toString.call(Re)==="[object Object]"}),ye=O(te),ve=l(ye,1),Te=ve[0],De=function(){var Ce=0;return te.map(function(Le,ze){var Ve=Ee[ze]||Ee[Ee.length-1],Be=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",je=x(Ce,Le,Ve,M,H,X);return Ce+=Le,z.a.createElement("path",{key:ze,className:"".concat(W,"-circle-path"),d:je.pathString,stroke:Be,strokeLinecap:ae,strokeWidth:M,opacity:Le===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:Te[ze]})})};return z.a.createElement("svg",o({className:K()("".concat(W,"-circle"),pe),viewBox:"0 0 100 100",style:be},fe),_e&&z.a.createElement("defs",null,z.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(_e).sort(function(Re,Ce){return s(Re)-s(Ce)}).map(function(Re,Ce){return z.a.createElement("stop",{key:Ce,offset:Re,stopColor:_e[Re]})}))),z.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:Q,stroke:ee,strokeLinecap:ae,strokeWidth:I||M,fillOpacity:"0",style:ie}),De().reverse())};y.defaultProps=N;var m=y,D={Line:d,Circle:m}},kSUc:function(Ze,We,J){},lZu9:function(Ze,We,J){(function(q){q(J("VrN/"),J("1eCo"),J("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(z,L){var K=q.getMode(z,"text/html"),N=K.name=="null";function O(M){if(q.findModeByName){var I=q.findModeByName(M);I&&(M=I.mime||I.mimes[0])}var H=q.getMode(z,M);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.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 k in B)B.hasOwnProperty(k)&&L.tokenTypeOverrides[k]&&(B[k]=L.tokenTypeOverrides[k]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,S=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,h=/^\[(x| )\](?=\s)/i,b=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,g=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(M,I,H){return I.f=I.inline=H,H(M,I)}function u(M,I,H){return I.f=I.block=H,H(M,I)}function C(M){return!M||!/\S/.test(M.string)}function E(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==A){var I=N;if(!I){var H=q.innerMode(K,M.htmlState);I=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}I&&(M.f=s,M.block=f,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function f(M,I){var H=M.column()===I.indentation,X=C(I.prevLine.stream),ee=I.indentedCode,ae=I.prevLine.hr,be=I.list!==!1,pe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var ue=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,be)){for(I.list=null;ue<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=ue-I.listStack[I.listStack.length-1])}var se=!X&&!ae&&!I.prevLine.header&&(!be||!ee)&&!I.prevLine.fencedCodeEnd,fe=(I.list===!1||ae||X)&&I.indentation<=pe&&M.match(R),ne=null;if(I.indentationDiff>=4&&(ee||I.prevLine.fencedCodeEnd||I.prevLine.header||X))return M.skipToEnd(),I.indentedCode=!0,B.code;if(M.eatSpace())return null;if(H&&I.indentation<=pe&&(ne=M.match(b))&&ne[1].length<=6)return I.quote=0,I.header=ne[1].length,I.thisLine.header=!0,L.highlightFormatting&&(I.formatting="header"),I.f=I.inline,p(I);if(I.indentation<=pe&&M.eat(">"))return I.quote=H?1:I.quote+1,L.highlightFormatting&&(I.formatting="quote"),M.eatSpace(),p(I);if(!fe&&!I.setext&&H&&I.indentation<=pe&&(ne=M.match(S))){var me=ne[1]?"ol":"ul";return I.indentation=ue+M.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,L.taskLists&&M.match(h,!1)&&(I.taskList=!0),I.f=I.inline,L.highlightFormatting&&(I.formatting=["list","list-"+me]),p(I)}else{if(H&&I.indentation<=pe&&(ne=M.match(g,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ne[1]+"+ *$"),I.localMode=L.fencedCodeBlockHighlighting&&O(ne[2]||L.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=q.startState(I.localMode)),I.f=I.block=T,L.highlightFormatting&&(I.formatting="code-block"),I.code=-1,p(I);if(I.setext||(!se||!be)&&!I.quote&&I.list===!1&&!I.code&&!fe&&!v.test(M.string)&&(ne=M.lookAhead(1))&&(ne=ne.match(P)))return I.setext?(I.header=I.setext,I.setext=0,M.skipToEnd(),L.highlightFormatting&&(I.formatting="header")):(I.header=ne[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,p(I);if(fe)return M.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,B.hr;if(M.peek()==="[")return l(M,I,D)}return l(M,I,I.inline)}function A(M,I){var H=K.token(M,I.htmlState);if(!N){var X=q.innerMode(K,I.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||I.md_inside&&M.current().indexOf(">")>-1)&&(I.f=s,I.block=f,I.htmlState=null)}return H}function T(M,I){var H=I.listStack[I.listStack.length-1]||0,X=I.indentation<H,ee=H+3;if(I.fencedEndRE&&I.indentation<=ee&&(X||M.match(I.fencedEndRE))){L.highlightFormatting&&(I.formatting="code-block");var ae;return X||(ae=p(I)),I.localMode=I.localState=null,I.block=f,I.f=s,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,X?u(M,I,I.block):ae}else return I.localMode?I.localMode.token(M,I.localState):(M.skipToEnd(),B.code)}function p(M){var I=[];if(M.formatting){I.push(B.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var H=0;H<M.formatting.length;H++)I.push(B.formatting+"-"+M.formatting[H]),M.formatting[H]==="header"&&I.push(B.formatting+"-"+M.formatting[H]+"-"+M.header),M.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?I.push(B.formatting+"-"+M.formatting[H]+"-"+M.quote):I.push("error"))}if(M.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(M.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(M.linkHref?I.push(B.linkHref,"url"):(M.strong&&I.push(B.strong),M.em&&I.push(B.em),M.strikethrough&&I.push(B.strikethrough),M.emoji&&I.push(B.emoji),M.linkText&&I.push(B.linkText),M.code&&I.push(B.code),M.image&&I.push(B.image),M.imageAltText&&I.push(B.imageAltText,"link"),M.imageMarker&&I.push(B.imageMarker)),M.header&&I.push(B.header,B.header+"-"+M.header),M.quote&&(I.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?I.push(B.quote+"-"+M.quote):I.push(B.quote+"-"+L.maxBlockquoteDepth)),M.list!==!1){var X=(M.listStack.length-1)%3;X?X===1?I.push(B.list2):I.push(B.list3):I.push(B.list1)}return M.trailingSpaceNewLine?I.push("trailing-space-new-line"):M.trailingSpace&&I.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function c(M,I){return M.match(w,!0)?p(I):void 0}function s(M,I){var H=I.text(M,I);if(typeof H!="undefined")return H;if(I.list)return I.list=null,p(I);if(I.taskList){var X=M.match(h,!0)[1]===" ";return X?I.taskOpen=!0:I.taskClosed=!0,L.highlightFormatting&&(I.formatting="task"),I.taskList=!1,p(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&M.match(/^#+$/,!0))return L.highlightFormatting&&(I.formatting="header"),p(I);var ee=M.next();if(I.linkTitle){I.linkTitle=!1;var ae=ee;ee==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(M.match(new RegExp(be),!0))return B.linkHref}if(ee==="`"){var pe=I.formatting;L.highlightFormatting&&(I.formatting="code"),M.eatWhile("`");var ue=M.current().length;if(I.code==0&&(!I.quote||ue==1))return I.code=ue,p(I);if(ue==I.code){var se=p(I);return I.code=0,se}else return I.formatting=pe,p(I)}else if(I.code)return p(I);if(ee==="\\"&&(M.next(),L.highlightFormatting)){var fe=p(I),ne=B.formatting+"-escape";return fe?fe+" "+ne:ne}if(ee==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(ee==="["&&I.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(ee==="]"&&I.imageAltText){L.highlightFormatting&&(I.formatting="image");var fe=p(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=x,fe}if(ee==="["&&!I.image)return I.linkText&&M.match(/^.*?\]/)||(I.linkText=!0,L.highlightFormatting&&(I.formatting="link")),p(I);if(ee==="]"&&I.linkText){L.highlightFormatting&&(I.formatting="link");var fe=p(I);return I.linkText=!1,I.inline=I.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?x:s,fe}if(ee==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var fe=p(I);return fe?fe+=" ":fe="",fe+B.linkInline}if(ee==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var fe=p(I);return fe?fe+=" ":fe="",fe+B.linkEmail}if(L.xml&&ee==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=M.string.indexOf(">",M.pos);if(me!=-1){var Q=M.string.substring(M.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Q)&&(I.md_inside=!0)}return M.backUp(1),I.htmlState=q.startState(K),u(M,I,A)}if(L.xml&&ee==="<"&&M.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ie=1,te=M.pos==1?" ":M.string.charAt(M.pos-2);ie<3&&M.eat(ee);)ie++;var Ee=M.peek()||" ",_e=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(te)||d.test(te)),ye=!/\s/.test(te)&&(!d.test(te)||/\s/.test(Ee)||d.test(Ee)),ve=null,Te=null;if(ie%2&&(!I.em&&_e&&(ee==="*"||!ye||d.test(te))?ve=!0:I.em==ee&&ye&&(ee==="*"||!_e||d.test(Ee))&&(ve=!1)),ie>1&&(!I.strong&&_e&&(ee==="*"||!ye||d.test(te))?Te=!0:I.strong==ee&&ye&&(ee==="*"||!_e||d.test(Ee))&&(Te=!1)),Te!=null||ve!=null){L.highlightFormatting&&(I.formatting=ve==null?"strong":Te==null?"em":"strong em"),ve===!0&&(I.em=ee),Te===!0&&(I.strong=ee);var se=p(I);return ve===!1&&(I.em=!1),Te===!1&&(I.strong=!1),se}}else if(ee===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return p(I);M.backUp(1)}if(L.strikethrough){if(ee==="~"&&M.eatWhile(ee)){if(I.strikethrough){L.highlightFormatting&&(I.formatting="strikethrough");var se=p(I);return I.strikethrough=!1,se}else if(M.match(/^[^\s]/,!1))return I.strikethrough=!0,L.highlightFormatting&&(I.formatting="strikethrough"),p(I)}else if(ee===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return p(I);M.backUp(2)}}if(L.emoji&&ee===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,L.highlightFormatting&&(I.formatting="emoji");var De=p(I);return I.emoji=!1,De}return ee===" "&&(M.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),p(I)}function a(M,I){var H=M.next();if(H===">"){I.f=I.inline=s,L.highlightFormatting&&(I.formatting="link");var X=p(I);return X?X+=" ":X="",X+B.linkInline}return M.match(/^[^>]+/,!0),B.linkInline}function x(M,I){if(M.eatSpace())return null;var H=M.next();return H==="("||H==="["?(I.f=I.inline=m(H==="("?")":"]"),L.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,p(I)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function m(M){return function(I,H){var X=I.next();if(X===M){H.f=H.inline=s,L.highlightFormatting&&(H.formatting="link-string");var ee=p(H);return H.linkHref=!1,ee}return I.match(y[M]),H.linkHref=!0,p(H)}}function D(M,I){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=U,M.next(),L.highlightFormatting&&(I.formatting="link"),I.linkText=!0,p(I)):l(M,I,s)}function U(M,I){if(M.match(/^\]:/,!0)){I.f=I.inline=F,L.highlightFormatting&&(I.formatting="link");var H=p(I);return I.linkText=!1,H}return M.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function F(M,I){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?I.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=s,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:s,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(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&q.copyState(K,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?q.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,I){if(I.formatting=!1,M!=I.thisLine.stream){if(I.header=0,I.hr=!1,M.match(/^\s*$/,!0))return E(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:M},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=A)){var H=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=H,I.indentationDiff=null,H>0)return null}}return I.f(M,I)},innerMode:function(M){return M.block==A?{state:M.htmlState,mode:K}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:W}},indent:function(M,I,H){return M.block==A&&K.indent?K.indent(M.htmlState,I,H):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,I,H):q.Pass},blankLine:E,getType:p,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},nVVt:function(Ze,We){Ze.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(Ze,We,J){(function(q){q(J("VrN/"))})(function(q){"use strict";var z=q.Pos;function L(d,o){return d.line-o.line||d.ch-o.ch}var K="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",N=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+K+"]["+N+"]*)","g");function B(d,o,l,u){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function k(d,o){var l=d.cm.getTokenTypeAt(z(d.line,o));return l&&/\btag\b/.test(l)}function R(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function S(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function h(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(R(d))continue;return}if(!k(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function b(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(S(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}O.lastIndex=o,d.ch=o;var l=O.exec(d.text);if(l&&l.index==o)return l}}function P(d){for(;;){O.lastIndex=d.ch;var o=O.exec(d.text);if(!o){if(R(d))continue;return}if(!k(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function w(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(S(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function g(d,o){for(var l=[];;){var u=P(d),C,E=d.line,f=d.ch-(u?u[0].length:0);if(!u||!(C=h(d)))return;if(C=="selfClose")continue;if(u[1]){for(var A=l.length-1;A>=0;--A)if(l[A]==u[2]){l.length=A;break}if(A<0&&(!o||o==u[2]))return{tag:u[2],from:z(E,f),to:z(d.line,d.ch)}}else l.push(u[2])}}function v(d,o){for(var l=[];;){var u=w(d);if(!u)return;if(u=="selfClose"){b(d);continue}var C=d.line,E=d.ch,f=b(d);if(!f)return;if(f[1])l.push(f[2]);else{for(var A=l.length-1;A>=0;--A)if(l[A]==f[2]){l.length=A;break}if(A<0&&(!o||o==f[2]))return{tag:f[2],from:z(d.line,d.ch),to:z(C,E)}}}}q.registerHelper("fold","xml",function(d,o){for(var l=new B(d,o.line,0);;){var u=P(l);if(!u||l.line!=o.line)return;var C=h(l);if(!C)return;if(!u[1]&&C!="selfClose"){var E=z(l.line,l.ch),f=g(l,u[2]);return f&&L(f.from,E)>0?{from:E,to:f.from}:null}}}),q.findMatchingTag=function(d,o,l){var u=new B(d,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=h(u),E=C&&z(u.line,u.ch),f=C&&b(u);if(!C||!f||L(u,o)>0)return;var A={from:z(u.line,u.ch),to:E,tag:f[2]};return C=="selfClose"?{open:A,close:null,at:"open"}:f[1]?{open:v(u,f[2]),close:A,at:"close"}:(u=new B(d,E.line,E.ch,l),{open:A,close:g(u,f[2]),at:"open"})},q.findEnclosingTag=function(d,o,l,u){for(var C=new B(d,o.line,o.ch,l);;){var E=v(C,u);if(!E)break;var f=new B(d,o.line,o.ch,l),A=g(f,E.tag);if(A)return{open:E,close:A}}},q.scanForClosingTag=function(d,o,l,u){var C=new B(d,o.line,o.ch,u?{from:0,to:u}:null);return g(C,l)}})},p5ED:function(Ze,We,J){"use strict";var q=J("+L6B"),z=J("2/Rp"),L=J("5Dmo"),K=J("3S7+"),N=J("k1fw"),O=J("tJVT"),B=J("cDcd"),k=J.n(B),R=J("vHTk"),S=J.n(R),h=J("yEEn"),b=J("ZW9T"),P=J("1vsH");We.a=function(w){var g=w.name,v=w.data,d=w.theme,o=w.type,l=w.filename,u=w.monacoEditor,C=w.className,E=w.style,f=w.close,A=w.onClose,T=w.hasMask,p=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(O.a)(p,2),s=c[0],a=c[1],x=Object(B.useState)(""),y=Object(O.a)(x,2),m=y[0],D=y[1],U,F=1024*1024,W=10*F,M=Object(B.useRef)();o==="office"&&(U=Object(P.V)(v).filesize,U>W&&(o="other")),l&&(u.filename=l),Object(B.useEffect)(function(){var X,ee,ae=(X=document.cookie)===null||X===void 0||((ee=X.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");ae==null||ae.map(function(be){var pe=be.split("=");pe[0]==="_educoder_session"&&D(pe[1])})},[]);var I=function(){if(v.startsWith("http")||v.startsWith("blob:")){H();return}Object(P.z)(l||"educoder",v,l)},H=function(){Object(P.x)(l||"educoder",decodeURIComponent(v))};return console.log("data:",v,"fileanme:",l," name:",g),k.a.createElement("div",{style:Object(N.a)({},E||{}),className:"".concat(T&&S.a.bgBlack," ").concat(o?S.a.wrp:"hide")},f&&k.a.createElement("div",{className:S.a.close,ref:M},k.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return M.current}},k.a.createElement("span",{onClick:H},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return M.current}},k.a.createElement("span",{className:"",onClick:A},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(S.a[C]," ").concat(C," ").concat(S.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(b.b,u)),o==="audio"&&k.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,v!=null&&v.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&k.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="html"&&k.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&k.a.createElement("embed",{className:S.a.embed,src:v}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(z.a,{type:"primary",size:"large",onClick:I},k.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(z.a,{type:"primary",size:"large",onClick:I},k.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Ze,We,J){},"rAM+":function(Ze,We,J){"use strict";J.d(We,"a",function(){return z});var q=J("Qw5x");function z(L,K){var N;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(N=Object(q.a)(L))||K&&L&&typeof L.length=="number"){N&&(L=N);var O=0,B=function(){};return{s:B,n:function(){return O>=L.length?{done:!0}:{done:!1,value:L[O++]}},e:function(b){throw b},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 k=!0,R=!1,S;return{s:function(){N=L[Symbol.iterator]()},n:function(){var b=N.next();return k=b.done,b},e:function(b){R=!0,S=b},f:function(){try{!k&&N.return!=null&&N.return()}finally{if(R)throw S}}}}},rUJ1:function(Ze,We){const J=/[&<>"']/,q=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},N=T=>K[T];function O(T,p){if(p){if(J.test(T))return T.replace(q,N)}else if(z.test(T))return T.replace(L,N);return T}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(T){return T.replace(B,(p,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 R=/(^|[^\[])\^/g;function S(T,p){T=T.source||T,p=p||"";const c={replace:(s,a)=>(a=a.source||a,a=a.replace(R,"$1"),T=T.replace(s,a),c),getRegex:()=>new RegExp(T,p)};return c}const h=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,p,c){if(T){let s;try{s=decodeURIComponent(k(c)).replace(h,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}p&&!b.test(c)&&(c=o(p,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(s){return null}return c}const w={},g=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(T,p){w[" "+T]||(g.test(T)?w[" "+T]=T+"/":w[" "+T]=E(T,"/",!0)),T=w[" "+T];const c=T.indexOf(":")===-1;return p.substring(0,2)==="//"?c?p:T.replace(v,"$1")+p:p.charAt(0)==="/"?c?p:T.replace(d,"$1")+p:T+p}const l={exec:function(){}};function u(T){let p=1,c,s;for(;p<arguments.length;p++){c=arguments[p];for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(T[s]=c[s])}return T}function C(T,p){const c=T.replace(/\|/g,(x,y,m)=>{let D=!1,U=y;for(;--U>=0&&m[U]==="\\";)D=!D;return D?"|":" |"}),s=c.split(/ \|/);let a=0;if(s.length>p)s.splice(p);else for(;s.length<p;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function E(T,p,c){const s=T.length;if(s===0)return"";let a=0;for(;a<s;){const x=T.charAt(s-a-1);if(x===p&&!c)a++;else if(x!==p&&c)a++;else break}return T.substr(0,s-a)}function f(T,p){if(T.indexOf(p[1])===-1)return-1;const c=T.length;let s=0,a=0;for(;a<c;a++)if(T[a]==="\\")a++;else if(T[a]===p[0])s++;else if(T[a]===p[1]&&(s--,s<0))return a;return-1}function A(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Ze.exports={escape:O,unescape:k,edit:S,cleanUrl:P,resolveUrl:o,noopTest:l,merge:u,splitCells:C,rtrim:E,findClosingBracket:f,checkSanitizeDeprecation:A}},rcnY:function(Ze,We,J){var q=J("aRTE");function z(L,K){this.totalCount=L,this.dataCount=K}z.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],z.getRSBlocks=function(L,K){var N=z.getRsBlockTable(L,K);if(N==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+K);for(var O=N.length/3,B=new Array,k=0;k<O;k++)for(var R=N[k*3+0],S=N[k*3+1],h=N[k*3+2],b=0;b<R;b++)B.push(new z(S,h));return B},z.getRsBlockTable=function(L,K){switch(K){case q.L:return z.RS_BLOCK_TABLE[(L-1)*4+0];case q.M:return z.RS_BLOCK_TABLE[(L-1)*4+1];case q.Q:return z.RS_BLOCK_TABLE[(L-1)*4+2];case q.H:return z.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},Ze.exports=z},ulZh:function(Ze,We,J){typeof window!="undefined"&&function(z,L){Ze.exports=L()}(this,function(){return function(q){var z={};function L(K){if(z[K])return z[K].exports;var N=z[K]={i:K,l:!1,exports:{}};return q[K].call(N.exports,N,N.exports,L),N.l=!0,N.exports}return L.m=q,L.c=z,L.d=function(K,N,O){L.o(K,N)||Object.defineProperty(K,N,{enumerable:!0,get:O})},L.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},L.t=function(K,N){if(N&1&&(K=L(K)),N&8)return K;if(N&4&&typeof K=="object"&&K&&K.__esModule)return K;var O=Object.create(null);if(L.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:K}),N&2&&typeof K!="string")for(var B in K)L.d(O,B,function(k){return K[k]}.bind(null,B));return O},L.n=function(K){var N=K&&K.__esModule?function(){return K.default}:function(){return K};return L.d(N,"a",N),N},L.o=function(K,N){return Object.prototype.hasOwnProperty.call(K,N)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,z,L){"use strict";var K=Object.prototype.hasOwnProperty,N="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(N=!1));function B(h,b,P){this.fn=h,this.context=b,this.once=P||!1}function k(h,b,P,w,g){if(typeof P!="function")throw new TypeError("The listener must be a function");var v=new B(P,w||h,g),d=N?N+b:b;return h._events[d]?h._events[d].fn?h._events[d]=[h._events[d],v]:h._events[d].push(v):(h._events[d]=v,h._eventsCount++),h}function R(h,b){--h._eventsCount===0?h._events=new O:delete h._events[b]}function S(){this._events=new O,this._eventsCount=0}S.prototype.eventNames=function(){var b=[],P,w;if(this._eventsCount===0)return b;for(w in P=this._events)K.call(P,w)&&b.push(N?w.slice(1):w);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(P)):b},S.prototype.listeners=function(b){var P=N?N+b:b,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var g=0,v=w.length,d=new Array(v);g<v;g++)d[g]=w[g].fn;return d},S.prototype.listenerCount=function(b){var P=N?N+b:b,w=this._events[P];return w?w.fn?1:w.length:0},S.prototype.emit=function(b,P,w,g,v,d){var o=N?N+b:b;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,C,E;if(l.fn){l.once&&this.removeListener(b,l.fn,void 0,!0);switch(u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,P),!0;case 3:return l.fn.call(l.context,P,w),!0;case 4:return l.fn.call(l.context,P,w,g),!0;case 5:return l.fn.call(l.context,P,w,g,v),!0;case 6:return l.fn.call(l.context,P,w,g,v,d),!0}for(E=1,C=new Array(u-1);E<u;E++)C[E-1]=arguments[E];l.fn.apply(l.context,C)}else{var f=l.length,A;for(E=0;E<f;E++){l[E].once&&this.removeListener(b,l[E].fn,void 0,!0);switch(u){case 1:l[E].fn.call(l[E].context);break;case 2:l[E].fn.call(l[E].context,P);break;case 3:l[E].fn.call(l[E].context,P,w);break;case 4:l[E].fn.call(l[E].context,P,w,g);break;default:if(!C)for(A=1,C=new Array(u-1);A<u;A++)C[A-1]=arguments[A];l[E].fn.apply(l[E].context,C)}}}return!0},S.prototype.on=function(b,P,w){return k(this,b,P,w,!1)},S.prototype.once=function(b,P,w){return k(this,b,P,w,!0)},S.prototype.removeListener=function(b,P,w,g){var v=N?N+b:b;if(!this._events[v])return this;if(!P)return R(this,v),this;var d=this._events[v];if(d.fn)d.fn===P&&(!g||d.once)&&(!w||d.context===w)&&R(this,v);else{for(var o=0,l=[],u=d.length;o<u;o++)(d[o].fn!==P||g&&!d[o].once||w&&d[o].context!==w)&&l.push(d[o]);l.length?this._events[v]=l.length===1?l[0]:l:R(this,v)}return this},S.prototype.removeAllListeners=function(b){var P;return b?(P=N?N+b:b,this._events[P]&&R(this,P)):(this._events=new O,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=N,S.EventEmitter=S,q.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,z,L){(function(K){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(S,h,b){if(b=b||{},S=S.trim(),h=h.trim(),!h){if(!b.alwaysNormalize)return S;var P=R.parseURL(S);if(!P)throw new Error("Error trying to parse base URL.");return P.path=R.normalizePath(P.path),R.buildURLFromParts(P)}var w=R.parseURL(h);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return b.alwaysNormalize?(w.path=R.normalizePath(w.path),R.buildURLFromParts(w)):h;var g=R.parseURL(S);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var v=O.exec(g.path);g.netLoc=v[1],g.path=v[2]}g.netLoc&&!g.path&&(g.path="/");var d={scheme:g.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(d.netLoc=g.netLoc,w.path[0]!=="/"))if(!w.path)d.path=g.path,w.params||(d.params=g.params,w.query||(d.query=g.query));else{var o=g.path,l=o.substring(0,o.lastIndexOf("/")+1)+w.path;d.path=R.normalizePath(l)}return d.path===null&&(d.path=b.alwaysNormalize?R.normalizePath(w.path):w.path),R.buildURLFromParts(d)},parseURL:function(S){var h=N.exec(S);return h?{scheme:h[1]||"",netLoc:h[2]||"",path:h[3]||"",params:h[4]||"",query:h[5]||"",fragment:h[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(B,"");S.length!==(S=S.replace(k,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};q.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(q,z,L){function K(b){var P={};function w(v){if(P[v])return P[v].exports;var d=P[v]={i:v,l:!1,exports:{}};return b[v].call(d.exports,d,d.exports,w),d.l=!0,d.exports}w.m=b,w.c=P,w.i=function(v){return v},w.d=function(v,d,o){w.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},w.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},w.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return w.d(d,"a",d),d},w.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},w.p="/",w.oe=function(v){throw console.error(v),v};var g=w(w.s=ENTRY_MODULE);return g.default||g}var N="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function B(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(b){return!isNaN(1*b)}function R(b,P,w){var g={};g[w]=[];var v=P.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return g;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+B(o)+O,"g"),u;u=l.exec(v);){if(u[3]==="dll-reference")continue;g[w].push(u[3])}for(l=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+O,"g");u=l.exec(v);)b[u[2]]||(g[w].push(u[1]),b[u[2]]=L(u[1]).m),g[u[2]]=g[u[2]]||[],g[u[2]].push(u[4]);for(var C=Object.keys(g),E=0;E<C.length;E++)for(var f=0;f<g[C[E]].length;f++)k(g[C[E]][f])&&(g[C[E]][f]=1*g[C[E]][f]);return g}function S(b){var P=Object.keys(b);return P.reduce(function(w,g){return w||b[g].length>0},!1)}function h(b,P){for(var w={main:[P]},g={main:[]},v={main:{}};S(w);)for(var d=Object.keys(w),o=0;o<d.length;o++){var l=d[o],u=w[l],C=u.pop();if(v[l]=v[l]||{},v[l][C]||!b[l][C])continue;v[l][C]=!0,g[l]=g[l]||[],g[l].push(C);for(var E=R(b,b[l][C],l),f=Object.keys(E),A=0;A<f.length;A++)w[f[A]]=w[f[A]]||[],w[f[A]]=w[f[A]].concat(E[f[A]])}return g}q.exports=function(b,P){P=P||{};var w={main:L.m},g=P.all?{main:Object.keys(w.main)}:h(w,b),v="";Object.keys(g).filter(function(C){return C!=="main"}).forEach(function(C){for(var E=0;g[C][E];)E++;g[C].push(E),w[C][E]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+C+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(E))+")({"+g[C].map(function(f){return""+JSON.stringify(f)+": "+w[C][f].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+g.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(P.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return A}),L.d(z,"mergeConfig",function(){return p}),L.d(z,"enableStreamingMode",function(){return c});var K=L("./src/controller/abr-controller.ts"),N=L("./src/controller/audio-stream-controller.ts"),O=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),k=L("./src/controller/subtitle-track-controller.ts"),R=L("./src/controller/buffer-controller.ts"),S=L("./src/controller/timeline-controller.ts"),h=L("./src/controller/cap-level-controller.ts"),b=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),g=L("./src/utils/xhr-loader.ts"),v=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),l=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(s[y]=x[y])}return s},u.apply(this,arguments)}function C(s,a){var x=Object.keys(s);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(s);a&&(y=y.filter(function(m){return Object.getOwnPropertyDescriptor(s,m).enumerable})),x.push.apply(x,y)}return x}function E(s){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?C(Object(x),!0).forEach(function(y){f(s,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(y){Object.defineProperty(s,y,Object.getOwnPropertyDescriptor(x,y))})}return s}function f(s,a,x){return a in s?Object.defineProperty(s,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):s[a]=x,s}var A=E(E({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:g.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:R.default,capLevelController:h.default,fpsController:b.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:k.default,timelineController:S.TimelineController,audioStreamController:N.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function T(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function p(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},s,a)}function c(s){var a=s.loader;if(a!==v.default&&a!==g.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var x=Object(v.fetchSupported)();x&&(s.loader=v.default,s.progressive=!0,s.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),N=L("./src/utils/ewma-bandwidth-estimator.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),R=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts");function h(w,g){for(var v=0;v<g.length;v++){var d=g[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function b(w,g,v){return g&&h(w.prototype,g),v&&h(w,v),w}var P=function(){function w(v){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=v;var d=v.config;this.bwEstimator=new N.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var g=w.prototype;return g.registerListeners=function(){var d=this.hls;d.on(O.Events.FRAG_LOADING,this.onFragLoading,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var d=this.hls;d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},g.onFragLoading=function(d,o){var l=o.frag;if(l.type===R.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},g.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},g._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,C=l.config,E=l.media;if(!d||!E)return;var f=o?o.stats:d.stats,A=o?o.duration:d.duration;if(f.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||E.paused||!E.playbackRate||!E.readyState)return;var T=performance.now()-f.loading.start,p=Math.abs(E.playbackRate);if(T<=500*A/p)return;var c=l.levels,s=l.minAutoLevel,a=c[d.level],x=f.total||Math.max(f.loaded,Math.round(A*a.maxBitrate/8)),y=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/T),m=(x-f.loaded)/y,D=E.currentTime,U=(B.BufferHelper.bufferInfo(E,D,C.maxBufferHole).end-D)/p;if(U>=2*A/p||m<=U)return;var F=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>s;W--){var M=c[W].maxBitrate;if(F=A*M/(8*.8*y),F<U)break}if(F>=m)return;var I=this.bwEstimator.getEstimate();S.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(K.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+m.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+F.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=W,this.bwEstimator.sample(T,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},g.onFragLoaded=function(d,o){var l=o.frag,u=o.part;if(l.type===R.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(l.sn)){var C=u?u.stats:l.stats,E=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],A=(f.loaded?f.loaded.bytes:0)+C.loaded,T=(f.loaded?f.loaded.duration:0)+E;f.loaded={bytes:A,duration:T},f.realBitrate=Math.round(8*A/T)}if(l.bitrateTest){var p={stats:C,frag:l,part:u,id:l.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,p),l.bitrateTest=!1}}},g.onFragBuffered=function(d,o){var l=o.frag,u=o.part,C=u?u.stats:l.stats;if(C.aborted)return;if(l.type!==R.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var E=C.parsing.end-C.loading.start;this.bwEstimator.sample(E,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=E/1e3:this.bitrateTestDelay=0},g.onError=function(d,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},g.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},g.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,C=l.config,E=l.minAutoLevel,f=l.media,A=o?o.duration:d?d.duration:0,T=f?f.currentTime:0,p=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,s=(B.BufferHelper.bufferInfo(f,T,C.maxBufferHole).end-T)/p,a=this.findBestLevel(c,E,u,s,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;S.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=A?Math.min(A,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,m=C.abrBandWidthUpFactor;if(!s){var D=this.bitrateTestDelay;if(D){var U=A?Math.min(A,C.maxLoadingDelay):C.maxLoadingDelay;x=U-D,S.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=m=1}}return a=this.findBestLevel(c,E,u,s+x,y,m),Math.max(a,0)},g.findBestLevel=function(d,o,l,u,C,E){for(var f,A=this.fragCurrent,T=this.partCurrent,p=this.lastLoadedFragLevel,c=this.hls.levels,s=c[p],a=!!(s!=null&&(f=s.details)!==null&&f!==void 0&&f.live),x=s==null?void 0:s.codecSet,y=T?T.duration:A?A.duration:0,m=l;m>=o;m--){var D=c[m];if(!D||x&&D.codecSet!==x)continue;var U=D.details,F=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,W=void 0;m<=p?W=C*d:W=E*d;var M=c[m].maxBitrate,I=M*F/W;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(W)+"/"+M+"/"+F+"/"+u+"/"+I),W>M&&(!I||a&&!this.bitrateTestDelay||I<u))return m}return-1},b(w,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),w}();z.default=P},"./src/controller/audio-stream-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),N=L("./src/controller/base-stream-controller.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/level.ts"),S=L("./src/types/loader.ts"),h=L("./src/loader/fragment.ts"),b=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),g=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var p=arguments[T];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(A[c]=p[c])}return A},l.apply(this,arguments)}function u(A,T){A.prototype=Object.create(T.prototype),A.prototype.constructor=A,C(A,T)}function C(A,T){return C=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},C(A,T)}var E=100,f=function(A){u(T,A);function T(c,s){var a;return a=A.call(this,c,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var p=T.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var s=this.hls;s.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(O.Events.ERROR,this.onError,this),s.on(O.Events.BUFFER_RESET,this.onBufferReset,this),s.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var s=this.hls;s.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(O.Events.ERROR,this.onError,this),s.off(O.Events.BUFFER_RESET,this.onBufferReset,this),s.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(s,a){var x=a.frag,y=a.id,m=a.initPTS;if(y==="main"){var D=x.cc;this.initPTS[x.cc]=m,this.log("InitPTS for cc: "+D+" found from main: "+m),this.videoTrackCC=D,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=N.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(E),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},p.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var s,a=this.levels,x=this.trackId,y=a==null||((s=a[x])===null||s===void 0)?void 0:s.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var m,D=performance.now(),U=this.retryDate;(!U||D>=U||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var W=F.frag,M=F.part,I=F.cache,H=F.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var X=I.flush(),ee={frag:W,part:M,payload:X,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&A.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 ae=this.getLoadPosition(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),pe=Object(g.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);pe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},p.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},p.doTickIdle=function(){var s,a,x=this.hls,y=this.levels,m=this.media,D=this.trackId,U=x.config;if(!y||!y[D])return;if(!m&&(this.startFragRequested||!U.startFragPrefetch))return;var F=y[D],W=F.details;if(!W||W.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(W)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,h.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(M===null)return;var I=M.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(I>=H&&!X)return;if(!X&&this._streamEnded(M,W)){x.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var ee=W.fragments,ae=ee[0].start,be=M.end;if(X){var pe=this.getLoadPosition();be=pe,W.PTSKnown&&pe<ae&&((M.end>ae||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=ae+.05))}var ue=this.getNextFragment(be,W);if(!ue){this.bufferFlushed=!0;return}((s=ue.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=ue.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ue,W):this.loadFragment(ue,W,be)},p.getMaxBufferLength=function(){var s=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(s,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new R.Level(y)})},p.onAudioTrackSwitching=function(s,a){var x=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(E):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(s,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(s,a){var x,y=this.levels,m=a.details,D=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var U=y[D],F=0;if(m.live||(x=U.details)!==null&&x!==void 0&&x.live){var W=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!W)return;!U.details&&m.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(m,W),F=m.fragments[0].start):F=this.alignPlaylists(m,U.details)}U.details=m,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(U.details,F),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=N.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(s){var a,x=s.frag,y=s.part,m=s.payload,D=this.config,U=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var W=F[U];console.assert(W,"Audio track is defined on fragment load progress");var M=W.details;console.assert(M,"Audio track details are defined on fragment load progress");var I=D.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[x.cc],ee=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var ae=!1,be=y?y.index:-1,pe=be!==-1,ue=new w.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,m.byteLength,be,pe);H.push(m,ee,I,"",x,y,M.totalduration,ae,ue,X)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+U);var se=this.waitingData=this.waitingData||{frag:x,part:y,cache:new b.default,complete:!1},fe=se.cache;fe.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,s)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(s,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(s,a){var x=a.frag,y=a.part;if(x.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},p.onError=function(s,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(S.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=a.fatal?N.State.ERROR:N.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===N.State.PARSING||this.state===N.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(s,a){var x=a.type;x===h.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(s){var a,x="audio",y=this.hls,m=s.remuxResult,D=s.chunkMeta,U=this.getCurrentContext(D);if(!U){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var F=U.frag,W=U.part,M=m.audio,I=m.text,H=m.id3,X=m.initSegment;if(this.fragContextChanged(F))return;if(this.state=N.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,F,D),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:x,tracks:X.tracks})),M){var ee=M.startPTS,ae=M.endPTS,be=M.startDTS,pe=M.endDTS;W&&(W.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:ae,startDTS:be,endDTS:pe}),F.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,ee,ae,be,pe),this.bufferFragmentData(M,F,W,D)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var ue=l({frag:F,id:x},H);y.trigger(O.Events.FRAG_PARSING_METADATA,ue)}if(I){var se=l({frag:F,id:x},I);y.trigger(O.Events.FRAG_PARSING_USERDATA,se)}},p._bufferInitSegment=function(s,a,x){if(this.state!==N.State.PARSING)return;s.video&&delete s.video;var y=s.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,s);var m=y.initSegment;if(m!=null&&m.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:m};this.hls.trigger(O.Events.BUFFER_APPENDING,D)}this.tick()},p.loadFragment=function(s,a,x){var y=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||y===k.FragmentState.NOT_LOADED||y===k.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(K.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,s,a,x)))},p.completeAudioSwitch=function(){var s=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:x})},T}(N.default);z.default=f},"./src/controller/audio-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function k(P,w){for(var g=0;g<w.length;g++){var v=w[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function R(P,w,g){return w&&k(P.prototype,w),g&&k(P,g),P}function S(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,h(P,w)}function h(P,w){return h=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},h(P,w)}var b=function(P){S(w,P);function w(v){var d;return d=P.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var g=w.prototype;return g.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},g.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},g.onAudioTrackLoaded=function(d,o){var l=o.id,u=o.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var E=C.details;C.details=o.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,E))},g.onLevelLoading=function(d,o){this.switchLevel(o.level)},g.onLevelSwitching=function(d,o){this.switchLevel(o.level)},g.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(E){return!l||E.groupId===l});this.selectDefaultTrack&&!u.some(function(E){return E.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var C={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},g.onError=function(d,o){if(P.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},g.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],C=u.id,E=u.groupId,f=E===void 0?"":E,A=u.name,T=u.type,p=u.url;if(this.trackId=d,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:f,name:A,type:T,url:p}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(c)},g.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},g.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},g.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,C=o.url;if(d)try{C=d.addDirectives(C)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:u,deliveryDirectives:d||null})}},R(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),w}(O.default);z.default=b},"./src/controller/base-playlist-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/polyfills/number.ts"),N=L("./src/types/level.ts"),O=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),R=function(){function S(b,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,P+":"),this.warn=B.logger.warn.bind(B.logger,P+":"),this.hls=b}var h=S.prototype;return h.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},h.onError=function(P,w){w.fatal&&w.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},h.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},h.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},h.stopLoad=function(){this.canLoad=!1,this.clearTimer()},h.switchParams=function(P,w){var g=w==null?void 0:w.renditionReports;if(g)for(var v=0;v<g.length;v++){var d=g[v],o=""+d.URI;if(o===P.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);u!==void 0&&C>w.partTarget&&(u+=1)}if(Object(K.isFiniteNumber)(l))return new N.HlsUrlParameters(l,Object(K.isFiniteNumber)(u)?u:void 0,N.HlsSkip.No)}}},h.loadPlaylist=function(P){},h.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},h.playlistLoaded=function(P,w,g){var v=this,d=w.details,o=w.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||g!=null&&g.live){if(d.reloaded(g),g&&this.log("live playlist "+P+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),g&&d.fragments.length>0&&Object(O.mergeDetails)(g,d),!this.canLoad||!d.live)return;var u,C=void 0,E=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,A=d.lastPartSn,T=d.endSN,p=d.lastPartIndex,c=p!==-1,s=A===T,a=f?0:p;c?(C=s?T+1:A,E=s?a:p+1):C=T+1;var x=d.age,y=x+d.ageHeader,m=Math.min(y-d.partTarget,d.targetduration*1.5);if(m>0){if(g&&m>g.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+g.tuneInGoal+" to: "+m+" with playlist age: "+d.age),m=0;else{var D=Math.floor(m/d.targetduration);if(C+=D,E!==void 0){var U=Math.round(m%d.targetduration/d.partTarget);E+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+m+" skip sn "+D+" to part "+E)}d.tuneInGoal=m}if(u=this.getDeliveryDirectives(d,w.deliveryDirectives,C,E),f||!s){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,w.deliveryDirectives,C,E);var F=Object(O.computeReloadInterval)(d,o);C!==void 0&&d.canBlockReload&&(F-=d.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(u)},F)}else this.clearTimer()},h.getDeliveryDirectives=function(P,w,g,v){var d=Object(N.getSkipValue)(P,g);return w!=null&&w.skip&&P.deltaUpdateFailed&&(g=w.msn,v=w.part,d=N.HlsSkip.No),new N.HlsUrlParameters(g,v,d)},h.retryLoadingOrFail=function(P){var w=this,g=this.hls.config,v=this.retryCount<g.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(d=P.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*g.levelLoadingRetryDelay,g.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return v},S}()},"./src/controller/base-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"State",function(){return T}),L.d(z,"default",function(){return p});var K=L("./src/polyfills/number.ts"),N=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/utils/logger.ts"),R=L("./src/events.ts"),S=L("./src/errors.ts"),h=L("./src/types/transmuxer.ts"),b=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),g=L("./src/controller/level-helper.ts"),v=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),l=L("./src/types/loader.ts");function u(c,s){for(var a=0;a<s.length;a++){var x=s[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function C(c,s,a){return s&&u(c.prototype,s),a&&u(c,a),c}function E(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,s){c.prototype=Object.create(s.prototype),c.prototype.constructor=c,A(c,s)}function A(c,s){return A=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},A(c,s)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},p=function(c){f(s,c);function s(x,y,m){var D;return D=c.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=T.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=m,D.log=k.logger.log.bind(k.logger,m+":"),D.warn=k.logger.warn.bind(k.logger,m+":"),D.hls=x,D.fragmentLoader=new v.default(x.config),D.fragmentTracker=y,D.config=x.config,D.decrypter=new d.default(x,x.config),x.on(R.Events.KEY_LOADED,D.onKeyLoaded,E(D)),D}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},a._streamEnded=function(y,m){var D=this.fragCurrent,U=this.fragmentTracker;if(!m.live&&D&&D.sn===m.endSN&&!y.nextStart){var F=U.getState(D);return F===O.FragmentState.PARTIAL||F===O.FragmentState.OK}return!1},a.onMediaAttached=function(y,m){var D=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var y=this.config,m=this.fragCurrent,D=this.media,U=this.mediaBuffer,F=this.state,W=D?D.currentTime:0,M=B.BufferHelper.bufferInfo(U||D,W,y.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+F),F===T.ENDED)this.resetLoadingState();else if(m&&!M.len){var I=y.maxFragLookUpTolerance,H=m.start-I,X=m.start+m.duration+I,ee=W>X;(W<H||ee)&&(ee&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=W),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,m){if(this.state!==T.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var D=this.levels[m.frag.level].details;D&&this.loadFragment(m.frag,D,m.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(y,m){this.log("Loading key for "+y.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=T.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(R.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,m,D){this._loadFragForPlayback(y,m,D)},a._loadFragForPlayback=function(y,m,D){var U=this,F=function(M){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(M.part?" p: "+M.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(M)};this._doFragLoad(y,m,D,F).then(function(W){if(!W)return;U.fragLoadError=0;var M=U.state;if(U.fragContextChanged(y)){(M===T.FRAG_LOADING||M===T.BACKTRACKING||!U.fragCurrent&&M===T.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=T.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(R.Events.FRAG_LOADED,W),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(y,W),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,m,D){if(D===void 0&&(D=null),!(y-m))return;var U={startOffset:y,endOffset:m,type:D};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(y){var m=this;this._doFragLoad(y).then(function(D){if(!D||m.fragContextChanged(y)||!m.levels)throw new Error("init load aborted");return D}).then(function(D){var U=m.hls,F=D.payload,W=y.decryptdata;if(F&&F.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var M=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(F),W.key.buffer,W.iv.buffer).then(function(I){var H=self.performance.now();return U.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:I,stats:{tstart:M,tdecrypt:H}}),D.payload=I,D})}return D}).then(function(D){var U=m.fragCurrent,F=m.hls,W=m.levels;if(!W)throw new Error("init load aborted, missing levels");var M=W[y.level].details;console.assert(M,"Level details are defined when init segment is loaded");var I=y.stats;m.state=T.IDLE,m.fragLoadError=0,y.data=new Uint8Array(D.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),D.frag===U&&F.trigger(R.Events.FRAG_BUFFERED,{stats:I,frag:U,part:null,id:y.type}),m.tick()}).catch(function(D){m.warn(D),m.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var m=this.fragCurrent;return!y||!m||y.level!==m.level||y.sn!==m.sn||y.urlId!==m.urlId},a.fragBufferedComplete=function(y,m){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(B.BufferHelper.getBuffered(D))),this.state=T.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var m=this.transmuxer;if(!m)return;var D=y.frag,U=y.part,F=y.partsLoaded,W=!F||F.length===0||F.some(function(I){return!I}),M=new h.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,U?U.index:-1,!W);m.flush(M)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,m,D,U){var F=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(y.start,D||0),this.config.lowLatencyMode&&m){var W=m.partList;if(W&&U){D>y.end&&m.fragmentHint&&(y=m.fragmentHint);var M=this.getNextPart(W,y,D);if(M>-1){var I=W[M];return this.log("Loading part sn: "+y.sn+" p: "+I.index+" cc: "+y.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+M+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:W[M],targetBufferTime:D}),this.doFragPartsLoad(y,W,M,U).catch(function(H){return F.handleFragLoadError(H)})}else if(!y.url||this.loadedEndOfParts(W,D))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),Object(K.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:D}),this.fragmentLoader.load(y,U).catch(function(H){return F.handleFragLoadError(H)})},a.doFragPartsLoad=function(y,m,D,U){var F=this;return new Promise(function(W,M){var I=[],H=function X(ee){var ae=m[ee];F.fragmentLoader.loadPart(y,ae,U).then(function(be){I[ae.index]=be;var pe=be.part;F.hls.trigger(R.Events.FRAG_LOADED,be);var ue=m[ee+1];if(ue&&ue.fragment===y)X(ee+1);else return W({frag:y,part:pe,partsLoaded:I})}).catch(M)};H(D)})},a.handleFragLoadError=function(y){var m=y.data;return m&&m.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(R.Events.ERROR,m),null},a._handleTransmuxerFlush=function(y){var m=this.getCurrentContext(y);if(!m||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var D=m.frag,U=m.part,F=m.level,W=self.performance.now();D.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(D,U,F,y.partial)},a.getCurrentContext=function(y){var m=this.levels,D=y.level,U=y.sn,F=y.part;if(!m||!m[D])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+D+". The current chunk will not be buffered."),null;var W=m[D],M=F>-1?Object(g.getPartWith)(W,U,F):null,I=M?M.fragment:Object(g.getFragmentWithSN)(W,U,this.fragCurrent);return I?{frag:I,part:M,level:W}:null},a.bufferFragmentData=function(y,m,D,U){if(!y||this.state!==T.PARSING)return;var F=y.data1,W=y.data2,M=F;if(F&&W&&(M=Object(b.appendUint8Array)(F,W)),!M||!M.length)return;var I={type:y.type,frag:m,part:D,chunkMeta:U,parent:m.type,data:M};this.hls.trigger(R.Events.BUFFER_APPENDING,I),y.dropped&&y.independent&&!D&&this.flushBufferGap(m)},a.flushBufferGap=function(y){var m=this.media;if(!m)return;if(!B.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,y.start);return}var D=m.currentTime,U=B.BufferHelper.bufferInfo(m,D,0),F=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),M=Math.max(Math.min(y.start-W,U.end-W),D+W);y.start-M>W&&this.flushMainBuffer(M,y.start)},a.getFwdBufferInfo=function(y,m){var D=this.config,U=this.getLoadPosition();if(!Object(K.isFiniteNumber)(U))return null;var F=B.BufferHelper.bufferInfo(y,U,D.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,m);if(W&&F.nextStart<W.end)return B.BufferHelper.bufferInfo(y,U,Math.max(F.nextStart,D.maxBufferHole))}return F},a.getMaxBufferLength=function(y){var m=this.config,D;return y?D=Math.max(8*m.maxBufferSize/y,m.maxBufferLength):D=m.maxBufferLength,Math.min(D,m.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var m=this.config,D=y||m.maxBufferLength;return m.maxMaxBufferLength>=D?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,m){var D,U,F=m.fragments,W=F.length;if(!W)return null;var M=this.config,I=F[0].start,H;if(m.live){var X=M.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(m,F),this.startPosition=H?this.hls.liveSyncPosition||H.start:y)}else y<=I&&(H=F[0]);if(!H){var ee=M.lowLatencyMode?m.partEnd:m.fragmentEnd;H=this.getFragmentAtPosition(y,ee,m)}return(D=H)!==null&&D!==void 0&&D.initSegment&&!((U=H)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(y,m,D){for(var U=-1,F=!1,W=!0,M=0,I=y.length;M<I;M++){var H=y[M];if(W=W&&!H.independent,U>-1&&D<H.start)break;var X=H.loaded;!X&&(F||H.independent||W)&&H.fragment===m&&(U=M),F=X}return U},a.loadedEndOfParts=function(y,m){var D=y[y.length-1];return D&&m>D.start&&D.loaded},a.getInitialLiveFragment=function(y,m){var D=this.fragPrevious,U=null;if(D){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),U=Object(w.findFragmentByPDT)(m,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var F=D.sn+1;if(F>=y.startSN&&F<=y.endSN){var W=m[F-y.startSN];D.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(m,D.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(U=this.getFragmentAtPosition(M,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},a.getFragmentAtPosition=function(y,m,D){var U=this.config,F=this.fragPrevious,W=D.fragments,M=D.endSN,I=D.fragmentHint,H=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&D.partList&&I);X&&I&&!this.bitrateTest&&(W=W.concat(I),M=I.sn);var ee;if(y<m){var ae=y>m-H?0:H;ee=Object(w.findFragmentByPTS)(F,W,y,ae)}else ee=W[W.length-1];if(ee){var be=ee.sn-D.startSN,pe=F&&ee.level===F.level,ue=W[be+1],se=this.fragmentTracker.getState(ee);if(se===O.FragmentState.BACKTRACKED){ee=null;for(var fe=be;W[fe]&&this.fragmentTracker.getState(W[fe])===O.FragmentState.BACKTRACKED;)F?ee=W[fe--]:ee=W[--fe];ee||(ee=ue)}else F&&ee.sn===F.sn&&!X&&(pe&&(ee.sn<M&&this.fragmentTracker.getState(ue)!==O.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+ue.sn),ee=ue):ee=null))}return ee},a.synchronizeToLiveEdge=function(y){var m=this.config,D=this.media;if(!D)return;var U=this.hls.liveSyncPosition,F=D.currentTime,W=y.fragments[0].start,M=y.edge,I=F>=W-m.maxFragLookUpTolerance&&F<=M;if(U!==null&&D.duration>U&&(F<U||!I)){var H=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*y.targetduration;(!I&&D.readyState<4||F<M-H)&&(this.loadedmetadata||(this.nextLoadPosition=U),D.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+U.toFixed(3)),D.currentTime=U))}},a.alignPlaylists=function(y,m){var D=this.levels,U=this.levelLastLoaded,F=this.fragPrevious,W=U!==null?D[U]:null,M=y.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var I=y.fragments[0].start,H=!m,X=y.alignedSliding&&Object(K.isFiniteNumber)(I);if(H||!X&&!I){Object(P.alignStream)(F,W,y);var ee=y.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+y.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+M),ee}return I},a.waitForCdnTuneIn=function(y){var m=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*m)},a.setStartPosition=function(y,m){var D=this.startPosition;if(D<m&&(D=-1),D===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(K.isFiniteNumber)(U)?(D=m+U,U<0&&(D+=y.totalduration),D=Math.min(Math.max(m,D),m+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+D),this.startPosition=D):y.live?D=this.hls.liveSyncPosition||m:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var y=this.media,m=0;return this.loadedmetadata&&y?m=y.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},a.handleFragLoadAborted=function(y,m){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(m?" part"+m.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=T.IDLE)},a.onFragmentOrKeyLoadError=function(y,m){if(m.fatal)return;var D=m.frag;if(!D||D.type!==y)return;var U=this.fragCurrent;console.assert(U&&D.sn===U.sn&&D.level===U.level&&D.urlId===U.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+y+" "+D.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(k.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},a.afterBufferFlushed=function(y,m,D){if(!y)return;var U=B.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(m,U,D),this.state===T.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[y].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,m,D,U){var F=this,W=D.details;console.assert(!!W,"level.details must be defined");var M=Object.keys(y.elementaryStreams).reduce(function(I,H){var X=y.elementaryStreams[H];if(X){var ee=X.endPTS-X.startPTS;if(ee<=0)return F.warn("Could not parse fragment "+y.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),I||!1;var ae=U?0:Object(g.updateFragPTSDTS)(W,y,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return F.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:D,drift:ae,type:H,frag:y,start:X.startPTS,end:X.endPTS}),!0}return I},!1);M?(this.state=T.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:y,part:m})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(s,[{key:"state",get:function(){return this._state},set:function(y){var m=this._state;m!==y&&(this._state=y,this.log(m+"->"+y))}}]),s}(N.default)},"./src/controller/buffer-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),k=L("./src/utils/buffer-helper.ts"),R=L("./src/utils/mediasource-helper.ts"),S=L("./src/loader/fragment.ts"),h=L("./src/controller/buffer-operation-queue.ts"),b=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function g(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,C=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(N.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=g.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(N.Events.BUFFER_RESET,this.onBufferReset,this),o.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(N.Events.BUFFER_EOS,this.onBufferEos,this),o.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(N.Events.FRAG_PARSED,this.onFragParsed,this),o.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(N.Events.BUFFER_RESET,this.onBufferReset,this),o.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(N.Events.BUFFER_EOS,this.onBufferEos,this),o.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(N.Events.FRAG_PARSED,this.onFragParsed,this),o.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new h.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&b){var C=this.mediaSource=new b;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},v.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(O.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){O.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):O.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(N.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(C){O.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,l){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(E){if(C){var f=u.tracks[E];if(f&&typeof f.buffer.changeType=="function"){var A=l[E],T=A.codec,p=A.levelCodec,c=A.container,s=(f.levelCodec||f.codec).replace(P,"$1"),a=(p||T).replace(P,"$1");if(s!==a){var x=c+";codecs="+(p||T);u.appendChangeType(E,x)}}}else u.pendingTracks[E]=l[E]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,l){var u=this,C=this.operationQueue,E={execute:function(){var A=u.sourceBuffer[o];A&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),A.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};C.append(E,o)},v.onBufferAppending=function(o,l){var u=this,C=this.hls,E=this.operationQueue,f=this.tracks,A=l.data,T=l.type,p=l.frag,c=l.part,s=l.chunkMeta,a=s.buffering[T],x=self.performance.now();a.start=x;var y=p.stats.buffering,m=c?c.stats.buffering:null;y.start===0&&(y.start=x),m&&m.start===0&&(m.start=x);var D=f.audio,U=T==="audio"&&s.id===1&&(D==null?void 0:D.container)==="audio/mpeg",F={execute:function(){if(a.executeStart=self.performance.now(),U){var M=u.sourceBuffer[T];if(M){var I=p.start-M.timestampOffset;Math.abs(I)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+I+") sn: "+p.sn+")"),M.timestampOffset=p.start)}}u.appendExecutor(A,T)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,y.first===0&&(y.first=M),m&&m.first===0&&(m.first=M);var I=u.sourceBuffer,H={};for(var X in I)H[X]=k.BufferHelper.getBuffered(I[X]);u.appendError=0,u.hls.trigger(N.Events.BUFFER_APPENDED,{type:T,frag:p,part:c,chunkMeta:s,parent:p.type,timeRanges:H})},onError:function(M){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",M);var I={type:B.ErrorTypes.MEDIA_ERROR,parent:p.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,I.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),C.trigger(N.Events.ERROR,I)}};E.append(F,T)},v.onBufferFlushing=function(o,l){var u=this,C=this.operationQueue,E=function(A){return{execute:u.removeExecutor.bind(u,A,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(N.Events.BUFFER_FLUSHED,{type:A})},onError:function(p){O.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",p)}}};l.type?C.append(E(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){C.append(E(f),f)})},v.onFragParsed=function(o,l){var u=this,C=l.frag,E=l.part,f=[],A=E?E.elementaryStreams:C.elementaryStreams;A[S.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(A[S.ElementaryStreamTypes.AUDIO]&&f.push("audio"),A[S.ElementaryStreamTypes.VIDEO]&&f.push("video"));var T=function(){var c=self.performance.now();C.stats.buffering.end=c,E&&(E.stats.buffering.end=c);var s=E?E.stats:C.stats;u.hls.trigger(N.Events.FRAG_BUFFERED,{frag:C,part:E,stats:s,id:C.type})};f.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(T,f)},v.onFragChanged=function(o,l){this.flushBackBuffer()},v.onBufferEos=function(o,l){var u=this,C=this.getSourceBufferTypes().reduce(function(E,f){var A=u.sourceBuffer[f];return(!l.type||l.type===f)&&(A&&!A.ended&&(A.ended=!0,O.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),E&&!!(!A||A.ended)},!0);C&&this.blockBuffers(function(){var E=u.mediaSource;if(!E||E.readyState!=="open")return;E.endOfStream()})},v.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,C=this.sourceBuffer;if(!u||l===null)return;var E=this.getSourceBufferTypes();if(!E.length)return;var f=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(K.isFiniteNumber)(f)||f<0)return;var A=u.currentTime,T=l.levelTargetDuration,p=Math.max(f,T),c=Math.floor(A/T)*T-p;E.forEach(function(s){var a=C[s];if(a){var x=k.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:s}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,C=this.mediaSource,E=o.fragments[0].start+o.totalduration,f=u.duration,A=Object(K.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(E>A&&E>f||!Object(K.isFiniteNumber)(f))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+E.toFixed(3)),C.duration=E)},v.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,C=u.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var E=Math.max(0,u[0].start),f=Math.max(E,E+o.totalduration);l.setLiveSeekableRange(E,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!o||C===2){this.createSourceBuffers(u),this.pendingTracks={};var E=this.getSourceBufferTypes();if(E.length===0){this.hls.trigger(N.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}E.forEach(function(f){l.executeNext(f)})}},v.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var E in o)if(!l[E]){var f=o[E];if(!f)throw Error("source buffer exists for track "+E+", however track does not");var A=f.levelCodec||f.codec,T=f.container+";codecs="+A;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var p=l[E]=u.addSourceBuffer(T),c=E;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[E]={buffer:p,codec:A,container:f.container,levelCodec:f.levelCodec,id:f.id},C++}catch(s){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:T})}}C&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},v._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,l){O.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},v.removeExecutor=function(o,l,u){var C=this.media,E=this.mediaSource,f=this.operationQueue,A=this.sourceBuffer,T=A[o];if(!C||!E||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var p=Object(K.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,s=Math.max(0,l),a=Math.min(u,p,c);a>s?(O.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!T.updating,o+" sourceBuffer must not be updating"),T.remove(s,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,l){var u=this.operationQueue,C=this.sourceBuffer,E=C[l];if(!E){O.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}E.ended=!1,console.assert(!E.updating,l+" sourceBuffer must not be updating"),E.appendBuffer(o)},v.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,E=l.map(function(f){return C.appendBlocker(f)});Promise.all(E).then(function(){o(),l.forEach(function(f){var A=u.sourceBuffer[f];(!A||!A.updating)&&C.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,l,u){var C=this.sourceBuffer[o];if(!C)return;var E=u.bind(this,o);this.listeners[o].push({event:l,listener:E}),C.addEventListener(l,E)},v.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},g}()},"./src/controller/buffer-operation-queue.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return N});var K=L("./src/utils/logger.ts"),N=function(){function O(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var B=O.prototype;return B.append=function(R,S){var h=this.queues[S];h.push(R),h.length===1&&this.buffers[S]&&this.executeNext(S)},B.insertAbort=function(R,S){var h=this.queues[S];h.unshift(R),this.executeNext(S)},B.appendBlocker=function(R){var S,h=new Promise(function(P){S=P}),b={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,R),h},B.executeNext=function(R){var S=this.buffers,h=this.queues,b=S[R],P=h[R];if(P.length){var w=P[0];try{w.execute()}catch(g){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(g),(!b||!b.updating)&&(P.shift(),this.executeNext(R))}}},B.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},B.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts");function N(k,R){for(var S=0;S<R.length;S++){var h=R[S];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function O(k,R,S){return R&&N(k.prototype,R),S&&N(k,S),k}var B=function(){function k(S){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=S,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=k.prototype;return R.setStreamController=function(h){this.streamController=h},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var h=this.hls;h.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var h=this.hls;h.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(h,b){k.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},R.onMediaAttaching=function(h,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},R.onManifestParsed=function(h,b){var P=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,P.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onBufferCodecs=function(h,b){var P=this.hls;P.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var h=this.hls.levels;if(h.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(h.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},R.getMaxLevel=function(h){var b=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(g,v){return k.isLevelAllowed(v,b.restrictedLevels)&&v<=h});return this.clientRect=null,k.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var h=this.media,b={width:0,height:0};if(h){var P=h.getBoundingClientRect();b.width=P.width,b.height=P.height,!b.width&&!b.height&&(b.width=P.right-P.left||h.width||0,b.height=P.bottom-P.top||h.height||0)}return this.clientRect=b,b},k.isLevelAllowed=function(h,b){return b===void 0&&(b=[]),b.indexOf(h)===-1},k.getMaxLevelByMediaSize=function(h,b,P){if(!h||!h.length)return-1;for(var w=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},g=h.length-1,v=0;v<h.length;v+=1){var d=h[v];if((d.width>=b||d.height>=P)&&w(d,h[v+1])){g=v;break}}return g},O(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var h=1;try{h=self.devicePixelRatio}catch(b){}return h}}]),k}();z.default=B},"./src/controller/cmcd-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./src/events.ts"),N=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function k(g,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(g,o.key,o)}}function R(g,v,d){return v&&k(g.prototype,v),d&&k(g,d),g}function S(g,v){var d=typeof Symbol!="undefined"&&g[Symbol.iterator]||g["@@iterator"];if(d)return(d=d.call(g)).next.bind(d);if(Array.isArray(g)||(d=h(g))||v&&g&&typeof g.length=="number"){d&&(g=d);var o=0;return function(){return o>=g.length?{done:!0}:{done:!1,value:g[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 h(g,v){if(!g)return;if(typeof g=="string")return b(g,v);var d=Object.prototype.toString.call(g).slice(8,-1);if(d==="Object"&&g.constructor&&(d=g.constructor.name),d==="Map"||d==="Set")return Array.from(g);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return b(g,v)}function b(g,v){(v==null||v>g.length)&&(v=g.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=g[d];return o}function P(){return P=Object.assign||function(g){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(g[o]=d[o])}return g},P.apply(this,arguments)}var w=function(){function g(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(C){try{o.apply(C,{ot:N.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(E){B.logger.warn("Could not generate manifest CMCD data.",E)}},this.applyFragmentData=function(C){try{var E=C.frag,f=o.hls.levels[E.level],A=o.getObjectType(E),T={d:E.duration*1e3,ot:A};(A===N.CMCDObjectType.VIDEO||A===N.CMCDObjectType.AUDIO||A==N.CMCDObjectType.MUXED)&&(T.br=f.bitrate/1e3,T.tb=o.getTopBandwidth(A),T.bl=o.getBufferLength(A)),o.apply(C,T)}catch(p){B.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=d;var l=this.config=d.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||g.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var v=g.prototype;return v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,l){var u,C;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},v.createData=function(){var o;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(o,l){l===void 0&&(l={}),P(l,this.createData());var u=l.ot===N.CMCDObjectType.INIT||l.ot===N.CMCDObjectType.VIDEO||l.ot===N.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=g.toHeaders(l);if(!Object.keys(C).length)return;o.headers||(o.headers={}),P(o.headers,C)}else{var E=g.toQuery(l);if(!E)return;o.url=g.appendQueryToUri(o.url,E)}},v.getObjectType=function(o){var l=o.type;return l==="subtitle"?N.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?N.CMCDObjectType.INIT:l==="audio"?N.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var l=0,u=o===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=S(u),E;!(E=C()).done;){var f=E.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},v.getBufferLength=function(o){var l=this.hls.media,u=o===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var C=O.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return C.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new u(f)}var E=C.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(A,T,p){l(A),this.loader.load(A,T,p)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},v.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new u(f)}var E=C.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(A,T,p){l(A),this.loader.load(A,T,p)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},g.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},g.serialize=function(o){for(var l=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},C=function(U){return Math.round(U)},E=function(U){return C(U/100)*100},f=function(U){return encodeURIComponent(U)},A={br:C,d:C,bl:E,dl:E,mtp:E,nor:f,rtp:E,tb:C},T=Object.keys(o||{}).sort(),p=S(T),c;!(c=p()).done;){var s=c.value,a=o[s];if(!u(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var x=A[s];x&&(a=x(a));var y=typeof a,m=void 0;s==="ot"||s==="sf"||s==="st"?m=s+"="+a:y==="boolean"?m=s:y==="number"?m=s+"="+a:m=s+"="+JSON.stringify(a),l.push(m)}return l.join(",")},g.toHeaders=function(o){for(var l=Object.keys(o),u={},C=["Object","Request","Session","Status"],E=[{},{},{},{}],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},A=0,T=l;A<T.length;A++){var p=T[A],c=f[p]!=null?f[p]:1;E[c][p]=o[p]}for(var s=0;s<E.length;s++){var a=g.serialize(E[s]);a&&(u["CMCD-"+C[s]]=a)}return u},g.toQuery=function(o){return"CMCD="+encodeURIComponent(g.serialize(o))},g.appendQueryToUri=function(o,l){if(!l)return o;var u=o.includes("?")?"&":"?";return""+o+u+l},g}()},"./src/controller/eme-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function k(w,g){for(var v=0;v<g.length;v++){var d=g[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,g,v){return g&&k(w.prototype,g),v&&k(w,v),w}var S=3,h=function(g,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return g.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),v.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},b=function(g,v,d,o){switch(g){case B.KeySystems.WIDEVINE:return h(v,d,o);default:throw new Error("Unknown key-system: "+g)}},P=function(){function w(v){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=v,this._config=v.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var g=w.prototype;return g.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},g._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},g._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},g.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},g._attemptKeySystemAccess=function(d,o,l){var u=this,C=b(d,o,l,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var E=this.requestMediaKeySystemAccess(d,C);this.mediaKeysPromise=E.then(function(f){return u._onMediaKeySystemAccessObtained(d,f)}),E.catch(function(f){O.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},g._onMediaKeySystemAccessObtained=function(d,o){var l=this;O.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(E){return u.mediaKeys=E,O.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),E});return C.catch(function(E){O.logger.error("Failed to create media-keys:",E)}),C},g._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},g._onNewMediaKeySession=function(d){var o=this;O.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},g._onKeySessionMessage=function(d,o){O.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){O.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},g.onMediaEncrypted=function(d){var o=this;if(O.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},g._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},g._generateRequestWithPreferredKeySession=function(d,o){var l=this,u=this._mediaKeysList[0];if(!u){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var C=u.mediaKeysSession;if(!C){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,C.generateRequest(d,o).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(E){O.logger.error("Error generating key-session request:",E),l.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},g._createLicenseXhr=function(d,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,u,d),C=void 0}catch(E){O.logger.error(E)}try{u.readyState||u.open("POST",d,!0),C&&C.call(this.hls,u,d)}catch(E){throw new Error("issue setting up KeySystem license XHR "+E)}return u},g._onLicenseRequestReadyStageChange=function(d,o,l,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var C=d.response,E=this._licenseResponseCallback;if(E)try{C=E.call(this.hls,d,o)}catch(A){O.logger.error(A)}u(C)}else{if(O.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=S-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,u)}break}},g._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},g._requestLicense=function(d,o){O.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(u,d,o);O.logger.log("Sending license request to URL: "+u);var E=this._generateLicenseRequestChallenge(l,d);C.send(E)}catch(f){O.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},g.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},g.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},g.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,l,u)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();z.default=P},"./src/controller/fps-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),N=L("./src/utils/logger.ts"),O=function(){function B(R){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=R,this.registerListeners()}var k=B.prototype;return k.setStreamController=function(S){this.streamController=S},k.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(S,h){var b=this.hls.config;if(b.capLevelOnFPSDrop){var P=h.media instanceof self.HTMLVideoElement?h.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(S,h,b){var P=performance.now();if(h){if(this.lastTime){var w=P-this.lastTime,g=b-this.lastDroppedFrames,v=h-this.lastDecodedFrames,d=1e3*g/w,o=this.hls;if(o.trigger(K.Events.FPS_DROP,{currentDropped:g,currentDecoded:v,totalDroppedFrames:b}),d>0&&g>o.config.fpsDroppedMonitoringThreshold*v){var l=o.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=b,this.lastDecodedFrames=h}},k.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var h=S.getVideoPlaybackQuality();this.checkFPS(S,h.totalVideoFrames,h.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},B}();z.default=O},"./src/controller/fragment-finders.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return O}),L.d(z,"findFragmentByPTS",function(){return B}),L.d(z,"fragmentWithinToleranceTest",function(){return k}),L.d(z,"pdtWithinToleranceTest",function(){return R}),L.d(z,"findFragWithCC",function(){return S});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/binary-search.ts");function O(h,b,P){if(b===null||!Array.isArray(h)||!h.length||!Object(K.isFiniteNumber)(b))return null;var w=h[0].programDateTime;if(b<(w||0))return null;var g=h[h.length-1].endProgramDateTime;if(b>=(g||0))return null;P=P||0;for(var v=0;v<h.length;++v){var d=h[v];if(R(b,P,d))return d}return null}function B(h,b,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var g=null;if(h?g=b[h.sn-b[0].sn+1]||null:P===0&&b[0].start===0&&(g=b[0]),g&&k(P,w,g)===0)return g;var v=N.default.search(b,k.bind(null,P,w));return v||g}function k(h,b,P){h===void 0&&(h=0),b===void 0&&(b=0);var w=Math.min(b,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=h?1:P.start-w>h&&P.start?-1:0}function R(h,b,P){var w=Math.min(b,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,g=P.endProgramDateTime||0;return g-w>h}function S(h,b){return N.default.search(h,function(P){return P.cc<b?1:P.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return O}),L.d(z,"FragmentTracker",function(){return B});var K=L("./src/events.ts"),N=L("./src/types/loader.ts"),O;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(O||(O={}));var B=function(){function S(b){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=b,this._registerListeners()}var h=S.prototype;return h._registerListeners=function(){var P=this.hls;P.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h._unregisterListeners=function(){var P=this.hls;P.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},h.getAppendedFrag=function(P,w){if(w===N.PlaylistLevelType.MAIN){var g=this.activeFragment,v=this.activeParts;if(!g)return null;if(v)for(var d=v.length;d--;){var o=v[d],l=o?o.end:g.appendedPTS;if(o.start<=P&&l!==void 0&&P<=l)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(g.start<=P&&g.appendedPTS!==void 0&&P<=g.appendedPTS)return g}return this.getBufferedFrag(P,w)},h.getBufferedFrag=function(P,w){for(var g=this.fragments,v=Object.keys(g),d=v.length;d--;){var o=g[v[d]];if((o==null?void 0:o.body.type)===w&&o.buffered){var l=o.body;if(l.start<=P&&P<=l.end)return l}}return null},h.detectEvictedFragments=function(P,w,g){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===g&&v.removeFragment(o.body);return}var l=o.range[P];if(!l)return;l.time.some(function(u){var C=!v.isTimeBuffered(u.startPTS,u.endPTS,w);return C&&v.removeFragment(o.body),C})})},h.detectPartialFragments=function(P){var w=this,g=this.timeRanges,v=P.frag,d=P.part;if(!g||v.sn==="initSegment")return;var o=R(v),l=this.fragments[o];if(!l)return;Object.keys(g).forEach(function(u){var C=v.elementaryStreams[u];if(!C)return;var E=g[u],f=d!==null||C.partial===!0;l.range[u]=w.getBufferedTimes(v,d,f,E)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},h.fragBuffered=function(P){var w=R(P),g=this.fragments[w];g&&(g.backtrack=g.loaded=null,g.buffered=!0)},h.getBufferedTimes=function(P,w,g,v){for(var d={time:[],partial:g},o=w?w.start:P.start,l=w?w.end:P.end,u=P.minEndPTS||l,C=P.maxStartPTS||o,E=0;E<v.length;E++){var f=v.start(E)-this.bufferPadding,A=v.end(E)+this.bufferPadding;if(C>=f&&u<=A){d.time.push({startPTS:Math.max(o,v.start(E)),endPTS:Math.min(l,v.end(E))});break}else if(o<A&&l>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(E)),endPTS:Math.min(l,v.end(E))});else if(l<=f)break}return d},h.getPartialFragment=function(P){var w=null,g,v,d,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var E=u[C];if(!E)return;k(E)&&(v=E.body.start-l,d=E.body.end+l,P>=v&&P<=d&&(g=Math.min(P-v,d-P),o<=g&&(w=E.body,o=g)))}),w},h.getState=function(P){var w=R(P),g=this.fragments[w];return g?g.buffered?k(g)?O.PARTIAL:O.OK:g.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},h.backtrack=function(P,w){var g=R(P),v=this.fragments[g];if(!v||v.backtrack)return null;var d=v.backtrack=w||v.loaded;return v.loaded=null,d},h.getBacktrackData=function(P){var w=R(P),g=this.fragments[w];if(g){var v,d=g.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(P)}return null},h.isTimeBuffered=function(P,w,g){for(var v,d,o=0;o<g.length;o++){if(v=g.start(o)-this.bufferPadding,d=g.end(o)+this.bufferPadding,P>=v&&w<=d)return!0;if(w<=v)return!1}return!1},h.onFragLoaded=function(P,w){var g=w.frag,v=w.part;if(g.sn==="initSegment"||g.bitrateTest||v)return;var d=R(g);this.fragments[d]={body:g,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},h.onBufferAppended=function(P,w){var g=this,v=w.frag,d=w.part,o=w.timeRanges;if(v.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var C=o[u];if(g.detectEvictedFragments(u,C),!d)for(var E=0;E<C.length;E++)v.appendedPTS=Math.max(C.end(E),v.appendedPTS||0)})},h.onFragBuffered=function(P,w){this.detectPartialFragments(w)},h.hasFragment=function(P){var w=R(P);return!!this.fragments[w]},h.removeFragmentsInRange=function(P,w,g){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===g&&l.start<w&&l.end>P&&v.removeFragment(l)}})},h.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},h.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function k(S){var h,b;return S.buffered&&(((h=S.range.video)===null||h===void 0?void 0:h.partial)||((b=S.range.audio)===null||b===void 0?void 0:b.partial))}function R(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return k}),L.d(z,"MAX_START_GAP_JUMP",function(){return R}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return h}),L.d(z,"default",function(){return b});var K=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),O=L("./src/events.ts"),B=L("./src/utils/logger.ts"),k=250,R=2,S=.1,h=.05,b=function(){function P(g,v,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=g,this.media=v,this.fragmentTracker=d,this.hls=o}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(v){var d=this.config,o=this.media,l=this.stalled,u=o.currentTime,C=o.seeking,E=this.seeking&&!C,f=!this.seeking&&C;if(this.seeking=C,u!==v){if(this.moved=!0,l!==null){if(this.stallReported){var A=self.performance.now()-l;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||E)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!K.BufferHelper.getBuffered(o).length)return;var T=K.BufferHelper.bufferInfo(o,u,0),p=T.len>0,c=T.nextStart||0;if(!p&&!c)return;if(C){var s=T.len>R,a=!c||c-u>R&&!this.fragmentTracker.getPartialFragment(u);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,T.start||0)-u,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=m==null||((x=m.details)===null||x===void 0)?void 0:x.live,U=D?m.details.targetduration*2:R;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(l===null){this.stalled=F;return}var W=F-l;!C&&W>=k&&this._reportStall(T.len);var M=K.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(M,W)},w._tryFixBufferStall=function(v,d){var o=this.config,l=this.fragmentTracker,u=this.media,C=u.currentTime,E=l.getPartialFragment(C);if(E){var f=this._trySkipBufferHole(E);if(f)return}v.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(v){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},w._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,l=this.media,u=l.currentTime,C=0,E=K.BufferHelper.getBuffered(l),f=0;f<E.length;f++){var A=E.start(f);if(u+d.maxBufferHole>=C&&u<A){var T=Math.max(A+h,l.currentTime+S);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,v&&o.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+T,frag:v}),T}C=E.end(f)}return 0},w._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<v.nudgeMaxRetry){var C=l+u*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+l+" to "+C),o.currentTime=C,d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),N=L("./src/utils/texttrack-utils.ts"),O=L("./src/demux/id3.ts"),B=.25,k=function(){function R(h){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=h,this._registerListeners()}var S=R.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var b=this.hls;b.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var b=this.hls;b.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(b,P){this.media=P.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(b){if(!this.media)return;for(var P=0;P<b.length;P++){var w=b[P];if(w.kind==="metadata"&&w.label==="id3")return Object(N.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(b,P){if(!this.media)return;var w=P.frag,g=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<g.length;d++){var o=O.getID3Frames(g[d].data);if(o){var l=g[d].pts,u=d<g.length-1?g[d+1].pts:w.end,C=u-l;C<=0&&(u=l+B);for(var E=0;E<o.length;E++){var f=o[E];if(!O.isTimeStampFrame(f)){var A=new v(l,u,"");A.value=f,this.id3Track.addCue(A)}}}}},S.onBufferFlushing=function(b,P){var w=P.startOffset,g=P.endOffset,v=P.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(N.removeCuesInRange)(d,w,g)}},R}();z.default=k},"./src/controller/latency-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/errors.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts");function B(S,h){for(var b=0;b<h.length;b++){var P=h[b];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function k(S,h,b){return h&&B(S.prototype,h),b&&B(S,b),S}var R=function(){function S(b){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var h=S.prototype;return h.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},h.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},h.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},h.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},h.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},h.onLevelUpdated=function(P,w){var g=w.details;this.levelDetails=g,g.advanced&&this.timeupdate(),!g.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},h.onError=function(P,w){if(w.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},h.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var g=this.computeLatency();if(g===null)return;this._latency=g;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var u=g-l,C=Math.min(this.maxLatency,l+w.targetduration),E=u<C;if(w.live&&E&&u>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;P.playbackRate=Math.min(f,Math.max(1,A))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},h.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},h.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},k(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,g=P.partHoldBack,v=P.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,u=d.lowLatencyMode,C=this.hls.userConfig,E=u&&g||w;(C.liveSyncDuration||C.liveSyncDurationCount||E===0)&&(E=o!==void 0?o:l*v);var f=v,A=1;return E+Math.min(this.stallCount*A,f)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,g=this.levelDetails;if(P===null||w===null||g===null)return null;var v=g.edge,d=P-w-this.edgeStalled,o=v-g.totalduration,l=v-(this.config.lowLatencyMode&&g.partTarget||g.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var g=P.buffered.length;return g?P.buffered.end(g-1):w.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return d});var K=L("./src/types/level.ts"),N=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),k=L("./src/controller/level-helper.ts"),R=L("./src/controller/base-playlist-controller.ts"),S=L("./src/types/loader.ts");function h(){return h=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var C in u)Object.prototype.hasOwnProperty.call(u,C)&&(o[C]=u[C])}return o},h.apply(this,arguments)}function b(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,l,u){return l&&b(o.prototype,l),u&&b(o,u),o}function w(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,g(o,l)}function g(o,l){return g=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},g(o,l)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){w(l,o);function l(C){var E;return E=o.call(this,C,"[level-controller]")||this,E._levels=[],E._firstLevel=-1,E._startLevel=void 0,E.currentLevelIndex=-1,E.manualLevelIndex=-1,E.onParsedComplete=void 0,E._registerListeners(),E}var u=l.prototype;return u._registerListeners=function(){var E=this.hls;E.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),E.on(N.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var E=this.hls;E.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),E.off(N.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var E=this._levels;E.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(E,f){var A=[],T=[],p=[],c,s={},a,x=!1,y=!1,m=!1;if(f.levels.forEach(function(W){var M=W.attrs;x=x||!!(W.width&&W.height),y=y||!!W.videoCodec,m=m||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var I=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=s[I],a?a.url.push(W.url):(a=new K.Level(W),s[I]=a,A.push(a)),M&&(M.AUDIO&&Object(k.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(k.addGroupId)(a,"text",M.SUBTITLES))}),(x||y)&&m&&(A=A.filter(function(W){var M=W.videoCodec,I=W.width,H=W.height;return!!M||!!(I&&H)})),A=A.filter(function(W){var M=W.audioCodec,I=W.videoCodec;return(!M||Object(B.isCodecSupportedInMp4)(M,"audio"))&&(!I||Object(B.isCodecSupportedInMp4)(I,"video"))}),f.audioTracks&&(T=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(T)),f.subtitles&&(p=f.subtitles,Object(k.assignTrackIdsByGroup)(p)),A.length>0){c=A[0].bitrate,A.sort(function(W,M){return W.bitrate-M.bitrate}),this._levels=A;for(var D=0;D<A.length;D++)if(A[D].bitrate===c){this._firstLevel=D,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+c);break}var U=m&&!y,F={levels:A,audioTracks:T,subtitleTracks:p,firstLevel:this._firstLevel,stats:f.stats,audio:m,video:y,altAudio:!U&&T.some(function(W){return!!W.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(E,f){if(o.prototype.onError.call(this,E,f),f.fatal)return;var A=f.context,T=this._levels[this.currentLevelIndex];if(A&&(A.type===S.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&A.groupId===T.audioGroupIds[T.urlId]||A.type===S.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&A.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,c=!0,s;switch(f.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=f.frag.level)):s=f.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(c=!1),s=A.level),p=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:s=f.level,p=!0;break}s!==void 0&&this.recoverLevel(f,s,p,c)},u.recoverLevel=function(E,f,A,T){var p=E.details,c=this._levels[f];if(c.loadError++,A){var s=this.retryLoadingOrFail(E);if(s)E.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var a=c.url.length;if(a>1&&c.loadError<a)E.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var x=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(p+": switch to "+x),E.levelRetry=!0,this.hls.nextAutoLevel=x)}}},u.redundantFailover=function(E){var f=this._levels[E],A=f.url.length;if(A>1){var T=(f.urlId+1)%A;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(p){p.urlId=T}),this.level=E}},u.onFragLoaded=function(E,f){var A=f.frag;if(A!==void 0&&A.type===S.PlaylistLevelType.MAIN){var T=this._levels[A.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},u.onLevelLoaded=function(E,f){var A,T=f.level,p=f.details,c=this._levels[T];if(!c){var s;this.warn("Invalid level index "+T),(s=f.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(p.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,f,c.details)):(A=f.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(p.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(E,f){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var T=-1,p=this.hls.audioTracks[f.id].groupId,c=0;c<A.audioGroupIds.length;c++)if(A.audioGroupIds[c]===p){T=c;break}T!==A.urlId&&(A.urlId=T,this.startLoad())}},u.loadPlaylist=function(E){var f=this.currentLevelIndex,A=this._levels[f];if(this.canLoad&&A&&A.url.length>0){var T=A.urlId,p=A.url[T];if(E)try{p=E.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(E?" at sn "+E.msn+" part "+E.part:"")+" with URL-id "+T+" "+p),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:p,level:f,id:T,deliveryDirectives:E||null})}},u.removeLevel=function(E,f){var A=function(c,s){return s!==f},T=this._levels.filter(function(p,c){return c!==E?!0:p.url.length>1&&f!==void 0?(p.url=p.url.filter(A),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(A)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(A)),p.urlId=0,!0):!1}).map(function(p,c){var s=p.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=c}),p});this._levels=T,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:T})},P(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(E){var f,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===E&&(f=A[E])!==null&&f!==void 0&&f.details)return;if(E<0||E>=A.length){var T=E<0;if(this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:E,fatal:T,reason:"invalid level idx"}),T)return;E=Math.min(E,A.length-1)}this.clearTimer();var p=this.currentLevelIndex,c=A[p],s=A[E];this.log("switching to level "+E+" from "+p),this.currentLevelIndex=E;var a=h({},s,{level:E,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,a);var x=s.details;if(!x||x.live){var y=this.switchParams(s.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(E){this.manualLevelIndex=E,this._startLevel===void 0&&(this._startLevel=E),E!==-1&&(this.level=E)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(E){this._firstLevel=E}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var E=this.hls.config.startLevel;return E!==void 0?E:this._firstLevel}else return this._startLevel},set:function(E){this._startLevel=E}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(E){this.level=E,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=E)}}]),l}(R.default)},"./src/controller/level-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return O}),L.d(z,"assignTrackIdsByGroup",function(){return B}),L.d(z,"updatePTS",function(){return k}),L.d(z,"updateFragPTSDTS",function(){return S}),L.d(z,"mergeDetails",function(){return h}),L.d(z,"mapPartIntersection",function(){return b}),L.d(z,"mapFragmentIntersection",function(){return P}),L.d(z,"adjustSliding",function(){return w}),L.d(z,"addSliding",function(){return g}),L.d(z,"computeReloadInterval",function(){return v}),L.d(z,"getFragmentWithSN",function(){return d}),L.d(z,"getPartWith",function(){return o});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/logger.ts");function O(l,u,C){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function B(l){var u={};l.forEach(function(C){var E=C.groupId||"";C.id=u[E]=u[E]||0,u[E]++})}function k(l,u,C){var E=l[u],f=l[C];R(E,f)}function R(l,u){var C=u.startPTS;if(Object(K.isFiniteNumber)(C)){var E=0,f;u.sn>l.sn?(E=C-l.start,f=l):(E=l.start-C,f=u),f.duration!==E&&(f.duration=E)}else if(u.sn>l.sn){var A=l.cc===u.cc;A&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function S(l,u,C,E,f,A){var T=E-C;T<=0&&(N.logger.warn("Fragment should have a positive duration",u),E=C+u.duration,A=f+u.duration);var p=C,c=E,s=u.startPTS,a=u.endPTS;if(Object(K.isFiniteNumber)(s)){var x=Math.abs(s-C);Object(K.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(x,u.deltaPTS):u.deltaPTS=x,p=Math.max(C,s),C=Math.min(C,s),f=Math.min(f,u.startDTS),c=Math.min(E,a),E=Math.max(E,a),A=Math.max(A,u.endDTS)}u.duration=E-C;var y=C-u.start;u.appendedPTS=E,u.start=u.startPTS=C,u.maxStartPTS=p,u.startDTS=f,u.endPTS=E,u.minEndPTS=c,u.endDTS=A;var m=u.sn;if(!l||m<l.startSN||m>l.endSN)return 0;var D,U=m-l.startSN,F=l.fragments;for(F[U]=u,D=U;D>0;D--)R(F[D],F[D-1]);for(D=U;D<F.length-1;D++)R(F[D],F[D+1]);return l.fragmentHint&&R(F[F.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function h(l,u){for(var C=null,E=l.fragments,f=E.length-1;f>=0;f--){var A=E[f].initSegment;if(A){C=A;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,p;if(P(l,u,function(D,U){D.relurl&&(T=D.cc-U.cc),Object(K.isFiniteNumber)(D.startPTS)&&Object(K.isFiniteNumber)(D.endPTS)&&(U.start=U.startPTS=D.startPTS,U.startDTS=D.startDTS,U.appendedPTS=D.appendedPTS,U.maxStartPTS=D.maxStartPTS,U.endPTS=D.endPTS,U.endDTS=D.endDTS,U.minEndPTS=D.minEndPTS,U.duration=D.endPTS-D.startPTS,U.duration&&(p=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=D.elementaryStreams,U.loader=D.loader,U.stats=D.stats,U.urlId=D.urlId,D.initSegment&&(U.initSegment=D.initSegment,C=D.initSegment)}),C){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(D){var U;(!D.initSegment||D.initSegment.relurl===((U=C)===null||U===void 0?void 0:U.relurl))&&(D.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(D){return!D}),u.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=u.skippedSegments;s--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(T){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=T}u.skippedSegments&&(u.startCC=u.fragments[0].cc),b(l.partList,u.partList,function(D,U){U.elementaryStreams=D.elementaryStreams,U.stats=D.stats}),p?S(u,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):w(l,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var y=u.advancedDateTime;if(u.advanced&&y){var m=u.edge;u.driftStart||(u.driftStartTime=y,u.driftStart=m),u.driftEndTime=y,u.driftEnd=m}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function b(l,u,C){if(l&&u)for(var E=0,f=0,A=l.length;f<=A;f++){var T=l[f],p=u[f+E];T&&p&&T.index===p.index&&T.fragment.sn===p.fragment.sn?C(T,p):E--}}function P(l,u,C){for(var E=u.skippedSegments,f=Math.max(l.startSN,u.startSN)-u.startSN,A=(l.fragmentHint?1:0)+(E?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,T=u.startSN-l.startSN,p=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,s=f;s<=A;s++){var a=c[T+s],x=p[s];E&&!x&&s<E&&(x=u.fragments[s]=a),a&&x&&C(a,x)}}function w(l,u){var C=u.startSN+u.skippedSegments-l.startSN,E=l.fragments;if(C<0||C>=E.length)return;g(u,E[C].start)}function g(l,u){if(u){for(var C=l.fragments,E=l.skippedSegments;E<C.length;E++)C[E].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function v(l,u){var C=1e3*l.levelTargetDuration,E=C/2,f=l.age,A=f>0&&f<C*3,T=u.loading.end-u.loading.start,p,c=l.availabilityDelay;if(l.updated===!1)if(A){var s=333*l.misses;p=Math.max(Math.min(E,T*2),s),l.availabilityDelay=(l.availabilityDelay||0)+p}else p=E;else A?(c=Math.min(c||C/2,f),l.availabilityDelay=c,p=c+C-f):p=C-T;return Math.round(p)}function d(l,u,C){if(!l||!l.details)return null;var E=l.details,f=E.fragments[u-E.startSN];return f||(f=E.fragmentHint,f&&f.sn===u?f:u<E.startSN&&C&&C.sn===u?C:null)}function o(l,u,C){if(!l||!l.details)return null;var E=l.details.partList;if(E)for(var f=E.length;f--;){var A=E[f];if(A.index===C&&A.fragment.sn===u)return A}return null}},"./src/controller/stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return E});var K=L("./src/polyfills/number.ts"),N=L("./src/controller/base-stream-controller.ts"),O=L("./src/is-supported.ts"),B=L("./src/events.ts"),k=L("./src/utils/buffer-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),S=L("./src/types/loader.ts"),h=L("./src/loader/fragment.ts"),b=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),g=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function d(f,A){for(var T=0;T<A.length;T++){var p=A[T];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}function o(f,A,T){return A&&d(f.prototype,A),T&&d(f,T),f}function l(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,u(f,A)}function u(f,A){return u=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},u(f,A)}var C=100,E=function(f){l(A,f);function A(p,c){var s;return s=f.call(this,p,c,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var T=A.prototype;return T._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}s>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),c=s),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var c,s=this.levels,a=this.level,x=s==null||((c=s[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var y,m=self.performance.now(),D=this.retryDate;(!D||m>=D||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,s,a=this.hls,x=this.levelLastLoaded,y=this.levels,m=this.media,D=a.config,U=a.nextLoadLevel;if(x===null||!m&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var F=y[U];this.level=a.nextLoadLevel=U;var W=F.details;if(!W||this.state===N.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=N.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,S.PlaylistLevelType.MAIN);if(M===null)return;var I=M.len,H=this.getMaxBufferLength(F.maxBitrate);if(I>=H)return;if(this._streamEnded(M,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=N.State.ENDED;return}var ee=M.end,ae=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var be=ae.sn-W.startSN;be>1&&(ae=W.fragments[be-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===R.FragmentState.OK&&this.nextLoadPosition>ee){var pe=this.audioOnly&&!this.altAudio?h.ElementaryStreamTypes.AUDIO:h.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,pe,S.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,W)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((c=ae.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((s=ae.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ae,W):this.loadFragment(ae,W,ee)},T.loadFragment=function(c,s,a){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===R.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(c);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.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,s,a)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var s=this.fragmentTracker.getAppendedFrag(c,S.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,S.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,s=this.media;if(s!=null&&s.readyState){var a,x=this.getAppendedFrag(s.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!s.paused&&c){var y=this.hls.nextLoadLevel,m=c[y],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*m.maxBitrate/(1e3*D)+1:a=0}else a=0;var U=this.getBufferedFrag(s.currentTime+a);if(U){var F=this.followingBufferedFrag(U);if(F){this.abortCurrentFrag();var W=F.maxStartPTS?F.maxStartPTS:F.start,M=F.duration,I=Math.max(U.end,W+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(c,s){f.prototype.flushMainBuffer.call(this,c,s,this.altAudio?"video":null)},T.onMediaAttached=function(c,s){f.prototype.onMediaAttached.call(this,c,s);var a=s.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 w.default(this.config,a,this.fragmentTracker,this.hls)},T.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)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,s=c?c.currentTime:null;Object(K.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},T.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},T.onManifestParsed=function(c,s){var a=!1,x=!1,y;s.levels.forEach(function(m){y=m.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},T.onLevelLoading=function(c,s){var a=this.levels;if(!a||this.state!==N.State.IDLE)return;var x=a[s.level];(!x.details||x.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(x.details))&&(this.state=N.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,s){var a,x=this.levels,y=s.level,m=s.details,D=m.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+D);var U=this.fragCurrent;U&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==s.level&&U.loader&&(this.state=N.State.IDLE,U.loader.abort()));var F=x[y],W=0;if(m.live||(a=F.details)!==null&&a!==void 0&&a.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;W=this.alignPlaylists(m,F.details)}if(F.details=m,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:m,level:y}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=N.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,W),this.tick()},T._handleFragmentLoadProgress=function(c){var s,a=c.frag,x=c.part,y=c.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var D=m[a.level],U=D.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var F=D.videoCodec,W=U.PTSKnown||!U.live,M=(s=a.initSegment)===null||s===void 0?void 0:s.data,I=this._getAudioCodec(D),H=this.transmuxer=this.transmuxer||new b.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=x?x.index:-1,ee=X!==-1,ae=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,X,ee),be=this.initPTS[a.cc];H.push(y,M,I,F,a,x,U.totalduration,W,ae,be)},T.onAudioTrackSwitching=function(c,s){var a=this.altAudio,x=!!s.url,y=s.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;a&&D.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(c,s){var a=s.id,x=!!this.hls.audioTracks[a].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},T.onBufferCreated=function(c,s){var a=s.tracks,x,y,m=!1;for(var D in a){var U=a[D];if(U.id==="main"){if(y=D,x=U,D==="video"){var F=a[D];F&&(this.videoBuffer=F.buffer)}}else m=!0}m&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,s){var a=s.frag,x=s.part;if(a&&a.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var y=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},T.onError=function(c,s){switch(s.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:case g.ErrorDetails.KEY_LOAD_ERROR:case g.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,s);break;case g.ErrorDetails.LEVEL_LOAD_ERROR:case g.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=N.State.ERROR):!s.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case g.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,s=this.gapController;if(!c||!s||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,s){var a=s.type;if(a!==h.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===h.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,S.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,s){this.levels=s.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,s=c.currentTime,a=this.startPosition;if(a>=0&&s<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+s);return}var x=k.BufferHelper.getBuffered(c),y=x.length?x.start(0):0,m=y-a;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+m+" to match buffer start"),a+=m,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),c.currentTime=a}},T._getAudioCodec=function(c){var s=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},T._loadBitrateTestFrag=function(c){var s=this;this._doFragLoad(c).then(function(a){var x=s.hls;if(!a||x.nextLoadLevel||s.fragContextChanged(c))return;s.fragLoadError=0,s.state=N.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(B.Events.FRAG_LOADED,a)})},T._handleTransmuxComplete=function(c){var s,a="main",x=this.hls,y=c.remuxResult,m=c.chunkMeta,D=this.getCurrentContext(m);if(!D){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 U=D.frag,F=D.part,W=D.level,M=y.video,I=y.text,H=y.id3,X=y.initSegment,ee=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=N.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,m),x.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:X.tracks}));var ae=X.initPTS,be=X.timescale;Object(K.isFiniteNumber)(ae)&&(this.initPTS[U.cc]=ae,x.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ae,timescale:be}))}if(M&&y.independent!==!1){if(W.details){var pe=M.startPTS,ue=M.endPTS,se=M.startDTS,fe=M.endDTS;if(F)F.elementaryStreams[M.type]={startPTS:pe,endPTS:ue,startDTS:se,endDTS:fe};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<pe){this.backtrack(U);return}U.setElementaryStreamInfo(M.type,U.start,ue,U.start,fe,!0)}U.setElementaryStreamInfo(M.type,pe,ue,se,fe),this.bufferFragmentData(M,U,F,m)}}else if(y.independent===!1){this.backtrack(U);return}if(ee){var me=ee.startPTS,Q=ee.endPTS,ie=ee.startDTS,te=ee.endDTS;F&&(F.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:Q,startDTS:ie,endDTS:te}),U.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,me,Q,ie,te),this.bufferFragmentData(ee,U,F,m)}if(H!=null&&(s=H.samples)!==null&&s!==void 0&&s.length){var Ee={frag:U,id:a,samples:H.samples};x.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(I){var _e={frag:U,id:a,samples:I.samples};x.trigger(B.Events.FRAG_PARSING_USERDATA,_e)}},T._bufferInitSegment=function(c,s,a,x){var y=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var m=s.audio,D=s.video,U=s.audiovideo;if(m){var F=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),m.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(F="mp4a.40.5")),W.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),c.audioCodec&&c.audioCodec!==F&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+F+'"'),m.levelCodec=F,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(c.audioCodec||"")+"/"+m.codec+"]")}D&&(D.levelCodec=c.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+D.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(M){var I=s[M],H=I.initSegment;H!=null&&H.byteLength&&y.hls.trigger(B.Events.BUFFER_APPENDING,{type:M,data:H,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},T.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var s=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,s?this.resetFragmentLoading(c):this.state=N.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,s=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?s=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var x=this.fragPlaying,y=s.level;(!x||s.sn!==x.sn||x.level!==y||s.urlId!==x.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:s}),(!x||x.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=s)}}},o(A,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return l});var K=L("./src/events.ts"),N=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),k=L("./src/utils/discontinuities.ts"),R=L("./src/controller/level-helper.ts"),S=L("./src/controller/fragment-tracker.ts"),h=L("./src/controller/base-stream-controller.ts"),b=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function w(u,C){for(var E=0;E<C.length;E++){var f=C[E];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(u,f.key,f)}}function g(u,C,E){return C&&w(u.prototype,C),E&&w(u,E),u}function v(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,d(u,C)}function d(u,C){return d=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},d(u,C)}var o=500,l=function(u){v(C,u);function C(f,A){var T;return T=u.call(this,f,A,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var E=C.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(K.Events.ERROR,this.onError,this),A.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(K.Events.ERROR,this.onError,this),A.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E.startLoad=function(){this.stopLoad(),this.state=h.State.IDLE,this.setInterval(o),this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},E.onLevelLoaded=function(A,T){this.mainDetails=T.details},E.onSubtitleFragProcessed=function(A,T){var p=T.frag,c=T.success;if(this.fragPrevious=p,this.state=h.State.IDLE,!c)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,x=p.start,y=0;y<s.length;y++)if(x>=s[y].start&&x<=s[y].end){a=s[y];break}var m=p.start+p.duration;a?a.end=m:(a={start:x,end:m},s.push(a)),this.fragmentTracker.fragBuffered(p)},E.onBufferFlushing=function(A,T){var p=T.startOffset,c=T.endOffset;if(p===0&&c!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var x=a[s].details,y=x.targetduration,m=c-y;if(m<=0)return;T.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(D){for(var U=0;U<D.length;){if(D[U].end<=m){D.shift();continue}else if(D[U].start<m)D[U].start=m;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(p,m,b.PlaylistLevelType.SUBTITLE)}},E.onError=function(A,T){var p,c=T.frag;if(!c||c.type!==b.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=h.State.IDLE},E.onSubtitleTracksUpdated=function(A,T){var p=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(s){return new P.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){p.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},E.onSubtitleTrackSwitch=function(A,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(o)},E.onSubtitleTrackLoaded=function(A,T){var p,c=T.details,s=T.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[a];if(s>=x.length||s!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(p=y.details)!==null&&p!==void 0&&p.live){var m=this.mainDetails;if(c.deltaUpdateFailed||!m)return;var D=m.fragments[0];if(!y.details)c.hasProgramDateTime&&m.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,m):D&&Object(R.addSliding)(c,D.start);else{var U=this.alignPlaylists(c,y.details);U===0&&D&&Object(R.addSliding)(c,D.start)}}if(y.details=c,this.levelLastLoaded=s,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===h.State.IDLE){var F=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},E._handleFragmentLoadComplete=function(A){var T=A.frag,p=A.payload,c=T.decryptdata,s=this.hls;if(this.fragContextChanged(T))return;if(p&&p.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();s.trigger(K.Events.FRAG_DECRYPTED,{frag:T,payload:x,stats:{tstart:a,tdecrypt:y}})})}},E.doTick=function(){if(!this.media){this.state=h.State.IDLE;return}if(this.state===h.State.IDLE){var A,T=this.currentTrackId,p=this.levels;if(!p.length||!p[T]||!p[T].details)return;var c=p[T].details,s=c.targetduration,a=this.config,x=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-s,a.maxBufferHole),m=y.end,D=y.len,U=this.getMaxBufferLength()+s;if(D>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var F=c.fragments,W=F.length,M=c.edge,I,H=this.fragPrevious;if(m<M){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(I=Object(B.findFragmentByPDT)(F,H.endProgramDateTime,X)),I||(I=Object(B.findFragmentByPTS)(H,F,m,X),!I&&H&&H.start<F[0].start&&(I=F[0]))}else I=F[W-1];(A=I)!==null&&A!==void 0&&A.encrypted?(N.logger.log("Loading key for "+I.sn),this.state=h.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===S.FragmentState.NOT_LOADED&&this.loadFragment(I,c,m)}},E.loadFragment=function(A,T,p){this.fragCurrent=A,u.prototype.loadFragment.call(this,A,T,p)},g(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(h.default)},"./src/controller/subtitle-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),N=L("./src/utils/texttrack-utils.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function k(w,g){for(var v=0;v<g.length;v++){var d=g[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,g,v){return g&&k(w.prototype,g),v&&k(w,v),w}function S(w,g){w.prototype=Object.create(g.prototype),w.prototype.constructor=w,h(w,g)}function h(w,g){return h=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},h(w,g)}var b=function(w){S(g,w);function g(d){var o;return o=w.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var v=g.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(K.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(K.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.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=P(this.media.textTracks);o.forEach(function(l){Object(N.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},v.onSubtitleTrackLoaded=function(o,l){var u=l.id,C=l.details,E=this.trackId,f=this.tracksInGroup[E];if(!f){this.warn("Invalid subtitle track id "+u);return}var A=f.details;f.details=l.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,A))},v.onLevelLoading=function(o,l){this.switchLevel(l.level)},v.onLevelSwitching=function(o,l){this.switchLevel(l.level)},v.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,E=this.tracks.filter(function(T){return!u||T.groupId===u});this.tracksInGroup=E;var f=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var A={subtitleTracks:E};this.log("Updating subtitle tracks, "+E.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,A),f!==-1&&this.setSubtitleTrack(f,C)}},v.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var C=l[u];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},v.onError=function(o,l){if(w.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},v.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,C=l.groupId,E=l.url;if(o)try{E=o.addDirectives(E)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:E,id:u,groupId:C,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var l=this,u=this.media,C=this.subtitleDisplay,E=this.trackId;if(!u)return;var f=P(u.textTracks),A=f.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var T=A[E];T&&(T.mode="disabled")}var p=A[o];p&&(p.mode=C?"showing":"hidden")},v.setSubtitleTrack=function(o,l){var u,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=C[o])!==null&&u!==void 0&&u.details)||o<-1||o>=C.length)return;this.clearTimer();var E=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,E){var f=E.id,A=E.groupId,T=A===void 0?"":A,p=E.name,c=E.type,s=E.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:T,name:p,type:c,url:s});var a=this.switchParams(E.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=P(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")o=u;else if(l[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(g,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),g}(O.default);function P(w){for(var g=[],v=0;v<w.length;v++){var d=w[v];d.kind==="subtitles"&&d.label&&g.push(w[v])}return g}z.default=b},"./src/controller/timeline-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return P});var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),k=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),S=L("./src/utils/imsc1-ttml-parser.ts"),h=L("./src/types/loader.ts"),b=L("./src/utils/logger.ts"),P=function(){function d(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new B.default(this,"textTrack1"),C=new B.default(this,"textTrack2"),E=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new O.default(1,u,C),this.cea608Parser2=new O.default(3,E,f)}l.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(N.Events.FRAG_LOADING,this.onFragLoading,this),l.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(N.Events.FRAG_LOADING,this.onFragLoading,this),u.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,C,E,f,A){for(var T=!1,p=A.length;p--;){var c=A[p],s=g(c[0],c[1],C,E);if(s>=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],E),T=!0,s/(E-C)>.5))return}if(T||A.push([C,E]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,C,E,f)}else{var x=this.Cues.newCue(null,C,E,f);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:x,track:u})}},o.onInitPtsFound=function(u,C){var E=this,f=C.frag,A=C.id,T=C.initPTS,p=C.timescale,c=this.unparsedVttFrags;A==="main"&&(this.initPTS[f.cc]=T,this.timescale[f.cc]=p),c.length&&(this.unparsedVttFrags=[],c.forEach(function(s){E.onFragLoaded(N.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(u){var C=this.media;if(C)for(var E=0;E<C.textTracks.length;E++){var f=C.textTracks[E];if(f[u])return f}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var C=this.captionsProperties,E=this.captionsTracks,f=this.media,A=C[u],T=A.label,p=A.languageCode,c=this.getExistingTrack(u);if(c)E[u]=c,Object(R.clearCurrentCues)(E[u]),Object(R.sendAddTrackEvent)(E[u],f);else{var s=this.createTextTrack("captions",T,p);s&&(s[u]=!0,E[u]=s)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var C=this.captionsProperties[u];if(!C)return;var E=C.label,f={_id:u,label:E,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[u]=f,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(u,C,E){var f=this.media;return f?f.addTextTrack(u,C,E):void 0},o.onMediaAttaching=function(u,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(C){Object(R.clearCurrentCues)(u[C]),delete u[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var C=u.textTracks;if(C)for(var E=0;E<C.length;E++)Object(R.clearCurrentCues)(C[E])},o.onSubtitleTracksUpdated=function(u,C){var E=this;this.textTracks=[];var f=C.subtitleTracks||[],A=f.some(function(s){return s.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var T=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var x;if(a<p.length){for(var y=null,m=0;m<p.length;m++)if(w(p[m],s)){y=p[m];break}y&&(x=y)}x?Object(R.clearCurrentCues)(x):(x=E.createTextTrack("subtitles",s.name,s.lang),x&&(x.mode="disabled")),x&&(x.groupId=s.groupId,E.textTracks.push(x))})}else if(!T&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,C){var E=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(f){var A=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!A)return;var T="textTrack"+A[1],p=E.captionsProperties[T];if(!p)return;p.label=f.name,f.lang&&(p.languageCode=f.lang),p.media=f})},o.onFragLoading=function(u,C){var E=this.cea608Parser1,f=this.cea608Parser2,A=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(E&&f))return;if(C.frag.type===h.PlaylistLevelType.MAIN){var p,c,s=C.frag.sn,a=(p=C==null||((c=C.part)===null||c===void 0)?void 0:c.index)!=null?p:-1;s===A+1||s===A&&a===T+1||(E.reset(),f.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(u,C){var E=C.frag,f=C.payload,A=this.initPTS,T=this.unparsedVttFrags;if(E.type===h.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(K.isFiniteNumber)(A[E.cc])){T.push(C),A.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Missing initial subtitle PTS")});return}var p=E.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var c=this.tracks[E.level],s=this.vttCCs;s[E.cc]||(s[E.cc]={start:E.start,prevCC:this.prevCC,new:!0},this.prevCC=E.cc),c&&c.textCodec===S.IMSC1_CODEC?this._parseIMSC1(E,f):this._parseVTTs(E,f,s)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,C){var E=this,f=this.hls;Object(S.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(A){E._appendCues(A,u.level),f.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(A){b.logger.log("Failed to parse IMSC1: "+A),f.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:A})})},o._parseVTTs=function(u,C,E){var f=this,A=this.hls;Object(k.parseWebVTT)(C,this.initPTS[u.cc],this.timescale[u.cc],E,u.cc,u.start,function(T){f._appendCues(T,u.level),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(T){f._fallbackToIMSC1(u,C),b.logger.log("Failed to parse VTT cue: "+T),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:T})})},o._fallbackToIMSC1=function(u,C){var E=this,f=this.tracks[u.level];f.textCodec||Object(S.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(){f.textCodec=S.IMSC1_CODEC,E._parseIMSC1(u,C)},function(){f.textCodec="wvtt"})},o._appendCues=function(u,C){var E=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[C];if(f.mode==="disabled")return;u.forEach(function(p){return Object(R.addCueToTrack)(f,p)})}else{var A=this.tracks[C],T=A.default?"default":"subtitles"+C;E.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:u,track:T})}},o.onFragDecrypted=function(u,C){var E=C.frag;if(E.type===h.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[E.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(N.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,C){var E=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(E&&f))return;for(var A=0;A<C.samples.length;A++){var T=C.samples[A].bytes;if(T){var p=this.extractCea608Data(T);E.addData(C.samples[A].pts,p[0]),f.addData(C.samples[A].pts,p[1])}}},o.onBufferFlushing=function(u,C){var E=C.startOffset,f=C.endOffset,A=C.endOffsetSubtitles,T=C.type,p=this.media;if(!p||p.currentTime<f)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(R.removeCuesInRange)(c[a],E,f)})}if(this.config.renderTextTracksNatively&&(E===0&&A!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(R.removeCuesInRange)(s[a],E,A)})}},o.extractCea608Data=function(u){for(var C=u[0]&31,E=2,f=[[],[]],A=0;A<C;A++){var T=u[E++],p=127&u[E++],c=127&u[E++],s=(4&T)!==0,a=3&T;if(p===0&&c===0)continue;s&&((a===0||a===1)&&(f[a].push(p),f[a].push(c)))}return f},d}();function w(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function g(d,o,l,u){return Math.min(o,u)-Math.max(d,l)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function N(B,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=k}var O=N.prototype;return O.decrypt=function(k,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,k)},N}()},"./src/crypt/aes-decryptor.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return N}),L.d(z,"default",function(){return O});var K=L("./src/utils/typed-array.ts");function N(B){var k=B.byteLength,R=k&&new DataView(B.buffer).getUint8(k-1);return R?Object(K.sliceUint8)(B,0,k-R):B}var O=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=B.prototype;return k.uint8ArrayToUint32Array_=function(S){for(var h=new DataView(S),b=new Uint32Array(4),P=0;P<4;P++)b[P]=h.getUint32(P*4);return b},k.initTable=function(){var S=this.sBox,h=this.invSBox,b=this.subMix,P=b[0],w=b[1],g=b[2],v=b[3],d=this.invSubMix,o=d[0],l=d[1],u=d[2],C=d[3],E=new Uint32Array(256),f=0,A=0,T=0;for(T=0;T<256;T++)T<128?E[T]=T<<1:E[T]=T<<1^283;for(T=0;T<256;T++){var p=A^A<<1^A<<2^A<<3^A<<4;p=p>>>8^p&255^99,S[f]=p,h[p]=f;var c=E[f],s=E[c],a=E[s],x=E[p]*257^p*16843008;P[f]=x<<24|x>>>8,w[f]=x<<16|x>>>16,g[f]=x<<8|x>>>24,v[f]=x,x=a*16843009^s*65537^c*257^f*16843008,o[p]=x<<24|x>>>8,l[p]=x<<16|x>>>16,u[p]=x<<8|x>>>24,C[p]=x,f?(f=c^E[E[E[a^c]]],A^=E[E[A]]):f=A=1}},k.expandKey=function(S){for(var h=this.uint8ArrayToUint32Array_(S),b=!0,P=0;P<h.length&&b;)b=h[P]===this.key[P],P++;if(b)return;this.key=h;var w=this.keySize=h.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var g=this.ksRows=(w+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(g),l=this.invKeySchedule=new Uint32Array(g),u=this.sBox,C=this.rcon,E=this.invSubMix,f=E[0],A=E[1],T=E[2],p=E[3],c,s;for(v=0;v<g;v++){if(v<w){c=o[v]=h[v];continue}s=c,v%w===0?(s=s<<8|s>>>24,s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255],s^=C[v/w|0]<<24):w>6&&v%w===4&&(s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255]),o[v]=c=(o[v-w]^s)>>>0}for(d=0;d<g;d++)v=g-d,d&3?s=o[v]:s=o[v-4],d<4||v<=4?l[d]=s:l[d]=f[u[s>>>24]]^A[u[s>>>16&255]]^T[u[s>>>8&255]]^p[u[s&255]],l[d]=l[d]>>>0},k.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},k.decrypt=function(S,h,b){for(var P=this.keySize+6,w=this.invKeySchedule,g=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],l=v[2],u=v[3],C=this.uint8ArrayToUint32Array_(b),E=C[0],f=C[1],A=C[2],T=C[3],p=new Int32Array(S),c=new Int32Array(p.length),s,a,x,y,m,D,U,F,W,M,I,H,X,ee,ae=this.networkToHostOrderSwap;h<p.length;){for(W=ae(p[h]),M=ae(p[h+1]),I=ae(p[h+2]),H=ae(p[h+3]),m=W^w[0],D=H^w[1],U=I^w[2],F=M^w[3],X=4,ee=1;ee<P;ee++)s=d[m>>>24]^o[D>>16&255]^l[U>>8&255]^u[F&255]^w[X],a=d[D>>>24]^o[U>>16&255]^l[F>>8&255]^u[m&255]^w[X+1],x=d[U>>>24]^o[F>>16&255]^l[m>>8&255]^u[D&255]^w[X+2],y=d[F>>>24]^o[m>>16&255]^l[D>>8&255]^u[U&255]^w[X+3],m=s,D=a,U=x,F=y,X=X+4;s=g[m>>>24]<<24^g[D>>16&255]<<16^g[U>>8&255]<<8^g[F&255]^w[X],a=g[D>>>24]<<24^g[U>>16&255]<<16^g[F>>8&255]<<8^g[m&255]^w[X+1],x=g[U>>>24]<<24^g[F>>16&255]<<16^g[m>>8&255]<<8^g[D&255]^w[X+2],y=g[F>>>24]<<24^g[m>>16&255]<<16^g[D>>8&255]<<8^g[U&255]^w[X+3],c[h]=ae(s^E),c[h+1]=ae(y^f),c[h+2]=ae(x^A),c[h+3]=ae(a^T),E=W,f=M,A=I,T=H,h=h+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return h});var K=L("./src/crypt/aes-crypto.ts"),N=L("./src/crypt/fast-aes-key.ts"),O=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/typed-array.ts"),S=16,h=function(){function b(w,g,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=g,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=b.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var g=this.currentResult;if(!g){this.reset();return}var v=new Uint8Array(g);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(v):v},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(g,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(g),v,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(g),v,d).then(o)},P.softwareDecrypt=function(g,v,d){var o=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(g=Object(k.appendUint8Array)(u,g),this.remainderData=null);var C=this.getValidChunk(g);if(!C.length)return null;o&&(d=o);var E=this.softwareDecrypter;E||(E=this.softwareDecrypter=new O.default),E.expandKey(v);var f=l;return this.currentResult=E.decrypt(C.buffer,0,d),this.currentIV=Object(R.sliceUint8)(C,-16).buffer,f||null},P.webCryptoDecrypt=function(g,v,d){var o=this,l=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new N.default(l,v)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new K.default(l,d);return C.decrypt(g.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,g,v,d)})},P.onWebCryptoError=function(g,v,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",g),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},P.getValidChunk=function(g){var v=g,d=g.length-g.length%S;return d!==g.length&&(v=Object(R.sliceUint8)(g,0,d),this.remainderData=Object(R.sliceUint8)(g,d)),v},P.logOnce=function(g){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+g),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function N(B,k){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=k}var O=N.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),N=L("./src/demux/adts.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function k(h,b){h.prototype=Object.create(b.prototype),h.prototype.constructor=h,R(h,b)}function R(h,b){return R=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},R(h,b)}var S=function(h){k(b,h);function b(w,g){var v;return v=h.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=w,v.config=g,v}var P=b.prototype;return P.resetInitSegment=function(g,v,d){h.prototype.resetInitSegment.call(this,g,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:g,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(g){if(!g)return!1;for(var v=B.getID3Data(g,0)||[],d=v.length,o=g.length;d<o;d++)if(N.probe(g,d))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(g,v){return N.canParse(g,v)},P.appendFrame=function(g,v,d){N.initTrackConfig(g,this.observer,v,d,g.manifestCodec);var o=N.appendFrame(g,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},b}(K.default);S.minProbeByteLength=9,z.default=S},"./src/demux/adts.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return B}),L.d(z,"isHeaderPattern",function(){return k}),L.d(z,"getHeaderLength",function(){return R}),L.d(z,"getFullFrameLength",function(){return S}),L.d(z,"canGetFrameLength",function(){return h}),L.d(z,"isHeader",function(){return b}),L.d(z,"canParse",function(){return P}),L.d(z,"probe",function(){return w}),L.d(z,"initTrackConfig",function(){return g}),L.d(z,"getFrameDuration",function(){return v}),L.d(z,"parseFrameHeader",function(){return d}),L.d(z,"appendFrame",function(){return o});var K=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),O=L("./src/events.ts");function B(l,u,C,E){var f,A,T,p,c=navigator.userAgent.toLowerCase(),s=E,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((u[C+2]&192)>>>6)+1;var x=(u[C+2]&60)>>>2;if(x>a.length-1){l.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return T=(u[C+2]&1)<<2,T|=(u[C+3]&192)>>>6,K.logger.log("manifest codec:"+E+", ADTS type:"+f+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(f=5,p=new Array(4),A=x-3):(f=2,p=new Array(2),A=x):c.indexOf("android")!==-1?(f=2,p=new Array(2),A=x):(f=5,p=new Array(4),E&&(E.indexOf("mp4a.40.29")!==-1||E.indexOf("mp4a.40.5")!==-1)||!E&&x>=6?A=x-3:((E&&E.indexOf("mp4a.40.2")!==-1&&(x>=6&&T===1||/vivaldi/i.test(c))||!E&&T===1)&&(f=2,p=new Array(2)),A=x)),p[0]=f<<3,p[0]|=(x&14)>>1,p[1]|=(x&1)<<7,p[1]|=T<<3,f===5&&(p[1]|=(A&14)>>1,p[2]=(A&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[x],channelCount:T,codec:"mp4a.40."+f,manifestCodec:s}}function k(l,u){return l[u]===255&&(l[u+1]&246)===240}function R(l,u){return l[u+1]&1?7:9}function S(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function h(l,u){return u+5<l.length}function b(l,u){return u+1<l.length&&k(l,u)}function P(l,u){return h(l,u)&&k(l,u)&&S(l,u)<=l.length-u}function w(l,u){if(b(l,u)){var C=R(l,u);if(u+C>=l.length)return!1;var E=S(l,u);if(E<=C)return!1;var f=u+E;return f===l.length||b(l,f)}return!1}function g(l,u,C,E,f){if(!l.samplerate){var A=B(u,C,E,f);if(!A)return;l.config=A.config,l.samplerate=A.samplerate,l.channelCount=A.channelCount,l.codec=A.codec,l.manifestCodec=A.manifestCodec,K.logger.log("parsed codec:"+l.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function v(l){return 1024*9e4/l}function d(l,u,C,E,f){var A=R(l,u),T=S(l,u);if(T-=A,T>0){var p=C+E*f;return{headerLength:A,frameLength:T,stamp:p}}}function o(l,u,C,E,f){var A=v(l.samplerate),T=d(u,C,E,f,A);if(T){var p=T.frameLength,c=T.headerLength,s=T.stamp,a=c+p,x=Math.max(0,C+a-u.length),y;x?(y=new Uint8Array(a-c),y.set(u.subarray(C+c,u.length),0)):y=u.subarray(C+c,C+a);var m={unit:y,pts:s};return x||l.samples.push(m),{sample:m,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return S});var K=L("./src/polyfills/number.ts"),N=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/typed-array.ts"),R=function(){function h(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=h.prototype;return b.resetInitSegment=function(w,g,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(w,g){return!1},b.appendFrame=function(w,g,v){},b.demux=function(w,g){this.cachedData&&(w=Object(B.appendUint8Array)(this.cachedData,w),this.cachedData=null);var v=N.getID3Data(w,0),d=v?v.length:0,o,l,u=this._audioTrack,C=this._id3Track,E=v?N.getTimeStamp(v):void 0,f=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(E,g)),v&&v.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),l=this.initPTS;d<f;){if(this.canParse(w,d)){var A=this.appendFrame(u,w,d);A?(this.frameIndex++,l=A.sample.pts,d+=A.length,o=d):d=f}else N.canParse(w,d)?(v=N.getID3Data(w,d),C.samples.push({pts:l,dts:l,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var T=Object(k.sliceUint8)(w,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:u,avcTrack:Object(O.dummyTrack)(),id3Track:C,textTrack:Object(O.dummyTrack)()}},b.demuxSampleAes=function(w,g,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(w){var g=this.cachedData;return g&&(this.cachedData=null,this.demux(g,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},b.destroy=function(){},h}(),S=function(b,P){return Object(K.isFiniteNumber)(b)?b*90:P*9e4};z.default=R},"./src/demux/chunk-cache.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function O(){this.chunks=[],this.dataLength=0}var B=O.prototype;return B.push=function(R){this.chunks.push(R),this.dataLength+=R.length},B.flush=function(){var R=this.chunks,S=this.dataLength,h;if(R.length)R.length===1?h=R[0]:h=N(R,S);else return new Uint8Array(0);return this.reset(),h},B.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function N(O,B){for(var k=new Uint8Array(B),R=0,S=0;S<O.length;S++){var h=O[S];k.set(h,R),R+=h.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),N=function(){function O(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var B=O.prototype;return B.loadWord=function(){var R=this.data,S=this.bytesAvailable,h=R.byteLength-S,b=new Uint8Array(4),P=Math.min(4,S);if(P===0)throw new Error("no bytes available");b.set(R.subarray(h,h+P)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},B.skipBits=function(R){var S;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,S=R>>3,R-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},B.readBits=function(R){var S=Math.min(this.bitsAvailable,R),h=this.word>>>32-S;return R>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=S,this.bitsAvailable>0?this.word<<=S:this.bytesAvailable>0&&this.loadWord(),S=R-S,S>0&&this.bitsAvailable?h<<S|this.readBits(S):h},B.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},B.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>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(R){for(var S=8,h=8,b,P=0;P<R;P++)h!==0&&(b=this.readEG(),h=(S+b+256)%256),S=h===0?S:h},B.readSPS=function(){var R=0,S=0,h=0,b=0,P,w,g,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),C=this.skipEG.bind(this),E=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var A=v();if(d(5),u(3),v(),E(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var T=o();if(T===3&&u(1),E(),E(),u(1),l())for(w=T!==3?8:12,g=0;g<w;g++)l()&&(g<6?f(16):f(64))}E();var p=o();if(p===0)o();else if(p===1)for(u(1),C(),C(),P=o(),g=0;g<P;g++)C();E(),u(1);var c=o(),s=o(),a=d(1);a===0&&u(1),u(1),l()&&(R=o(),S=o(),h=o(),b=o());var x=[1,1];if(l()&&l()){var y=v();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-R*2-S*2),height:(2-a)*(s+1)*16-(a?2:4)*(h+b),pixelRatio:x}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();z.default=N},"./src/demux/id3.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return K}),L.d(z,"isFooter",function(){return N}),L.d(z,"getID3Data",function(){return O}),L.d(z,"canParse",function(){return k}),L.d(z,"getTimeStamp",function(){return R}),L.d(z,"isTimeStampFrame",function(){return S}),L.d(z,"getID3Frames",function(){return b}),L.d(z,"decodeFrame",function(){return P}),L.d(z,"utf8ArrayToStr",function(){return o}),L.d(z,"testables",function(){return l});var K=function(f,A){return A+10<=f.length&&(f[A]===73&&f[A+1]===68&&f[A+2]===51&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},N=function(f,A){return A+10<=f.length&&(f[A]===51&&f[A+1]===68&&f[A+2]===73&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},O=function(f,A){for(var T=A,p=0;K(f,A);){p+=10;var c=B(f,A+6);p+=c,N(f,A+10)&&(p+=10),A+=p}return p>0?f.subarray(T,T+p):void 0},B=function(f,A){var T=0;return T=(f[A]&127)<<21,T|=(f[A+1]&127)<<14,T|=(f[A+2]&127)<<7,T|=f[A+3]&127,T},k=function(f,A){return K(f,A)&&B(f,A+6)+10<=f.length-A},R=function(f){for(var A=b(f),T=0;T<A.length;T++){var p=A[T];if(S(p))return d(p)}return},S=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},h=function(f){var A=String.fromCharCode(f[0],f[1],f[2],f[3]),T=B(f,4),p=10;return{type:A,size:T,data:f.subarray(p,p+T)}},b=function(f){for(var A=0,T=[];K(f,A);){var p=B(f,A+6);A+=10;for(var c=A+p;A+8<c;){var s=h(f.subarray(A)),a=P(s);a&&T.push(a),A+=s.size+10}N(f,A)&&(A+=10)}return T},P=function(f){return f.type==="PRIV"?w(f):f.type[0]==="W"?v(f):g(f)},w=function(f){if(f.size<2)return;var A=o(f.data,!0),T=new Uint8Array(f.data.subarray(A.length+1));return{key:f.type,info:A,data:T.buffer}},g=function(f){if(f.size<2)return;if(f.type==="TXXX"){var A=1,T=o(f.data.subarray(A),!0);A+=T.length+1;var p=o(f.data.subarray(A));return{key:f.type,info:T,data:p}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var A=1,T=o(f.data.subarray(A),!0);A+=T.length+1;var p=o(f.data.subarray(A));return{key:f.type,info:T,data:p}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var A=new Uint8Array(f.data),T=A[3]&1,p=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return p/=45,T&&(p+=4772185884e-2),Math.round(p)}return},o=function(f,A){A===void 0&&(A=!1);var T=C();if(T){var p=T.decode(f);if(A){var c=p.indexOf("\0");return c!==-1?p.substring(0,c):p}return p.replace(/\0/g,"")}for(var s=f.length,a,x,y,m="",D=0;D<s;){if(a=f[D++],a===0&&A)return m;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:m+=String.fromCharCode(a);break;case 12:case 13:x=f[D++],m+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=f[D++],y=f[D++],m+=String.fromCharCode((a&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return m},l={decodeTextFrame:g},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),N=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function k(h,b){h.prototype=Object.create(b.prototype),h.prototype.constructor=h,R(h,b)}function R(h,b){return R=Object.setPrototypeOf||function(w,g){return w.__proto__=g,w},R(h,b)}var S=function(h){k(b,h);function b(){return h.apply(this,arguments)||this}var P=b.prototype;return P.resetInitSegment=function(g,v,d){h.prototype.resetInitSegment.call(this,g,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:g,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(g){if(!g)return!1;for(var v=N.getID3Data(g,0)||[],d=v.length,o=g.length;d<o;d++)if(B.probe(g,d))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(g,v){return B.canParse(g,v)},P.appendFrame=function(g,v,d){return this.initPTS===null?void 0:B.appendFrame(g,v,d,this.initPTS,this.frameIndex)},b}(K.default);S.minProbeByteLength=4,z.default=S},"./src/demux/mp4demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/mp4-tools.ts"),N=L("./src/demux/dummy-demuxed-track.ts"),O=function(){function B(R,S){this.remainderData=null,this.config=void 0,this.config=S}var k=B.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},B.probe=function(S){return Object(K.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},k.demux=function(S){var h=S,b=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(h=Object(K.appendUint8Array)(this.remainderData,S));var P=Object(K.segmentValidRange)(h);this.remainderData=P.remainder,b.samples=P.valid||new Uint8Array}else b.samples=h;return{audioTrack:Object(N.dummyTrack)(),avcTrack:b,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},k.flush=function(){var S=Object(N.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:S,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},k.demuxSampleAes=function(S,h,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},B}();O.minProbeByteLength=1024,z.default=O},"./src/demux/mpegaudio.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return R}),L.d(z,"parseHeader",function(){return S}),L.d(z,"isHeaderPattern",function(){return h}),L.d(z,"isHeader",function(){return b}),L.d(z,"canParse",function(){return P}),L.d(z,"probe",function(){return w});var K=null,N=[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],O=[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]],k=[0,1,1,4];function R(g,v,d,o,l){if(d+24>v.length)return;var u=S(v,d);if(u&&d+u.frameLength<=v.length){var C=u.samplesPerFrame*9e4/u.sampleRate,E=o+l*C,f={unit:v.subarray(d,d+u.frameLength),pts:E,dts:E};return g.config=[],g.channelCount=u.channelCount,g.samplerate=u.sampleRate,g.samples.push(f),{sample:f,length:u.frameLength,missing:0}}}function S(g,v){var d=g[v+1]>>3&3,o=g[v+1]>>1&3,l=g[v+2]>>4&15,u=g[v+2]>>2&3;if(d!==1&&l!==0&&l!==15&&u!==3){var C=g[v+2]>>1&1,E=g[v+3]>>6,f=d===3?3-o:o===3?3:4,A=N[f*14+l-1]*1e3,T=d===3?0:d===2?1:2,p=O[T*3+u],c=E===3?1:2,s=B[d][o],a=k[o],x=s*8*a,y=Math.floor(s*A/p+C)*a;if(K===null){var m=navigator.userAgent||"",D=m.match(/Chrome\/(\d+)/i);K=D?parseInt(D[1]):0}var U=!!K&&K<=87;return U&&o===2&&A>=224e3&&E===0&&(g[v+3]=g[v+3]|128),{sampleRate:p,channelCount:c,frameLength:y,samplesPerFrame:x}}}function h(g,v){return g[v]===255&&(g[v+1]&224)===224&&(g[v+1]&6)!==0}function b(g,v){return v+1<g.length&&h(g,v)}function P(g,v){var d=4;return h(g,v)&&d<=g.length-v}function w(g,v){if(v+1<g.length&&h(g,v)){var d=4,o=S(g,v),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var u=v+l;return u===g.length||b(g,u)}return!1}},"./src/demux/sample-aes.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/crypt/decrypter.ts"),N=L("./src/demux/tsdemuxer.ts"),O=function(){function B(R,S,h){this.keyData=void 0,this.decrypter=void 0,this.keyData=h,this.decrypter=new K.default(R,S,{removePKCS7Padding:!1})}var k=B.prototype;return k.decryptBuffer=function(S,h){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,h)},k.decryptAacSample=function(S,h,b,P){var w=S[h].unit,g=w.subarray(16,w.length-w.length%16),v=g.buffer.slice(g.byteOffset,g.byteOffset+g.length),d=this;this.decryptBuffer(v,function(o){var l=new Uint8Array(o);w.set(l,16),P||d.decryptAacSamples(S,h+1,b)})},k.decryptAacSamples=function(S,h,b){for(;;h++){if(h>=S.length){b();return}if(S[h].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(S,h,b,P),!P)return}},k.getAvcEncryptedData=function(S){for(var h=Math.floor((S.length-48)/160)*16+16,b=new Int8Array(h),P=0,w=32;w<=S.length-16;w+=160,P+=16)b.set(S.subarray(w,w+16),P);return b},k.getAvcDecryptedUnit=function(S,h){for(var b=new Uint8Array(h),P=0,w=32;w<=S.length-16;w+=160,P+=16)S.set(b.subarray(P,P+16),w);return S},k.decryptAvcSample=function(S,h,b,P,w,g){var v=Object(N.discardEPB)(w.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(l){w.data=o.getAvcDecryptedUnit(v,l),g||o.decryptAvcSamples(S,h,b+1,P)})},k.decryptAvcSamples=function(S,h,b,P){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;h++,b=0){if(h>=S.length){P();return}for(var w=S[h].units;!(b>=w.length);b++){var g=w[b];if(g.data.length<=48||g.type!==1&&g.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(S,h,b,P,g,v),!v)return}}},B}();z.default=O},"./src/demux/transmuxer-interface.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./node_modules/webworkify-webpack/index.js"),N=L.n(K),O=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),k=L("./src/utils/logger.ts"),R=L("./src/errors.ts"),S=L("./src/utils/mediasource-helper.ts"),h=L("./node_modules/eventemitter3/index.js"),b=L.n(h),P=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function g(d,o,l,u){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var E=d.config,f=function(s,a){a=a||{},a.frag=C.frag,a.id=C.id,d.trigger(s,a)};this.observer=new h.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,f),this.observer.on(O.Events.ERROR,f);var A={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(E.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var p;try{p=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(c){d.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},p.postMessage({cmd:"init",typeSupported:A,vendor:T,id:o,config:JSON.stringify(E)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new B.default(this.observer,A,E,T,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,E,T,o)}var v=g.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},v.push=function(o,l,u,C,E,f,A,T,p,c){var s=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,y=f?f.start:E.start,m=E.decryptdata,D=this.frag,U=!(D&&E.cc===D.cc),F=!(D&&p.level===D.level),W=D?p.sn-D.sn:-1,M=this.part?p.part-this.part.index:1,I=!F&&(W===1||W===0&&M===1),H=self.performance.now();(F||W||E.stats.parsing.start===0)&&(E.stats.parsing.start=H),f&&(M||!I)&&(f.stats.parsing.start=H);var X=new B.TransmuxState(U,I,T,F,y);if(!I||U){k.logger.log("[transmuxer-interface, "+E.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+F+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+y);var ee=new B.TransmuxConfig(u,C,l,A,c);this.configureTransmuxer(ee)}if(this.frag=E,this.part=f,x)x.postMessage({cmd:"demux",data:o,decryptdata:m,chunkMeta:p,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var ae=a.push(o,m,p,X);Object(B.isPromise)(ae)?ae.then(function(be){s.handleTransmuxComplete(be)}):this.handleTransmuxComplete(ae)}},v.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(u){var E=u.flush(o);Object(B.isPromise)(E)?E.then(function(f){l.handleFlushResult(f,o)}):this.handleFlushResult(E,o)}},v.handleFlushResult=function(o,l){var u=this;o.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(l)},v.onWorkerMessage=function(o){var l=o.data,u=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,u.trigger(l.event,l.data);break}}},v.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},g}()},"./src/demux/transmuxer-worker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/demux/transmuxer.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),k=L.n(B);function R(w){var g=new B.EventEmitter,v=function(o,l){w.postMessage({event:o,data:l})};g.on(N.Events.FRAG_DECRYPTED,v),g.on(N.Events.ERROR,v),w.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);w.transmuxer=new K.default(g,o.typeSupported,l,o.vendor,o.id),Object(O.enableLogs)(l.debug),v("init",null);break}case"configure":{w.transmuxer.configure(o.config);break}case"demux":{var u=w.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(K.isPromise)(u)?u.then(function(f){S(w,f)}):S(w,u);break}case"flush":{var C=o.chunkMeta,E=w.transmuxer.flush(C);Object(K.isPromise)(E)?E.then(function(f){b(w,f,C)}):b(w,E,C);break}default:break}})}function S(w,g){if(P(g.remuxResult))return;var v=[],d=g.remuxResult,o=d.audio,l=d.video;o&&h(v,o),l&&h(v,l),w.postMessage({event:"transmuxComplete",data:g},v)}function h(w,g){g.data1&&w.push(g.data1.buffer),g.data2&&w.push(g.data2.buffer)}function b(w,g,v){g.forEach(function(d){S(w,d)}),w.postMessage({event:"flush",data:v})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return l}),L.d(z,"isPromise",function(){return E}),L.d(z,"TransmuxConfig",function(){return f}),L.d(z,"TransmuxState",function(){return A});var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),k=L("./src/demux/mp4demuxer.ts"),R=L("./src/demux/tsdemuxer.ts"),S=L("./src/demux/mp3demuxer.ts"),h=L("./src/remux/mp4-remuxer.ts"),b=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),g=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(T){g.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:R.default,remux:h.default},{demux:k.default,remux:b.default},{demux:B.default,remux:h.default},{demux:S.default,remux:h.default}],o=1024;d.forEach(function(T){var p=T.demux;o=Math.max(o,p.minProbeByteLength)});var l=function(){function T(c,s,a,x,y){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 P.default,this.observer=c,this.typeSupported=s,this.config=a,this.vendor=x,this.id=y}var p=T.prototype;return p.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},p.push=function(s,a,x,y){var m=this,D=x.transmuxing;D.executeStart=v();var U=new Uint8Array(s),F=this.cache,W=this.config,M=this.currentTransmuxState,I=this.transmuxConfig;y&&(this.currentTransmuxState=y);var H=u(U,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var ee=X.softwareDecrypt(U,H.key.buffer,H.iv.buffer);if(!ee)return D.executeEnd=v(),C(x);U=new Uint8Array(ee)}else return this.decryptionPromise=X.webCryptoDecrypt(U,H.key.buffer,H.iv.buffer).then(function(ve){var Te=m.push(ve,null,x);return m.decryptionPromise=null,Te}),this.decryptionPromise}var ae=y||M,be=ae.contiguous,pe=ae.discontinuity,ue=ae.trackSwitch,se=ae.accurateTimeOffset,fe=ae.timeOffset,ne=I.audioCodec,me=I.videoCodec,Q=I.defaultInitPts,ie=I.duration,te=I.initSegmentData;if((pe||ue)&&this.resetInitSegment(te,ne,me,ie),pe&&this.resetInitialTimestamp(Q),be||this.resetContiguity(),this.needsProbing(U,pe,ue)){if(F.dataLength){var Ee=F.flush();U=Object(w.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,I)}var _e=this.transmux(U,H,fe,se,x),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,D.executeEnd=v(),_e},p.flush=function(s){var a=this,x=s.transmuxing;x.executeStart=v();var y=this.decrypter,m=this.cache,D=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(s)});var F=[],W=D.timeOffset;if(y){var M=y.flush();M&&F.push(this.push(M,null,s))}var I=m.dataLength;m.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return I>=o&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=v(),[C(s)];var ee=H.flush(W);return E(ee)?ee.then(function(ae){return a.flushRemux(F,ae,s),F}):(this.flushRemux(F,ee,s),F)},p.flushRemux=function(s,a,x){var y=a.audioTrack,m=a.avcTrack,D=a.id3Track,U=a.textTrack,F=this.currentTransmuxState,W=F.accurateTimeOffset,M=F.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var I=this.remuxer.remux(y,m,D,U,M,W,!0,this.id);s.push({remuxResult:I,chunkMeta:x}),x.transmuxing.executeEnd=v()},p.resetInitialTimestamp=function(s){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(s),x.resetTimeStamp(s)},p.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(s,a,x,y){var m=this.demuxer,D=this.remuxer;if(!m||!D)return;m.resetInitSegment(a,x,y),D.resetInitSegment(s,a,x)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(s,a,x,y,m){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(s,a,x,y,m):D=this.transmuxUnencrypted(s,x,y,m),D},p.transmuxUnencrypted=function(s,a,x,y){var m=this.demuxer.demux(s,a,!1,!this.config.progressive),D=m.audioTrack,U=m.avcTrack,F=m.id3Track,W=m.textTrack,M=this.remuxer.remux(D,U,F,W,a,x,!1,this.id);return{remuxResult:M,chunkMeta:y}},p.transmuxSampleAes=function(s,a,x,y,m){var D=this;return this.demuxer.demuxSampleAes(s,a,x).then(function(U){var F=D.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,y,!1,D.id);return{remuxResult:F,chunkMeta:m}})},p.configureTransmuxer=function(s,a){for(var x=this.config,y=this.observer,m=this.typeSupported,D=this.vendor,U=a.audioCodec,F=a.defaultInitPts,W=a.duration,M=a.initSegmentData,I=a.videoCodec,H,X=0,ee=d.length;X<ee;X++)if(d[X].demux.probe(s)){H=d[X];break}H||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:k.default,remux:b.default});var ae=this.demuxer,be=this.remuxer,pe=H.remux,ue=H.demux;(!be||!(be instanceof pe))&&(this.remuxer=new pe(y,x,m,D)),(!ae||!(ae instanceof ue))&&(this.demuxer=new ue(y,x,m),this.probe=ue.probe),this.resetInitSegment(M,U,I,W),this.resetInitialTimestamp(F)},p.needsProbing=function(s,a,x){return!this.demuxer||!this.remuxer||a||x},p.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new O.default(this.observer,this.config)),s},T}();function u(T,p){var c=null;return T.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(c=p),c}var C=function(p){return{remuxResult:{},chunkMeta:p}};function E(T){return"then"in T&&T.then instanceof Function}var f=function(p,c,s,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=c,this.initSegmentData=s,this.duration=a,this.defaultInitPts=x},A=function(p,c,s,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=c,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return C});var K=L("./src/demux/adts.ts"),N=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),k=L("./src/demux/sample-aes.ts"),R=L("./src/events.ts"),S=L("./src/utils/mp4-tools.ts"),h=L("./src/utils/logger.ts"),b=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function E(A,T,p){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=A,this.config=T,this.typeSupported=p}E.probe=function(T){var p=E.syncOffset(T);return p<0?!1:(p&&h.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},E.syncOffset=function(T){for(var p=Math.min(1e3,T.length-3*188),c=0;c<p;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},E.createTrack=function(T,p){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:P[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?p:void 0}};var f=E.prototype;return f.resetInitSegment=function(T,p,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=E.createTrack("video",c),this._audioTrack=E.createTrack("audio",c),this._id3Track=E.createTrack("id3",c),this._txtTrack=E.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=p,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var T=this._audioTrack,p=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),p&&(p.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(T,p,c,s){c===void 0&&(c=!1),s===void 0&&(s=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,y=this._audioTrack,m=this._id3Track,D=x.pid,U=x.pesData,F=y.pid,W=m.pid,M=y.pesData,I=m.pesData,H=!1,X=this.pmtParsed,ee=this._pmtId,ae=T.length;if(this.remainderData&&(T=Object(S.appendUint8Array)(this.remainderData,T),ae=T.length,this.remainderData=null),ae<188&&!s)return this.remainderData=T,{audioTrack:y,avcTrack:x,id3Track:m,textTrack:this._txtTrack};var be=Math.max(0,E.syncOffset(T));ae-=(ae+be)%188,ae<T.byteLength&&!s&&(this.remainderData=new Uint8Array(T.buffer,ae,T.buffer.byteLength-ae));for(var pe=be;pe<ae;pe+=188)if(T[pe]===71){var ue=!!(T[pe+1]&64),se=((T[pe+1]&31)<<8)+T[pe+2],fe=(T[pe+3]&48)>>4,ne=void 0;if(fe>1){if(ne=pe+5+T[pe+4],ne===pe+188)continue}else ne=pe+4;switch(se){case D:ue&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(ne,pe+188)),U.size+=pe+188-ne);break;case F:ue&&(M&&(a=o(M))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(T.subarray(ne,pe+188)),M.size+=pe+188-ne);break;case W:ue&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(T.subarray(ne,pe+188)),I.size+=pe+188-ne);break;case 0:ue&&(ne+=T[ne]+1),ee=this._pmtId=v(T,ne);break;case ee:{ue&&(ne+=T[ne]+1);var me=d(T,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);D=me.avc,D>0&&(x.pid=D),F=me.audio,F>0&&(y.pid=F,y.isAAC=me.isAAC),W=me.id3,W>0&&(m.pid=W),H&&!X&&(h.logger.log("reparse from beginning"),H=!1,pe=be-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,y.pesData=M,m.pesData=I;var Q={audioTrack:y,avcTrack:x,id3Track:m,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(Q),Q},f.flush=function(){var T=this.remainderData;this.remainderData=null;var p;return T?p=this.demux(T,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},f.extractRemainingSamples=function(T){var p=T.audioTrack,c=T.avcTrack,s=T.id3Track,a=c.pesData,x=p.pesData,y=s.pesData,m;a&&(m=o(a))?(this.parseAVCPES(m,!0),c.pesData=null):c.pesData=a,x&&(m=o(x))?(p.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),p.pesData=null):(x!=null&&x.size&&h.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=x),y&&(m=o(y))?(this.parseID3PES(m),s.pesData=null):s.pesData=y},f.demuxSampleAes=function(T,p,c){var s=this.demux(T,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,p);return this.decrypt(s,a)},f.decrypt=function(T,p){return new Promise(function(c){var s=T.audioTrack,a=T.avcTrack;s.samples&&s.isAAC?p.decryptAacSamples(s.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){c(T)}):c(T)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){c(T)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(T,p){var c=this,s=this._avcTrack,a=this.parseAVCNALu(T.data),x=!1,y=this.avcSample,m,D=!1;T.data=null,y&&a.length&&!s.audFound&&(l(y,s),y=this.avcSample=g(!1,T.pts,T.dts,"")),a.forEach(function(U){switch(U.type){case 1:{m=!0,y||(y=c.avcSample=g(!0,T.pts,T.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var F=U.data;if(D&&F.length>4){var W=new O.default(F).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:m=!0,y||(y=c.avcSample=g(!0,T.pts,T.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{m=!0,x&&y&&(y.debug+="SEI ");var M=new O.default(C(U.data));M.readUByte();for(var I=0,H=0,X=!1,ee=0;!X&&M.bytesAvailable>1;){I=0;do ee=M.readUByte(),I+=ee;while(ee===255);H=0;do ee=M.readUByte(),H+=ee;while(ee===255);if(I===4&&M.bytesAvailable!==0){X=!0;var ae=M.readUByte();if(ae===181){var be=M.readUShort();if(be===49){var pe=M.readUInt();if(pe===1195456820){var ue=M.readUByte();if(ue===3){for(var se=M.readUByte(),fe=M.readUByte(),ne=31&se,me=[se,fe],Q=0;Q<ne;Q++)me.push(M.readUByte()),me.push(M.readUByte()),me.push(M.readUByte());u(c._txtTrack.samples,{type:3,pts:T.pts,bytes:me})}}}}}else if(I===5&&M.bytesAvailable!==0){if(X=!0,H>16){for(var ie=[],te=0;te<16;te++)ie.push(M.readUByte().toString(16)),(te===3||te===5||te===7||te===9)&&ie.push("-");for(var Ee=H-16,_e=new Uint8Array(Ee),ye=0;ye<Ee;ye++)_e[ye]=M.readUByte();u(c._txtTrack.samples,{pts:T.pts,payloadType:I,uuid:ie.join(""),userData:Object(B.utf8ArrayToStr)(_e),userDataBytes:_e})}}else if(H<M.bytesAvailable)for(var ve=0;ve<H;ve++)M.readUByte()}break}case 7:if(m=!0,D=!0,x&&y&&(y.debug+="SPS "),!s.sps){var Te=new O.default(U.data),De=Te.readSPS();s.width=De.width,s.height=De.height,s.pixelRatio=De.pixelRatio,s.sps=[U.data],s.duration=c._duration;for(var Re=U.data.subarray(1,4),Ce="avc1.",Le=0;Le<3;Le++){var ze=Re[Le].toString(16);ze.length<2&&(ze="0"+ze),Ce+=ze}s.codec=Ce}break;case 8:m=!0,x&&y&&(y.debug+="PPS "),s.pps||(s.pps=[U.data]);break;case 9:m=!1,s.audFound=!0,y&&l(y,s),y=c.avcSample=g(!1,T.pts,T.dts,x?"AUD ":"");break;case 12:m=!1;break;default:m=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&m){var Ve=y.units;Ve.push(U)}}),p&&y&&(l(y,s),this.avcSample=null)},f.getLastNalUnit=function(){var T,p=this.avcSample,c;if(!p||p.units.length===0){var s=this._avcTrack.samples;p=s[s.length-1]}if((T=p)!==null&&T!==void 0&&T.units){var a=p.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(T){var p=T.byteLength,c=this._avcTrack,s=c.naluState||0,a=s,x=[],y=0,m,D,U,F=-1,W=0;for(s===-1&&(F=0,W=T[0]&31,s=0,y=1);y<p;){if(m=T[y++],!s){s=m?0:1;continue}if(s===1){s=m?0:2;continue}if(!m)s=3;else if(m===1){if(F>=0){var M={data:T.subarray(F,y-s-1),type:W};x.push(M)}else{var I=this.getLastNalUnit();if(I&&(a&&y<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),D=y-s-1,D>0)){var H=new Uint8Array(I.data.byteLength+D);H.set(I.data,0),H.set(T.subarray(0,D),I.data.byteLength),I.data=H,I.state=0}}y<p?(U=T[y]&31,F=y,W=U,s=0):s=-1}else s=0}if(F>=0&&s>=0){var X={data:T.subarray(F,p),type:W,state:s};x.push(X)}if(x.length===0){var ee=this.getLastNalUnit();if(ee){var ae=new Uint8Array(ee.data.byteLength+T.byteLength);ae.set(ee.data,0),ae.set(T,ee.data.byteLength),ee.data=ae}}return c.naluState=s,x},f.parseAACPES=function(T){var p=0,c=this._audioTrack,s=this.aacOverFlow,a=T.data;if(s){this.aacOverFlow=null;var x=s.sample.unit.byteLength,y=Math.min(s.missing,x),m=x-y;s.sample.unit.set(a.subarray(0,y),m),c.samples.push(s.sample),p=s.missing}var D,U;for(D=p,U=a.length;D<U-1&&!K.isHeader(a,D);D++);if(D!==p){var F,W;if(D<U-1?(F="AAC PES did not start with ADTS header,offset:"+D,W=!1):(F="no ADTS header found in AAC PES",W=!0),h.logger.warn("parsing error:"+F),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:F}),W)return}K.initTrackConfig(c,this.observer,a,D,this.audioCodec);var M;if(T.pts!==void 0)M=T.pts;else if(s){var I=K.getFrameDuration(c.samplerate);M=s.sample.pts+I}else{h.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;D<U;)if(K.isHeader(a,D)){if(D+5<U){var X=K.appendFrame(c,a,D,M,H);if(X)if(X.missing)this.aacOverFlow=X;else{D+=X.length,H++;continue}}break}else D++},f.parseMPEGPES=function(T){var p=T.data,c=p.length,s=0,a=0,x=T.pts;if(x===void 0){h.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(N.isHeader(p,a)){var y=N.appendFrame(this._audioTrack,p,a,x,s);if(y)a+=y.length,s++;else break}else a++},f.parseID3PES=function(T){if(T.pts===void 0){h.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},E}();w.minProbeByteLength=188;function g(E,f,A,T){return{key:E,frame:!1,pts:f,dts:A,units:[],debug:T,length:0}}function v(E,f){return(E[f+10]&31)<<8|E[f+11]}function d(E,f,A,T){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(E[f+1]&15)<<8|E[f+2],s=f+3+c-4,a=(E[f+10]&15)<<8|E[f+11];for(f+=12+a;f<s;){var x=(E[f+1]&31)<<8|E[f+2];switch(E[f]){case 207:if(!T){h.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=x);break;case 21:p.id3===-1&&(p.id3=x);break;case 219:if(!T){h.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=x);break;case 3:case 4:A?p.audio===-1&&(p.audio=x,p.isAAC=!1):h.logger.log("MPEG audio found, not supported in this browser");break;case 36:h.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((E[f+3]&15)<<8|E[f+4])+5}return p}function o(E){var f=0,A,T,p,c,s,a=E.data;if(!E||E.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}A=a[0];var y=(A[0]<<16)+(A[1]<<8)+A[2];if(y===1){if(T=(A[4]<<8)+A[5],T&&T>E.size-6)return null;var m=A[7];m&192&&(c=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,m&64?(s=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,c-s>60*9e4&&(h.logger.warn(Math.round((c-s)/9e4)+"s delta between PTS and DTS, align them"),c=s)):s=c),p=A[8];var D=p+9;if(E.size<=D)return null;E.size-=D;for(var U=new Uint8Array(E.size),F=0,W=a.length;F<W;F++){A=a[F];var M=A.byteLength;if(D)if(D>M){D-=M;continue}else A=A.subarray(D),M-=D,D=0;U.set(A,f),f+=M}return T&&(T-=p+3),{data:U,pts:c,dts:s,len:T}}return null}function l(E,f){if(E.units.length&&E.frame){if(E.pts===void 0){var A=f.samples,T=A.length;if(T){var p=A[T-1];E.pts=p.pts,E.dts=p.dts}else{f.dropped++;return}}f.samples.push(E)}E.debug.length&&h.logger.log(E.pts+"/"+E.dts+":"+E.debug)}function u(E,f){var A=E.length;if(A>0){if(f.pts>=E[A-1].pts)E.push(f);else for(var T=A-1;T>=0;T--)if(f.pts<E[T].pts){E.splice(T,0,f);break}}else E.push(f)}function C(E){for(var f=E.byteLength,A=[],T=1;T<f-2;)E[T]===0&&E[T+1]===0&&E[T+2]===3?(A.push(T+2),T+=2):T++;if(A.length===0)return E;var p=f-A.length,c=new Uint8Array(p),s=0;for(T=0;T<p;s++,T++)s===A[0]&&(s++,A.shift()),c[T]=E[s];return c}z.default=w},"./src/errors.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return K}),L.d(z,"ErrorDetails",function(){return N});var K;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(K||(K={}));var N;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return K});var K;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return E});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),N=L.n(K),O=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),k=L("./src/controller/id3-track-controller.ts"),R=L("./src/controller/latency-controller.ts"),S=L("./src/controller/level-controller.ts"),h=L("./src/controller/fragment-tracker.ts"),b=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),g=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),d=L.n(v),o=L("./src/events.ts"),l=L("./src/errors.ts");function u(f,A){for(var T=0;T<A.length;T++){var p=A[T];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}function C(f,A,T){return A&&u(f.prototype,A),T&&u(f,T),f}var E=function(){f.isSupported=function(){return Object(P.isSupported)()};function f(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var p=this.config=Object(g.mergeConfig)(f.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(g.enableStreamingMode)(p);var c=p.abrController,s=p.bufferController,a=p.capLevelController,x=p.fpsController,y=this.abrController=new c(this),m=this.bufferController=new s(this),D=this.capLevelController=new a(this),U=new x(this),F=new O.default(this),W=new B.default(this),M=new k.default(this),I=this.levelController=new S.default(this),H=new h.FragmentTracker(this),X=this.streamController=new b.default(this,H);D.setStreamController(X),U.setStreamController(X);var ee=[I,X];this.networkControllers=ee;var ae=[F,W,y,m,D,U,M,H];this.audioTrackController=this.createController(p.audioTrackController,null,ee),this.createController(p.audioStreamController,H,ee),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,ee),this.createController(p.subtitleStreamController,H,ee),this.createController(p.timelineController,null,ae),this.emeController=this.createController(p.emeController,null,ae),this.cmcdController=this.createController(p.cmcdController,null,ae),this.latencyController=this.createController(R.default,null,ae),this.coreComponents=ae}var A=f.prototype;return A.createController=function(p,c,s){if(p){var a=c?new p(this,c):new p(this);return s&&s.push(a),a}return null},A.on=function(p,c,s){s===void 0&&(s=this),this._emitter.on(p,c,s)},A.once=function(p,c,s){s===void 0&&(s=this),this._emitter.once(p,c,s)},A.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},A.off=function(p,c,s,a){s===void 0&&(s=this),this._emitter.off(p,c,s,a)},A.listeners=function(p){return this._emitter.listeners(p)},A.emit=function(p,c,s){return this._emitter.emit(p,c,s)},A.trigger=function(p,c){if(this.config.debug)return this.emit(p,p,c);try{return this.emit(p,p,c)}catch(s){w.logger.error("An internal error happened while handling event "+p+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:s})}return!1},A.listenerCount=function(p){return this._emitter.listenerCount(p)},A.destroy=function(){w.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},A.attachMedia=function(p){w.logger.log("attachMedia"),this._media=p,this.trigger(o.Events.MEDIA_ATTACHING,{media:p})},A.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(p){this.stopLoad();var c=this.media,s=this.url,a=this.url=K.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});w.logger.log("loadSource:"+a),c&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:p})},A.startLoad=function(p){p===void 0&&(p=-1),w.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(c){c.startLoad(p)})},A.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},A.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){w.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},A.removeLevel=function(p,c){c===void 0&&(c=0),this.levelController.removeLevel(p,c)},C(f,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){w.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){w.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){w.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){w.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){w.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var c=!!p;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(p){this._autoLevelCapping!==p&&(w.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,c=this.config.minAutoBitrate;if(!p)return 0;for(var s=p.length,a=0;a<s;a++)if(p[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,c=this.autoLevelCapping,s;return c===-1&&p&&p.length?s=p.length-1:s=c,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var c=this.audioTrackController;c&&(c.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:g.hlsDefaultConfig},set:function(p){f.defaultConfig=p}}]),f}();E.defaultConfig=void 0},"./src/is-supported.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return O}),L.d(z,"changeTypeSupported",function(){return B});var K=L("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var k=Object(K.getMediaSource)();if(!k)return!1;var R=N(),S=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),h=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!S&&!!h}function B(){var k,R=N();return typeof(R==null||((k=R.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w}),L.d(z,"LoadError",function(){return v});var K=L("./src/polyfills/number.ts"),N=L("./src/errors.ts");function O(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,h(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!S(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,C)}function C(){return k(u,arguments,b(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),h(C,u)},B(d)}function k(d,o,l){return R()?k=Reflect.construct:k=function(C,E,f){var A=[null];A.push.apply(A,E);var T=Function.bind.apply(C,A),p=new T;return f&&h(p,f.prototype),p},k.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function S(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function h(d,o){return h=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},h(d,o)}function b(d){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},b(d)}var P=Math.pow(2,17),w=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,C){var E=this,f=u.url;if(!f)return Promise.reject(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var A=this.config,T=A.fLoader,p=A.loader;return new Promise(function(c,s){E.loader&&E.loader.destroy();var a=E.loader=u.loader=T?new T(A):new p(A),x=g(u),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};u.stats=a.stats,a.load(x,y,{onSuccess:function(D,U,F,W){E.resetLoader(u,a),c({frag:u,part:null,payload:D.data,networkDetails:W})},onError:function(D,U,F){E.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:D,networkDetails:F}))},onAbort:function(D,U,F){E.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:F}))},onTimeout:function(D,U,F){E.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:F}))},onProgress:function(D,U,F,W){C&&C({frag:u,part:null,payload:F,networkDetails:W})}})})},o.loadPart=function(u,C,E){var f=this;this.abort();var A=this.config,T=A.fLoader,p=A.loader;return new Promise(function(c,s){f.loader&&f.loader.destroy();var a=f.loader=u.loader=T?new T(A):new p(A),x=g(u,C),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(x,y,{onSuccess:function(D,U,F,W){f.resetLoader(u,a),f.updateStatsFromPart(u,C);var M={frag:u,part:C,payload:D.data,networkDetails:W};E(M),c(M)},onError:function(D,U,F){f.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:D,networkDetails:F}))},onAbort:function(D,U,F){u.stats.aborted=C.stats.aborted,f.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:F}))},onTimeout:function(D,U,F){f.resetLoader(u,a),s(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:F}))}})})},o.updateStatsFromPart=function(u,C){var E=u.stats,f=C.stats,A=f.total;if(E.loaded+=f.loaded,A){var T=Math.round(u.duration/C.duration),p=Math.min(Math.round(E.loaded/A),T),c=T-p,s=c*Math.round(E.loaded/p);E.total=E.loaded+s}else E.total=Math.max(E.loaded,E.total);var a=E.loading,x=f.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},d}();function g(d,o){o===void 0&&(o=null);var l=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,E=l.byteRangeEndOffset;return Object(K.isFiniteNumber)(C)&&Object(K.isFiniteNumber)(E)&&(u.rangeStart=C,u.rangeEnd=E),u}var v=function(d){O(o,d);function o(l){for(var u,C=arguments.length,E=new Array(C>1?C-1:0),f=1;f<C;f++)E[f-1]=arguments[f];return u=d.call.apply(d,[this].concat(E))||this,u.data=void 0,u.data=l,u}return o}(B(Error))},"./src/loader/fragment.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return w}),L.d(z,"BaseSegment",function(){return g}),L.d(z,"Fragment",function(){return v}),L.d(z,"Part",function(){return d});var K=L("./src/polyfills/number.ts"),N=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(N),B=L("./src/utils/logger.ts"),k=L("./src/loader/level-key.ts"),R=L("./src/loader/load-stats.ts");function S(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,h(o,l)}function h(o,l){return h=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},h(o,l)}function b(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,l,u){return l&&b(o.prototype,l),u&&b(o,u),o}var w;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(w||(w={}));var g=function(){function o(u){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(C,E){var f=C.split("@",2),A=[];f.length===1?A[0]=E?E.byteRangeEndOffset:0:A[0]=parseInt(f[1]),A[1]=parseInt(f[0])+A[0],this._byteRange=A},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),v=function(o){S(l,o);function l(C,E){var f;return f=o.call(this,E)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new R.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=C,f}var u=l.prototype;return u.createInitializationVector=function(E){for(var f=new Uint8Array(16),A=12;A<16;A++)f[A]=E>>8*(15-A)&255;return f},u.setDecryptDataFromLevelKey=function(E,f){var A=E;return(E==null?void 0:E.method)==="AES-128"&&E.uri&&!E.iv&&(A=k.LevelKey.fromURI(E.uri),A.method=E.method,A.iv=this.createInitializationVector(f),A.keyFormat="identity"),A},u.setElementaryStreamInfo=function(E,f,A,T,p,c){c===void 0&&(c=!1);var s=this.elementaryStreams,a=s[E];if(!a){s[E]={startPTS:f,endPTS:A,startDTS:T,endDTS:p,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,T),a.endDTS=Math.max(a.endDTS,p)},u.clearElementaryStreamInfo=function(){var E=this.elementaryStreams;E[w.AUDIO]=null,E[w.VIDEO]=null,E[w.AUDIOVIDEO]=null},P(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var E=this.sn;typeof E!="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'),E=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,E)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var E=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+E*1e3}},{key:"encrypted",get:function(){var E;return!!((E=this.decryptdata)!==null&&E!==void 0&&E.keyFormat&&this.decryptdata.uri)}}]),l}(g),d=function(o){S(l,o);function l(u,C,E,f,A){var T;T=o.call(this,E)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new R.LoadStats,T.duration=u.decimalFloatingPoint("DURATION"),T.gap=u.bool("GAP"),T.independent=u.bool("INDEPENDENT"),T.relurl=u.enumeratedString("URI"),T.fragment=C,T.index=f;var p=u.enumeratedString("BYTERANGE");return p&&T.setByteRange(p,A),A&&(T.fragOffset=A.fragOffset+A.duration),T}return P(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(g)},"./src/loader/key-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return B});var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=function(){function k(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var R=k.prototype;return R._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var h in this.loaders){var b=this.loaders[h];b&&b.destroy()}this.loaders={}},R.onKeyLoading=function(h,b){var P=b.frag,w=P.type,g=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=P.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(g&&(O.logger.warn("abort previous key loader for type:"+w),g.abort()),!v){O.logger.warn("key uri is falsy");return}var o=d.loader,l=P.loader=this.loaders[w]=new o(d);this.decrypturl=v,this.decryptkey=null;var u={url:v,frag:P,responseType:"arraybuffer"},C={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,C,E)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(h,b,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(h.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:w})},R.loaderror=function(h,b){var P=b.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:h})},R.loadtimeout=function(h,b){var P=b.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},k}()},"./src/loader/level-details.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return k});var K=L("./src/polyfills/number.ts");function N(R,S){for(var h=0;h<S.length;h++){var b=S[h];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function O(R,S,h){return S&&N(R.prototype,S),h&&N(R,h),R}var B=10,k=function(){function R(h){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=h}var S=R.prototype;return S.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-b.lastPartSn,w=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!w||!!P,this.advanced=this.endSN>b.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var P=this.driftEnd-this.driftStart;return P*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return k});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),N=L.n(K);function O(R,S){for(var h=0;h<S.length;h++){var b=S[h];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function B(R,S,h){return S&&O(R.prototype,S),h&&O(R,h),R}var k=function(){R.fromURL=function(h,b){return new R(h,b)},R.fromURI=function(h){return new R(h)};function R(S,h){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,h?this._uri=Object(K.buildAbsoluteURL)(S,h,{alwaysNormalize:!0}):this._uri=S}return B(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return K});var K=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return l});var K=L("./src/polyfills/number.ts"),N=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(N),B=L("./src/loader/fragment.ts"),k=L("./src/loader/level-details.ts"),R=L("./src/loader/level-key.ts"),S=L("./src/utils/attr-list.ts"),h=L("./src/utils/logger.ts"),b=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,g=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var T,p;return d.test((T=(p=N.parseURL(A))===null||p===void 0?void 0:p.path)!=null?T:"")}var l=function(){function A(){}return A.findGroup=function(p,c){for(var s=0;s<p.length;s++){var a=p[s];if(a.id===c)return a}},A.convertAVC1ToAVCOTI=function(p){var c=p.split(".");if(c.length>2){var s=c.shift()+".";return s+=parseInt(c.shift()).toString(16),s+=("000"+parseInt(c.shift()).toString(16)).substr(-4),s}return p},A.resolve=function(p,c){return N.buildAbsoluteURL(c,p,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(p,c){var s=[],a={},x=!1;P.lastIndex=0;for(var y;(y=P.exec(p))!=null;)if(y[1]){var m=new S.AttrList(y[1]),D={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:A.resolve(y[2],c)},U=m.decimalResolution("RESOLUTION");U&&(D.width=U.width,D.height=U.height),u((m.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=A.convertAVC1ToAVCOTI(D.videoCodec)),s.push(D)}else if(y[3]){var F=new S.AttrList(y[3]);F["DATA-ID"]&&(x=!0,a[F["DATA-ID"]]=F)}return{levels:s,sessionData:x?a:null}},A.parseMasterPlaylistMedia=function(p,c,s,a){a===void 0&&(a=[]);var x,y=[],m=0;for(w.lastIndex=0;(x=w.exec(p))!==null;){var D=new S.AttrList(x[1]);if(D.TYPE===s){var U={attrs:D,bitrate:0,id:m++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:s,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?A.resolve(D.URI,c):""};if(a.length){var F=A.findGroup(a,U.groupId)||a[0];C(U,F,"audioCodec"),C(U,F,"textCodec")}y.push(U)}}return y},A.parseLevelPlaylist=function(p,c,s,a,x){var y=new k.LevelDetails(c),m=y.fragments,D=null,U=0,F=0,W=0,M=0,I=null,H=new B.Fragment(a,c),X,ee,ae,be=-1,pe=!1;for(g.lastIndex=0,y.m3u8=p;(X=g.exec(p))!==null;){pe&&(pe=!1,H=new B.Fragment(a,c),H.start=W,H.sn=U,H.cc=M,H.level=s,D&&(H.initSegment=D,H.rawProgramDateTime=D.rawProgramDateTime));var ue=X[1];if(ue){H.duration=parseFloat(ue);var se=(" "+X[2]).slice(1);H.title=se||null,H.tagList.push(se?["INF",ue,se]:["INF",ue])}else if(X[3])Object(K.isFiniteNumber)(H.duration)&&(H.start=W,ae&&(H.levelkey=ae),H.sn=U,H.level=s,H.cc=M,H.urlId=x,m.push(H),H.relurl=(" "+X[3]).slice(1),f(H,I),I=H,W+=H.duration,U++,F=0,pe=!0);else if(X[4]){var fe=(" "+X[4]).slice(1);I?H.setByteRange(fe,I):H.setByteRange(fe)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),be===-1&&(be=m.length);else{if(X=X[0].match(v),!X){h.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<X.length&&!(typeof X[ee]!="undefined");ee++);var ne=(" "+X[ee]).slice(1),me=(" "+X[ee+1]).slice(1),Q=X[ee+2]?(" "+X[ee+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":y.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(me);break;case"SKIP":{var ie=new S.AttrList(me),te=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(te)){y.skippedSegments=te;for(var Ee=te;Ee--;)m.unshift(null);U+=te}var _e=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(y.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(me);break;case"VERSION":y.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(me||Q)&&H.tagList.push(Q?[me,Q]:[me]);break;case"DIS":M++;case"GAP":H.tagList.push([ne]);break;case"BITRATE":H.tagList.push([ne,me]);break;case"DISCONTINUITY-SEQ":M=parseInt(me);break;case"KEY":{var ye,ve=new S.AttrList(me),Te=ve.enumeratedString("METHOD"),De=ve.URI,Re=ve.hexadecimalInteger("IV"),Ce=ve.enumeratedString("KEYFORMATVERSIONS"),Le=ve.enumeratedString("KEYID"),ze=(ye=ve.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(ze)>-1){h.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;Te&&(ae=R.LevelKey.fromURL(c,De),De&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Te)>=0&&(ae.method=Te,ae.keyFormat=ze,Le&&(ae.keyID=Le),Ce&&(ae.keyFormatVersions=Ce),ae.iv=Re));break}case"START":{var Be=new S.AttrList(me),je=Be.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(je)&&(y.startTimeOffset=je);break}case"MAP":{var qe=new S.AttrList(me);H.relurl=qe.URI,qe.BYTERANGE&&H.setByteRange(qe.BYTERANGE),H.level=s,H.sn="initSegment",ae&&(H.levelkey=ae),H.initSegment=null,D=H,pe=!0;break}case"SERVER-CONTROL":{var Xe=new S.AttrList(me);y.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new S.AttrList(me);y.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=y.partList;Ae||(Ae=y.partList=[]);var tt=F>0?Ae[Ae.length-1]:void 0,Je=F++,Oe=new B.Part(new S.AttrList(me),H,c,Je,tt);Ae.push(Oe),H.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Ue=new S.AttrList(me);y.preloadHint=Ue;break}case"RENDITION-REPORT":{var ge=new S.AttrList(me);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:h.logger.warn("line parsed but not handled: "+X);break}}}I&&!I.relurl?(m.pop(),W-=I.duration,y.partList&&(y.fragmentHint=I)):y.partList&&(f(H,I),H.cc=M,y.fragmentHint=H);var ce=m.length,he=m[0],Y=m[ce-1];if(W+=y.skippedSegments*y.targetduration,W>0&&ce&&Y){y.averagetargetduration=W/ce;var Z=Y.sn;y.endSN=Z!=="initSegment"?Z:0,he&&(y.startCC=he.cc,he.initSegment||y.fragments.every(function(re){return re.relurl&&o(re.relurl)})&&(h.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=Y.relurl,H.level=s,H.sn="initSegment",he.initSegment=H,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=M,be>0&&E(m,be),y},A}();function u(A,T){["video","audio","text"].forEach(function(p){var c=A.filter(function(a){return Object(b.isCodecType)(a,p)});if(c.length){var s=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});T[p+"Codec"]=s.length>0?s[0]:c[0],A=A.filter(function(a){return c.indexOf(a)===-1})}}),T.unknownCodecs=A}function C(A,T,p){var c=T[p];c&&(A[p]=c)}function E(A,T){for(var p=A[T],c=T;c--;){var s=A[c];if(!s)return;s.programDateTime=p.programDateTime-s.duration*1e3,p=s}}function f(A,T){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):T!=null&&T.programDateTime&&(A.programDateTime=T.endProgramDateTime),Object(K.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/m3u8-parser.ts"),S=L("./src/types/loader.ts"),h=L("./src/utils/attr-list.ts");function b(g){var v=g.type;switch(v){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function P(g,v){var d=g.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var w=function(){function g(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=g.prototype;return v.registerListeners=function(){var o=this.hls;o.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,C=l.loader,E=u||C,f=new E(l);return o.loader=f,this.loaders[o.type]=f,f},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},v.onLevelLoading=function(o,l){var u=l.id,C=l.level,E=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:S.PlaylistContextType.LEVEL,url:E,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,l){var u=l.id,C=l.groupId,E=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:E,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,l){var u=l.id,C=l.groupId,E=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:E,deliveryDirectives:f})},v.load=function(o){var l,u=this.hls.config,C=this.getInternalLoader(o);if(C){var E=C.context;if(E&&E.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var f,A,T,p;switch(o.type){case S.PlaylistContextType.MANIFEST:f=u.manifestLoadingMaxRetry,A=u.manifestLoadingTimeOut,T=u.manifestLoadingRetryDelay,p=u.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:f=0,A=u.levelLoadingTimeOut;break;default:f=u.levelLoadingMaxRetry,A=u.levelLoadingTimeOut,T=u.levelLoadingRetryDelay,p=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===S.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===S.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===S.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var s=c.partTarget,a=c.targetduration;s&&a&&(A=Math.min(Math.max(s*3,a*.8)*1e3,A))}}var x={timeout:A,maxRetry:f,retryDelay:T,maxRetryDelay:p,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,x,y)},v.loadsuccess=function(o,l,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,C);return}this.resetInternalLoader(u.type);var E=o.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),E.indexOf("#EXTINF:")>0||E.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,C):this.handleMasterPlaylist(o,l,u,C)},v.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},v.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},v.handleMasterPlaylist=function(o,l,u,C){var E=this.hls,f=o.data,A=P(o,u),T=R.default.parseMasterPlaylist(f,A),p=T.levels,c=T.sessionData;if(!p.length){this.handleManifestParsingError(o,u,"no level found in manifest",C);return}var s=p.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=p.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=R.default.parseMasterPlaylistMedia(f,A,"AUDIO",s),y=R.default.parseMasterPlaylistMedia(f,A,"SUBTITLES",a),m=R.default.parseMasterPlaylistMedia(f,A,"CLOSED-CAPTIONS");if(x.length){var D=x.some(function(U){return!U.url});!D&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new h.AttrList({}),bitrate:0,url:""}))}E.trigger(N.Events.MANIFEST_LOADED,{levels:p,audioTracks:x,subtitles:y,captions:m,url:A,stats:l,networkDetails:C,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,l,u,C){var E=this.hls,f=u.id,A=u.level,T=u.type,p=P(o,u),c=Object(K.isFiniteNumber)(f)?f:0,s=Object(K.isFiniteNumber)(A)?A:c,a=b(u),x=R.default.parseLevelPlaylist(o.data,p,s,a,c);if(!x.fragments.length){E.trigger(N.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(T===S.PlaylistContextType.MANIFEST){var y={attrs:new h.AttrList({}),bitrate:0,details:x,name:"",url:p};E.trigger(N.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:p,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var m,D=(m=x.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:D,isSidxRequest:!0,type:T,level:A,levelDetails:x,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=x,this.handlePlaylistLoaded(o,l,u,C)},v.handleSidxRequest=function(o,l){var u=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var C=u.references,E=l.levelDetails;C.forEach(function(f,A){var T=f.info,p=E.fragments[A];p.byteRange.length===0&&p.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),p.initSegment&&p.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,l,u,C){this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===S.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:C})},v.handleNetworkError=function(o,l,u,C){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var E=O.ErrorDetails.UNKNOWN,f=!1,A=this.getInternalLoader(o);switch(o.type){case S.PlaylistContextType.MANIFEST:E=u?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case S.PlaylistContextType.LEVEL:E=u?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.AUDIO_TRACK:E=u?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:E=u?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}A&&this.resetInternalLoader(o.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:E,fatal:f,url:o.url,loader:A,context:o,networkDetails:l};C&&(T.response=C),this.hls.trigger(N.Events.ERROR,T)},v.handlePlaylistLoaded=function(o,l,u,C){var E=u.type,f=u.level,A=u.id,T=u.groupId,p=u.loader,c=u.levelDetails,s=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",C);return}if(!p)return;c.live&&(p.getCacheAge&&(c.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(E){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:c,level:f||0,id:A||0,stats:l,networkDetails:C,deliveryDirectives:s});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:c,id:A||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:s});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:c,id:A||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:s});break}},g}();z.default=w},"./src/polyfills/number.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return K}),L.d(z,"MAX_SAFE_INTEGER",function(){return N});var K=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function N(){}return N.getSilentFrame=function(B,k){switch(B){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},N}();z.default=K},"./src/remux/mp4-generator.ts":function(q,z,L){"use strict";L.r(z);var K=Math.pow(2,32)-1,N=function(){function O(){}return O.init=function(){O.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 k;for(k in O.types)O.types.hasOwnProperty(k)&&(O.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var R=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]),S=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]);O.HDLR_TYPES={video:R,audio:S};var h=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=b,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,g,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,h))},O.box=function(k){for(var R=8,S=arguments.length,h=new Array(S>1?S-1:0),b=1;b<S;b++)h[b-1]=arguments[b];for(var P=h.length,w=P;P--;)R+=h[P].byteLength;var g=new Uint8Array(R);for(g[0]=R>>24&255,g[1]=R>>16&255,g[2]=R>>8&255,g[3]=R&255,g.set(k,4),P=0,R=8;P<w;P++)g.set(h[P],R),R+=h[P].byteLength;return g},O.hdlr=function(k){return O.box(O.types.hdlr,O.HDLR_TYPES[k])},O.mdat=function(k){return O.box(O.types.mdat,k)},O.mdhd=function(k,R){R*=k;var S=Math.floor(R/(K+1)),h=Math.floor(R%(K+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,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,S>>24,S>>16&255,S>>8&255,S&255,h>>24,h>>16&255,h>>8&255,h&255,85,196,0,0]))},O.mdia=function(k){return O.box(O.types.mdia,O.mdhd(k.timescale,k.duration),O.hdlr(k.type),O.minf(k))},O.mfhd=function(k){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},O.minf=function(k){return k.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(k)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(k))},O.moof=function(k,R,S){return O.box(O.types.moof,O.mfhd(k),O.traf(S,R))},O.moov=function(k){for(var R=k.length,S=[];R--;)S[R]=O.trak(k[R]);return O.box.apply(null,[O.types.moov,O.mvhd(k[0].timescale,k[0].duration)].concat(S).concat(O.mvex(k)))},O.mvex=function(k){for(var R=k.length,S=[];R--;)S[R]=O.trex(k[R]);return O.box.apply(null,[O.types.mvex].concat(S))},O.mvhd=function(k,R){R*=k;var S=Math.floor(R/(K+1)),h=Math.floor(R%(K+1)),b=new Uint8Array([1,0,0,0,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,S>>24,S>>16&255,S>>8&255,S&255,h>>24,h>>16&255,h>>8&255,h&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 O.box(O.types.mvhd,b)},O.sdtp=function(k){var R=k.samples||[],S=new Uint8Array(4+R.length),h,b;for(h=0;h<R.length;h++)b=R[h].flags,S[h+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return O.box(O.types.sdtp,S)},O.stbl=function(k){return O.box(O.types.stbl,O.stsd(k),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(k){var R=[],S=[],h,b,P;for(h=0;h<k.sps.length;h++)b=k.sps[h],P=b.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(b));for(h=0;h<k.pps.length;h++)b=k.pps[h],P=b.byteLength,S.push(P>>>8&255),S.push(P&255),S=S.concat(Array.prototype.slice.call(b));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|k.sps.length].concat(R).concat([k.pps.length]).concat(S))),g=k.width,v=k.height,d=k.pixelRatio[0],o=k.pixelRatio[1];return O.box(O.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,g>>8&255,g&255,v>>8&255,v&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]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(k){var R=k.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(k.config).concat([6,1,2]))},O.mp4a=function(k){var R=k.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(k)))},O.mp3=function(k){var R=k.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(k)):O.box(O.types.stsd,O.STSD,O.mp4a(k)):O.box(O.types.stsd,O.STSD,O.avc1(k))},O.tkhd=function(k){var R=k.id,S=k.duration*k.timescale,h=k.width,b=k.height,P=Math.floor(S/(K+1)),w=Math.floor(S%(K+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,h>>8&255,h&255,0,0,b>>8&255,b&255,0,0]))},O.traf=function(k,R){var S=O.sdtp(k),h=k.id,b=Math.floor(R/(K+1)),P=Math.floor(R%(K+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,h&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(k,S.length+16+20+8+16+8+8),S)},O.trak=function(k){return k.duration=k.duration||4294967295,O.box(O.types.trak,O.tkhd(k),O.mdia(k))},O.trex=function(k){var R=k.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(k,R){var S=k.samples||[],h=S.length,b=12+16*h,P=new Uint8Array(b),w,g,v,d,o,l;for(R+=8+b,P.set([0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,h&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w<h;w++)g=S[w],v=g.duration,d=g.size,o=g.flags,l=g.cts,P.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(k){O.types||O.init();var R=O.moov(k),S=new Uint8Array(O.FTYP.byteLength+R.byteLength);return S.set(O.FTYP),S.set(R,O.FTYP.byteLength),S},O}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,z.default=N},"./src/remux/mp4-remuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return l}),L.d(z,"normalizePts",function(){return u});var K=L("./src/polyfills/number.ts"),N=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),k=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),S=L("./src/types/loader.ts"),h=L("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var p=arguments[T];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(A[c]=p[c])}return A},b.apply(this,arguments)}var P=10*1e3,w=1024,g=1152,v=null,d=null,o=!1,l=function(){function A(p,c,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=p,this.config=c,this.typeSupported=s,this.ISGenerated=!1,v===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);v=y?parseInt(y[1]):0}if(d===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);d=m?parseInt(m[1]):0}o=!!v&&v<75||!!d&&d<600}var T=A.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var s=!1,a=c.reduce(function(x,y){var m=y.pts-x;return m<-4294967296?(s=!0,u(x,y.pts)):m>0?x:y.pts},c[0].pts);return s&&R.logger.debug("PTS rollover detected"),a},T.remux=function(c,s,a,x,y,m,D,U){var F,W,M,I,H,X,ee=y,ae=y,be=c.pid>-1,pe=s.pid>-1,ue=s.samples.length,se=c.samples.length>0,fe=ue>1,ne=(!be||se)&&(!pe||fe)||this.ISGenerated||D;if(ne){this.ISGenerated||(M=this.generateIS(c,s,y));var me=this.isVideoContiguous,Q=-1;if(fe&&(Q=C(s.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,Q>0){R.logger.warn("[mp4-remuxer]: Dropped "+Q+" out of "+ue+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(Q),s.dropped+=Q,ae+=(s.samples[0].pts-ie)/(s.timescale||9e4)}else Q===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+ue+" video samples"),X=!1);if(this.ISGenerated){if(se&&fe){var te=this.getVideoStartPts(s.samples),Ee=u(c.samples[0].pts,te)-te,_e=Ee/s.inputTimeScale;ee+=Math.max(0,_e),ae+=Math.max(0,-_e)}if(se){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(c,s,y)),W=this.remuxAudio(c,ee,this.isAudioContiguous,m,pe||fe||U===S.PlaylistLevelType.AUDIO?ae:void 0),fe){var ye=W?W.endPTS-W.startPTS:0;s.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(c,s,y)),F=this.remuxVideo(s,ae,me,ye)}}else fe&&(F=this.remuxVideo(s,ae,me,0));F&&(F.firstKeyFrame=Q,F.independent=Q!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,y)),x.samples.length&&(I=this.remuxText(x,y))),{audio:W,video:F,initSegment:M,independent:X,text:I,id3:H}},T.generateIS=function(c,s,a){var x=c.samples,y=s.samples,m=this.typeSupported,D={},U=!Object(K.isFiniteNumber)(this._initPTS),F="audio/mp4",W,M,I;if(U&&(W=M=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(m.mpeg?(F="audio/mpeg",c.codec=""):m.mp3&&(c.codec="mp3")),D.audio={id:"audio",container:F,codec:c.codec,initSegment:!c.isAAC&&m.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(I=c.inputTimeScale,W=M=x[0].pts-Math.round(I*a))),s.sps&&s.pps&&y.length&&(s.timescale=s.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:O.default.initSegment([s]),metadata:{width:s.width,height:s.height}},U)){I=s.inputTimeScale;var H=this.getVideoStartPts(y),X=Math.round(I*a);M=Math.min(M,u(y[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(D).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=M),{tracks:D,initPTS:W,timescale:I}},T.remuxVideo=function(c,s,a,x){var y=c.inputTimeScale,m=c.samples,D=[],U=m.length,F=this._initPTS,W=this.nextAvcDts,M=8,I,H,X,ee=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,be=0,pe=!1;if(!a||W===null){var ue=s*y,se=m[0].pts-u(m[0].dts,m[0].pts);W=ue-se}for(var fe=0;fe<U;fe++){var ne=m[fe];if(ne.pts=u(ne.pts-F,W),ne.dts=u(ne.dts-F,W),ne.dts>ne.pts){var me=9e4*.2;be=Math.max(Math.min(be,ne.pts-ne.dts),-1*me)}ne.dts<m[fe>0?fe-1:fe].dts&&(pe=!0)}pe&&m.sort(function(ct,at){var rt=ct.dts-at.dts,xt=ct.pts-at.pts;return rt||xt}),H=m[0].dts,X=m[m.length-1].dts;var Q=Math.round((X-H)/(U-1));if(be<0){if(be<Q*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(h.toMsFromMpegTsClock)(-Q,!0)+" ms");for(var ie=be,te=0;te<U;te++)m[te].dts=ie=Math.max(ie,m[te].pts-Q),m[te].pts=Math.max(ie,m[te].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(h.toMsFromMpegTsClock)(be,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)m[Ee].dts=m[Ee].dts+be}H=m[0].dts}if(a){var _e=H-W,ye=_e>Q,ve=_e<-1;if(ye||ve){ye?R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(_e,!0)+" ms ("+_e+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(-_e,!0)+" ms ("+_e+"dts) overlapping between fragments detected"),H=W;var Te=m[0].pts-_e;m[0].dts=H,m[0].pts=Te,R.logger.log("Video: First PTS/DTS adjusted: "+Object(h.toMsFromMpegTsClock)(Te,!0)+"/"+Object(h.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(h.toMsFromMpegTsClock)(_e,!0)+" ms")}}o&&(H=Math.max(0,H));for(var De=0,Re=0,Ce=0;Ce<U;Ce++){for(var Le=m[Ce],ze=Le.units,Ve=ze.length,Be=0,je=0;je<Ve;je++)Be+=ze[je].data.length;Re+=Be,De+=Ve,Le.length=Be,Le.dts=Math.max(Le.dts,H),Le.pts=Math.max(Le.pts,Le.dts,0),ee=Math.min(Le.pts,ee),ae=Math.max(Le.pts,ae)}X=m[U-1].dts;var qe=Re+4*De+8,Xe;try{Xe=new Uint8Array(qe)}catch(ct){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating video mdat "+qe});return}var Qe=new DataView(Xe.buffer);Qe.setUint32(0,qe),Xe.set(O.default.types.mdat,4);for(var Ae=0;Ae<U;Ae++){for(var tt=m[Ae],Je=tt.units,Oe=0,Ue=0,ge=Je.length;Ue<ge;Ue++){var ce=Je[Ue],he=ce.data,Y=ce.data.byteLength;Qe.setUint32(M,Y),M+=4,Xe.set(he,M),M+=Y,Oe+=4+Y}if(Ae<U-1)I=m[Ae+1].dts-tt.dts;else{var Z=this.config,re=tt.dts-m[Ae>0?Ae-1:Ae].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*y),Se=(x?ee+x*y:this.nextAudioPts)-tt.pts;Se>le?(I=Se-re,I<0&&(I=re),R.logger.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=re}else I=re}var Pe=Math.round(tt.pts-tt.dts);D.push(new E(tt.key,I,Oe,Pe))}if(D.length&&v&&v<70){var ke=D[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+I,this.isVideoContiguous=!0;var Ge=O.default.moof(c.sequenceNumber++,H,b({},c,{samples:D})),it="video",Me={data1:Ge,data2:Xe,startPTS:ee/y,endPTS:(ae+I)/y,startDTS:H/y,endDTS:W/y,type:it,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),Me},T.remuxAudio=function(c,s,a,x,y){var m=c.inputTimeScale,D=c.samplerate?c.samplerate:m,U=m/D,F=c.isAAC?w:g,W=F*U,M=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,ee=I?0:8,ae=this.nextAudioPts||-1,be=s*m;if(this.isAudioContiguous=a=a||X.length&&ae>0&&(x&&Math.abs(be-ae)<9e3||Math.abs(u(X[0].pts-M,be)-ae)<20*W),X.forEach(function(he){he.pts=u(he.pts-M,be)}),!a||ae<0){if(X=X.filter(function(he){return he.pts>=0}),!X.length)return;y===0?ae=0:x?ae=Math.max(0,be):ae=X[0].pts}if(c.isAAC)for(var pe=y!==void 0,ue=this.config.maxAudioFramesDrift,se=0,fe=ae;se<X.length;se++){var ne=X[se],me=ne.pts,Q=me-fe,ie=Math.abs(1e3*Q/m);if(Q<=-ue*W&&pe)se===0&&(R.logger.warn("Audio frame @ "+(me/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/m)+" ms."),this.nextAudioPts=ae=fe=me);else if(Q>=ue*W&&ie<P&&pe){var te=Math.round(Q/W);fe=me-te*W,fe<0&&(te--,fe+=W),se===0&&(this.nextAudioPts=ae=fe),R.logger.warn("[mp4-remuxer]: Injecting "+te+" audio frame @ "+(fe/m).toFixed(3)+"s due to "+Math.round(1e3*Q/m)+" ms gap.");for(var Ee=0;Ee<te;Ee++){var _e=Math.max(fe,0),ye=N.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ne.unit.subarray()),X.splice(se,0,{unit:ye,pts:_e}),fe+=W,se++}}ne.pts=fe,fe+=W}for(var ve=null,Te=null,De,Re=0,Ce=X.length;Ce--;)Re+=X[Ce].unit.byteLength;for(var Le=0,ze=X.length;Le<ze;Le++){var Ve=X[Le],Be=Ve.unit,je=Ve.pts;if(Te!==null){var qe=H[Le-1];qe.duration=Math.round((je-Te)/U)}else if(a&&c.isAAC&&(je=ae),ve=je,Re>0){Re+=ee;try{De=new Uint8Array(Re)}catch(he){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Re,reason:"fail allocating audio mdat "+Re});return}if(!I){var Xe=new DataView(De.buffer);Xe.setUint32(0,Re),De.set(O.default.types.mdat,4)}}else return;De.set(Be,ee);var Qe=Be.byteLength;ee+=Qe,H.push(new E(!0,F,Qe,0)),Te=je}var Ae=H.length;if(!Ae)return;var tt=H[H.length-1];this.nextAudioPts=ae=Te+U*tt.duration;var Je=I?new Uint8Array(0):O.default.moof(c.sequenceNumber++,ve/U,b({},c,{samples:H}));c.samples=[];var Oe=ve/m,Ue=ae/m,ge="audio",ce={data1:Je,data2:De,startPTS:Oe,endPTS:Ue,startDTS:Oe,endDTS:Ue,type:ge,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(De.length,"MDAT length must not be zero"),ce},T.remuxEmptyAudio=function(c,s,a,x){var y=c.inputTimeScale,m=c.samplerate?c.samplerate:y,D=y/m,U=this.nextAudioPts,F=(U!==null?U:x.startDTS*y)+this._initDTS,W=x.endDTS*y+this._initDTS,M=D*w,I=Math.ceil((W-F)/M),H=N.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],ee=0;ee<I;ee++){var ae=F+ee*M;X.push({unit:H,pts:ae,dts:ae})}return c.samples=X,this.remuxAudio(c,s,a,!1)},T.remuxID3=function(c,s){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,m=this._initDTS,D=0;D<a;D++){var U=c.samples[D];U.pts=u(U.pts-y,s*x)/x,U.dts=u(U.dts-m,s*x)/x}var F=c.samples;return c.samples=[],{samples:F}},T.remuxText=function(c,s){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,m=0;m<a;m++){var D=c.samples[m];D.pts=u(D.pts-y,s*x)/x}c.samples.sort(function(F,W){return F.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},A}();function u(A,T){var p;if(T===null)return A;for(T<A?p=-8589934592:p=8589934592;Math.abs(A-T)>4294967296;)A+=p;return A}function C(A){for(var T=0;T<A.length;T++)if(A[T].key)return T;return-1}var E=function(T,p,c,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=c,this.cts=s,this.flags=new f(T)},f=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),N=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),k=function(){function h(){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 b=h.prototype;return b.destroy=function(){},b.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(w,g,v){this.audioCodec=g,this.videoCodec=v,this.generateInitSegment(w),this.emitInitSegment=!0},b.generateInitSegment=function(w){var g=this.audioCodec,v=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(N.parseInitSegment)(w);g||(g=S(d.audio,O.ElementaryStreamTypes.AUDIO)),v||(v=S(d.video,O.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:g+","+v,initSegment:w,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:g,initSegment:w,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:w,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},b.remux=function(w,g,v,d,o){var l=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(K.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var E=g.samples;if(!E||!E.length)return C;var f={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(E),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=R(A,E,u));var T=Object(N.getDuration)(E,A),p=u,c=T+p;Object(N.offsetStartDTS)(A,E,l),T>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!A.audio,a=!!A.video,x="";s&&(x+="audio"),a&&(x+="video");var y={data1:E,startPTS:p,startDTS:p,endPTS:c,endDTS:c,type:x,hasAudio:s,hasVideo:a,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=d,C.id3=v,C.initSegment=f,C},h}(),R=function(b,P,w){return Object(N.getStartDTS)(b,P)-w};function S(h,b){var P=h==null?void 0:h.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||b===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=k},"./src/task-loop.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=N.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},N}()},"./src/types/cmcd.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return K}),L.d(z,"CMCDObjectType",function(){return N}),L.d(z,"CMCDStreamingFormat",function(){return O}),L.d(z,"CMCDStreamType",function(){return B});var K=1,N;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(N||(N={}));var O;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(O||(O={}));var B;(function(k){k.VOD="v",k.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return O}),L.d(z,"getSkipValue",function(){return B}),L.d(z,"HlsUrlParameters",function(){return k}),L.d(z,"Level",function(){return R});function K(S,h){for(var b=0;b<h.length;b++){var P=h[b];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function N(S,h,b){return h&&K(S.prototype,h),b&&K(S,b),S}var O;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(O||(O={}));function B(S,h){var b=S.canSkipUntil,P=S.canSkipDateRanges,w=S.endSN,g=h!==void 0?h-w:0;return b&&g<b?P?O.v2:O.Yes:O.No}var k=function(){function S(b,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=P,this.skip=w}var h=S.prototype;return h.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},S}(),R=function(){function S(h){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[h.url],this.attrs=h.attrs,this.bitrate=h.bitrate,h.details&&(this.details=h.details),this.id=h.id||0,this.name=h.name,this.width=h.width||0,this.height=h.height||0,this.audioCodec=h.audioCodec,this.videoCodec=h.videoCodec,this.unknownCodecs=h.unknownCodecs,this.codecSet=[h.videoCodec,h.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return N(S,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(b){var P=b%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),S}()},"./src/types/loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return K}),L.d(z,"PlaylistLevelType",function(){return N});var K;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var N;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return K});var K=function(B,k,R,S,h,b){S===void 0&&(S=0),h===void 0&&(h=-1),b===void 0&&(b=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=B,this.sn=k,this.id=R,this.size=S,this.part=h,this.partial=b};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return O});var K=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function B(R){typeof R=="string"&&(R=B.parseAttrList(R));for(var S in R)R.hasOwnProperty(S)&&(this[S]=R[S])}var k=B.prototype;return k.decimalInteger=function(S){var h=parseInt(this[S],10);return h>Number.MAX_SAFE_INTEGER?Infinity:h},k.hexadecimalInteger=function(S){if(this[S]){var h=(this[S]||"0x").slice(2);h=(h.length&1?"0":"")+h;for(var b=new Uint8Array(h.length/2),P=0;P<h.length/2;P++)b[P]=parseInt(h.slice(P*2,P*2+2),16);return b}else return null},k.hexadecimalIntegerAsNumber=function(S){var h=parseInt(this[S],16);return h>Number.MAX_SAFE_INTEGER?Infinity:h},k.decimalFloatingPoint=function(S){return parseFloat(this[S])},k.optionalFloat=function(S,h){var b=this[S];return b?parseFloat(b):h},k.enumeratedString=function(S){return this[S]},k.bool=function(S){return this[S]==="YES"},k.decimalResolution=function(S){var h=K.exec(this[S]);return h===null?void 0:{width:parseInt(h[1],10),height:parseInt(h[2],10)}},B.parseAttrList=function(S){var h,b={},P='"';for(N.lastIndex=0;(h=N.exec(S))!==null;){var w=h[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),b[h[1]]=w}return b},B}()},"./src/utils/binary-search.ts":function(q,z,L){"use strict";L.r(z);var K={search:function(O,B){for(var k=0,R=O.length-1,S=null,h=null;k<=R;){S=(k+R)/2|0,h=O[S];var b=B(h);if(b>0)k=S+1;else if(b<0)R=S-1;else return h}return null}};z.default=K},"./src/utils/buffer-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return O});var K=L("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function B(){}return B.isBuffered=function(R,S){try{if(R){for(var h=B.getBuffered(R),b=0;b<h.length;b++)if(S>=h.start(b)&&S<=h.end(b))return!0}}catch(P){}return!1},B.bufferInfo=function(R,S,h){try{if(R){var b=B.getBuffered(R),P=[],w;for(w=0;w<b.length;w++)P.push({start:b.start(w),end:b.end(w)});return this.bufferedInfo(P,S,h)}}catch(g){}return{len:0,start:S,end:S,nextStart:void 0}},B.bufferedInfo=function(R,S,h){S=Math.max(0,S),R.sort(function(f,A){var T=f.start-A.start;return T||A.end-f.end});var b=[];if(h)for(var P=0;P<R.length;P++){var w=b.length;if(w){var g=b[w-1].end;R[P].start-g<h?R[P].end>g&&(b[w-1].end=R[P].end):b.push(R[P])}else b.push(R[P])}else b=R;for(var v=0,d,o=S,l=S,u=0;u<b.length;u++){var C=b[u].start,E=b[u].end;if(S+h>=C&&S<E)o=C,l=E,v=l-S;else if(S+h<C){d=C;break}}return{len:v,start:o||0,end:l||0,nextStart:d}},B.getBuffered=function(R){try{return R.buffered}catch(S){return K.logger.log("failed to get media.buffered",S),N}},B}()},"./src/utils/cea-608-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return l}),L.d(z,"CaptionScreen",function(){return u});var K=L("./src/utils/logger.ts"),N={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(c){var s=c;return N.hasOwnProperty(c)&&(s=N[c]),String.fromCharCode(s)},B=15,k=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},S={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(w||(w={}));var g=function(){function p(){this.time=null,this.verboseLevel=w.ERROR}var c=p.prototype;return c.log=function(a,x){this.verboseLevel>=a&&K.logger.log(this.time+" ["+a+"] "+x)},p}(),v=function(c){for(var s=[],a=0;a<c.length;a++)s.push(c[a].toString(16));return s},d=function(){function p(s,a,x,y,m){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=x||!1,this.background=y||"black",this.flash=m||!1}var c=p.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var m=x[y];a.hasOwnProperty(m)&&(this[m]=a[m])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},p}(),o=function(){function p(s,a,x,y,m,D){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new d(a,x,y,m,D)}var c=p.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},p}(),l=function(){function p(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new d}var c=p.prototype;return c.equals=function(a){for(var x=!0,y=0;y<k;y++)if(!this.chars[y].equals(a.chars[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<k;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<k;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=O(a);if(this.pos>=k){this.logger.log(w.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<k;x++)this.chars[x].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],x=!0,y=0;y<k;y++){var m=this.chars[y].uchar;m!==" "&&(x=!1),a.push(m)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},p}(),u=function(){function p(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new l(s));this.logger=s,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=p.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var x=!0,y=0;y<B;y++)if(!this.rows[y].equals(a.rows[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<B;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<B;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(w.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(w.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<B;y++)this.rows[y].clear();var m=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var U=D.rows[m].cueStartTime,F=this.logger.time;if(U&&F!==null&&U<F)for(var W=0;W<this.nrRollUpRows;W++)this.rows[x-this.nrRollUpRows+W+1].copy(D.rows[m+W])}}this.currRow=x;var M=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,H=Math.max(I-1,0);M.setCursor(a.indent),a.color=M.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},c.setBkgData=function(a){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],y="",m=-1,D=0;D<B;D++){var U=this.rows[D].getTextString();U&&(m=D+1,a?x.push("Row "+m+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(a?y="["+x.join(" | ")+"]":y=x.join(`
|
|
`)),y},c.getTextAndFormat=function(){return this.rows},p}(),C=function(){function p(s,a,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(x),this.nonDisplayedMemory=new u(x),this.lastOutputScreen=new u(x),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=p.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(w.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(w.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(w.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var y=Math.floor(a/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=m[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},p}(),E=function(){function p(s,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new g;this.channels=[null,new C(s,a,y),new C(s+1,x,y)],this.cmdHistory=T(),this.logger=y}var c=p.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var y,m,D,U=!1;this.logger.time=a;for(var F=0;F<x.length;F+=2){if(m=x[F]&127,D=x[F+1]&127,m===0&&D===0)continue;if(this.logger.log(w.DATA,"["+v([x[F],x[F+1]])+"] -> ("+v([m,D])+")"),y=this.parseCmd(m,D),y||(y=this.parseMidrow(m,D)),y||(y=this.parsePAC(m,D)),y||(y=this.parseBackgroundAttributes(m,D)),!y&&(U=this.parseChars(m,D),U)){var W=this.currentChannel;if(W&&W>0){var M=this.channels[W];M.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+v([m,D])+" orig: "+v([x[F],x[F+1]]))}},c.parseCmd=function(a,x){var y=this.cmdHistory,m=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,D=(a===23||a===31)&&x>=33&&x<=35;if(!(m||D))return!1;if(A(a,x,y))return f(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+v([a,x])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,F=this.channels[U];return a===20||a===21||a===28||a===29?x===32?F.ccRCL():x===33?F.ccBS():x===34?F.ccAOF():x===35?F.ccAON():x===36?F.ccDER():x===37?F.ccRU(2):x===38?F.ccRU(3):x===39?F.ccRU(4):x===40?F.ccFON():x===41?F.ccRDC():x===42?F.ccTR():x===43?F.ccRTD():x===44?F.ccEDM():x===45?F.ccCR():x===46?F.ccENM():x===47&&F.ccEOC():F.ccTO(x-32),f(a,x,y),this.currentChannel=U,!0},c.parseMidrow=function(a,x){var y=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[y];return m?(m.ccMIDROW(x),this.logger.log(w.DEBUG,"MIDROW ("+v([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var y,m=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,U=(a===16||a===24)&&x>=64&&x<=95;if(!(D||U))return!1;if(A(a,x,m))return f(null,null,m),!0;var F=a<=23?1:2;x>=64&&x<=95?y=F===1?R[a]:h[a]:y=F===1?S[a]:b[a];var W=this.channels[F];return W?(W.setPAC(this.interpretPAC(y,x)),f(a,x,m),this.currentChannel=F,!0):!1},c.interpretPAC=function(a,x){var y,m={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?y=x-96:y=x-64,m.underline=(y&1)===1,y<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((y-16)/2)*4,m},c.parseChars=function(a,x){var y,m=null,D=null;if(a>=25?(y=2,D=a-8):(y=1,D=a),D>=17&&D<=19){var U;D===17?U=x+80:D===18?U=x+112:U=x+144,this.logger.log(w.INFO,"Special char '"+O(U)+"' in channel "+y),m=[U]}else a>=32&&a<=127&&(m=x===0?[a]:[a,x]);if(m){var F=v(m);this.logger.log(w.DEBUG,"Char codes = "+F.join(",")),f(a,x,this.cmdHistory)}return m},c.parseBackgroundAttributes=function(a,x){var y=(a===16||a===24)&&x>=32&&x<=47,m=(a===23||a===31)&&x>=45&&x<=47;if(!(y||m))return!1;var D,U={};a===16||a===24?(D=Math.floor((x-32)/2),U.background=P[D],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var F=a<=23?1:2,W=this.channels[F];return W.setBkgData(U),f(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(a)}},p}();function f(p,c,s){s.a=p,s.b=c}function A(p,c,s){return s.a===p&&s.b===c}function T(){return{a:null,b:null}}z.default=E},"./src/utils/codecs.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return N}),L.d(z,"isCodecSupportedInMp4",function(){return O});var K={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function N(B,k){var R=K[k];return!!R&&R[B.slice(0,4)]===!0}function O(B,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/vttparser.ts"),N=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),B=/\s/,k={newCue:function(S,h,b,P){for(var w=[],g,v,d,o,l,u=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(g=P.rows[C],d=!0,o=0,l="",!g.isEmpty()){for(var E=0;E<g.chars.length;E++)B.test(g.chars[E].uchar)&&d?o++:(l+=g.chars[E].uchar,d=!1);g.cueStartTime=h,h===b&&(b+=1e-4),o>=16?o--:o++;var f=Object(K.fixLineBreaks)(l.trim()),A=Object(N.generateCueId)(h,b,f);(!S||!S.cues||!S.cues.getCueById(A))&&(v=new u(h,b,f),v.id=A,v.line=C+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),w.push(v))}return S&&w.length&&(w.sort(function(T,p){return T.line==="auto"||p.line==="auto"?0:T.line>8&&p.line>8?p.line-T.line:T.line-p.line}),w.forEach(function(T){return Object(O.addCueToTrack)(S,T)})),w}};z.default=k},"./src/utils/discontinuities.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return B}),L.d(z,"shouldAlignOnDiscontinuities",function(){return k}),L.d(z,"findDiscontinuousReferenceFrag",function(){return R}),L.d(z,"adjustSlidingStart",function(){return h}),L.d(z,"alignStream",function(){return b}),L.d(z,"alignPDT",function(){return w}),L.d(z,"alignFragmentByPDTDelta",function(){return g}),L.d(z,"alignMediaPlaylistByPDT",function(){return v});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function B(d,o){for(var l=null,u=0,C=d.length;u<C;u++){var E=d[u];if(E&&E.cc===o){l=E;break}}return l}function k(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function R(d,o){var l=d.fragments,u=o.fragments;if(!u.length||!l.length){N.logger.log("No fragments to align");return}var C=B(l,u[0].cc);if(!C||C&&!C.startPTS){N.logger.log("No frag in previous level to align on");return}return C}function S(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function h(d,o){for(var l=o.fragments,u=0,C=l.length;u<C;u++)S(l[u],d);o.fragmentHint&&S(o.fragmentHint,d),o.alignedSliding=!0}function b(d,o,l){if(!o)return;P(d,l,o),!l.alignedSliding&&o.details&&w(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(O.adjustSliding)(o.details,l)}function P(d,o,l){if(k(d,l,o)){var u=R(l.details,o);u&&Object(K.isFiniteNumber)(u.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),h(u.start,o))}}function w(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,C=(u-l)/1e3+o.fragments[0].start;C&&Object(K.isFiniteNumber)(C)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+C.toFixed(3)+" "+d.url+" "),h(C,d))}function g(d,o){var l=d.programDateTime;if(!l)return;var u=(l-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,C=l-u*1e3;d.fragments.forEach(function(E){g(E,C)}),d.fragmentHint&&g(d.fragmentHint,C),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/ewma.ts"),N=function(){function O(k,R,S){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=S,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(k),this.fast_=new K.default(R)}var B=O.prototype;return B.update=function(R,S){var h=this.slow_,b=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new K.default(R,h.getEstimate(),h.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new K.default(S,b.getEstimate(),b.getTotalWeight()))},B.sample=function(R,S){R=Math.max(R,this.minDelayMs_);var h=8*S,b=R/1e3,P=h/b;this.fast_.sample(b,P),this.slow_.sample(b,P)},B.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},O}();z.default=N},"./src/utils/ewma.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function N(B,k,R){k===void 0&&(k=0),R===void 0&&(R=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_=k,this.totalWeight_=R}var O=N.prototype;return O.sample=function(k,R){var S=Math.pow(this.alpha_,k);this.estimate_=R*(1-S)+S*this.estimate_,this.totalWeight_+=k},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},N}();z.default=K},"./src/utils/fetch-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return g});var K=L("./src/polyfills/number.ts"),N=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function B(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,b(u,C)}function k(u){var C=typeof Map=="function"?new Map:void 0;return k=function(f){if(f===null||!h(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(f))return C.get(f);C.set(f,A)}function A(){return R(f,arguments,P(this).constructor)}return A.prototype=Object.create(f.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),b(A,f)},k(u)}function R(u,C,E){return S()?R=Reflect.construct:R=function(A,T,p){var c=[null];c.push.apply(c,T);var s=Function.bind.apply(A,c),a=new s;return p&&b(a,p.prototype),a},R.apply(null,arguments)}function S(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function h(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function b(u,C){return b=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},b(u,C)}function P(u){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(E){return E.__proto__||Object.getPrototypeOf(E)},P(u)}function w(){return w=Object.assign||function(u){for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var f in E)Object.prototype.hasOwnProperty.call(E,f)&&(u[f]=E[f])}return u},w.apply(this,arguments)}function g(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var v=function(){function u(E){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=E.fetchSetup||o,this.controller=new self.AbortController,this.stats=new N.LoadStats}var C=u.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(f,A,T){var p=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var s=d(f,this.controller.signal),a=T.onProgress,x=f.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=f,this.config=A,this.callbacks=T,this.request=this.fetchSetup(f,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),T.onTimeout(c,f,p.response)},A.timeout),self.fetch(this.request).then(function(m){if(p.response=p.loader=m,!m.ok){var D=m.status,U=m.statusText;throw new l(U||"fetch, bad network response",D,m)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(m.headers.get("Content-Length")||"0"),a&&Object(K.isFiniteNumber)(A.highWaterMark)?p.loadProgressively(m,c,f,A.highWaterMark,a):x?m.arrayBuffer():m.text()}).then(function(m){var D=p.response;self.clearTimeout(p.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=m[y];var U={url:D.url,data:m};a&&!Object(K.isFiniteNumber)(A.highWaterMark)&&a(c,f,m,D),T.onSuccess(U,c,f,D)}).catch(function(m){if(self.clearTimeout(p.requestTimeout),c.aborted)return;var D=m.code||0;T.onError({code:D,text:m.message},f,m.details)})},C.getCacheAge=function(){var f=null;if(this.response){var A=this.response.headers.get("age");f=A?parseFloat(A):null}return f},C.loadProgressively=function(f,A,T,p,c){p===void 0&&(p=0);var s=new O.default,a=f.body.getReader(),x=function y(){return a.read().then(function(m){if(m.done)return s.dataLength&&c(A,T,s.flush(),f),Promise.resolve(new ArrayBuffer(0));var D=m.value,U=D.length;return A.loaded+=U,U<p||s.dataLength?(s.push(D),s.dataLength>=p&&c(A,T,s.flush(),f)):c(A,T,D,f),y()}).catch(function(){return Promise.reject()})};return x()},u}();function d(u,C){var E={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},u.headers))};return u.rangeEnd&&E.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),E}function o(u,C){return new self.Request(u.url,C)}var l=function(u){B(C,u);function C(E,f,A){var T;return T=u.call(this,E)||this,T.code=void 0,T.details=void 0,T.code=f,T.details=A,T}return C}(k(Error));z.default=v},"./src/utils/imsc1-ttml-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return h}),L.d(z,"parseIMSC1",function(){return g});var K=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),k=L("./src/utils/timescale-conversion.ts"),R=L("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(p[a]=s[a])}return p},S.apply(this,arguments)}var h="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function g(p,c,s,a,x){var y=Object(K.findBox)(new Uint8Array(p),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var m=y[0],D=Object(B.utf8ArrayToStr)(new Uint8Array(p,m.start,m.end-m.start)),U=Object(k.toTimescaleFromScale)(c,1,s);try{a(v(D,U))}catch(F){x(F)}}function v(p,c){var s=new DOMParser,a=s.parseFromString(p,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(y).reduce(function(M,I){return M[I]=x.getAttribute("ttp:"+I)||y[I],M},{}),D=x.getAttribute("xml:space")!=="preserve",U=o(d(x,"styling","style")),F=o(d(x,"layout","region")),W=d(x,"body","[begin]");return[].map.call(W,function(M){var I=l(M,D);if(!I||!M.hasAttribute("begin"))return null;var H=f(M.getAttribute("begin"),m),X=f(M.getAttribute("dur"),m),ee=f(M.getAttribute("end"),m);if(H===null)throw E(M);if(ee===null){if(X===null)throw E(M);ee=H+X}var ae=new O.default(H-c,ee-c,I);ae.id=Object(R.generateCueId)(ae.startTime,ae.endTime,ae.text);var be=F[M.getAttribute("region")],pe=U[M.getAttribute("style")];ae.position=10,ae.size=80;var ue=u(be,pe),se=ue.textAlign;if(se){var fe=w[se];fe&&(ae.lineAlign=fe),ae.align=se}return S(ae,ue),ae}).filter(function(M){return M!==null})}function d(p,c,s){var a=p.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(p){return p.reduce(function(c,s){var a=s.getAttribute("xml:id");return a&&(c[a]=s),c},{})}function l(p,c){return[].slice.call(p.childNodes).reduce(function(s,a,x){var y;return a.nodeName==="br"&&x?s+`
|
|
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?l(a,c):c?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function u(p,c){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,y){var m=C(c,s,y)||C(p,s,y);return m&&(x[y]=m),x},{})}function C(p,c,s){return p.hasAttributeNS(c,s)?p.getAttributeNS(c,s):null}function E(p){return new Error("Could not parse ttml timestamp "+p)}function f(p,c){if(!p)return null;var s=Object(N.parseTimeStamp)(p);return s===null&&(b.test(p)?s=A(p,c):P.test(p)&&(s=T(p,c))),s}function A(p,c){var s=b.exec(p),a=(s[4]|0)+(s[5]|0)/c.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/c.frameRate}function T(p,c){var s=P.exec(p),a=Number(s[1]),x=s[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return R}),L.d(z,"logger",function(){return S});var K=function(){},N={trace:K,debug:K,log:K,warn:K,info:K,error:K},O=N;function B(h){var b=self.console[h];return b?b.bind(self.console,"["+h+"] >"):K}function k(h){for(var b=arguments.length,P=new Array(b>1?b-1:0),w=1;w<b;w++)P[w-1]=arguments[w];P.forEach(function(g){O[g]=h[g]?h[g].bind(h):B(g)})}function R(h){if(self.console&&h===!0||typeof h=="object"){k(h,"debug","log","info","warn","error");try{O.log()}catch(b){O=N}}else O=N}var S=O},"./src/utils/mediakeys-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return K}),L.d(z,"requestMediaKeySystemAccess",function(){return N});var K;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(K||(K={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return k}),L.d(z,"readUint16",function(){return R}),L.d(z,"readUint32",function(){return S}),L.d(z,"writeUint32",function(){return h}),L.d(z,"findBox",function(){return b}),L.d(z,"parseSegmentIndex",function(){return P}),L.d(z,"parseInitSegment",function(){return w}),L.d(z,"getStartDTS",function(){return g}),L.d(z,"getDuration",function(){return v}),L.d(z,"computeRawDurationFromSamples",function(){return d}),L.d(z,"offsetStartDTS",function(){return o}),L.d(z,"segmentValidRange",function(){return l}),L.d(z,"appendUint8Array",function(){return u});var K=L("./src/utils/typed-array.ts"),N=L("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,B=[].push;function k(C){return String.fromCharCode.apply(null,C)}function R(C,E){"data"in C&&(E+=C.start,C=C.data);var f=C[E]<<8|C[E+1];return f<0?65536+f:f}function S(C,E){"data"in C&&(E+=C.start,C=C.data);var f=C[E]<<24|C[E+1]<<16|C[E+2]<<8|C[E+3];return f<0?4294967296+f:f}function h(C,E,f){"data"in C&&(E+=C.start,C=C.data),C[E]=f>>24,C[E+1]=f>>16&255,C[E+2]=f>>8&255,C[E+3]=f&255}function b(C,E){var f=[];if(!E.length)return f;var A,T,p;"data"in C?(A=C.data,T=C.start,p=C.end):(A=C,T=0,p=A.byteLength);for(var c=T;c<p;){var s=S(A,c),a=k(A.subarray(c+4,c+8)),x=s>1?c+s:p;if(a===E[0])if(E.length===1)f.push({data:A,start:c+8,end:x});else{var y=b({data:A,start:c+8,end:x},E.slice(1));y.length&&B.apply(f,y)}c=x}return f}function P(C){var E=b(C,["moov"]),f=E[0],A=f?f.end:null,T=b(C,["sidx"]);if(!T||!T[0])return null;var p=[],c=T[0],s=c.data[0],a=s===0?8:16,x=S(c,a);a+=4;var y=0,m=0;s===0?a+=8:a+=16,a+=2;var D=c.end+m,U=R(c,a);a+=2;for(var F=0;F<U;F++){var W=a,M=S(c,W);W+=4;var I=M&2147483647,H=(M&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=S(c,W);W+=4,p.push({referenceSize:I,subsegmentDuration:X,info:{duration:X/x,start:D,end:D+I-1}}),D+=I,W+=4,a=W}return{earliestPresentationTime:y,timescale:x,version:s,referencesCount:U,references:p,moovEndOffset:A}}function w(C){for(var E=[],f=b(C,["moov","trak"]),A=0;A<f.length;A++){var T=f[A],p=b(T,["tkhd"])[0];if(p){var c=p.data[p.start],s=c===0?12:20,a=S(p,s),x=b(T,["mdia","mdhd"])[0];if(x){c=x.data[x.start],s=c===0?12:20;var y=S(x,s),m=b(T,["mdia","hdlr"])[0];if(m){var D=k(m.data.subarray(m.start+8,m.start+12)),U={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[D];if(U){var F=b(T,["mdia","minf","stbl","stsd"])[0],W=void 0;F&&(W=k(F.data.subarray(F.start+12,F.start+16))),E[a]={timescale:y,type:U},E[U]={timescale:y,id:a,codec:W}}}}}}var M=b(C,["moov","mvex","trex"]);return M.forEach(function(I){var H=S(I,4),X=E[H];X&&(X.default={duration:S(I,12),flags:S(I,20)})}),E}function g(C,E){return b(E,["moof","traf"]).reduce(function(f,A){var T=b(A,["tfdt"])[0],p=T.data[T.start],c=b(A,["tfhd"]).reduce(function(s,a){var x=S(a,4),y=C[x];if(y){var m=S(T,4);p===1&&(m*=Math.pow(2,32),m+=S(T,8));var D=y.timescale||9e4,U=m/D;if(isFinite(U)&&(s===null||U<s))return U}return s},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(C,E){for(var f=0,A=0,T=0,p=b(C,["moof","traf"]),c=0;c<p.length;c++){var s=p[c],a=b(s,["tfhd"])[0],x=S(a,4),y=E[x];if(!y)continue;var m=y.default,D=S(a,0)|(m==null?void 0:m.flags),U=m==null?void 0:m.duration;D&8&&(D&2?U=S(a,12):U=S(a,8));for(var F=y.timescale||9e4,W=b(s,["trun"]),M=0;M<W.length;M++){if(U){var I=S(W[M],4);f=U*I}else f=d(W[M]);y.type===N.ElementaryStreamTypes.VIDEO?A+=f/F:y.type===N.ElementaryStreamTypes.AUDIO&&(T+=f/F)}}if(A===0&&T===0){var H=P(C);if(H!=null&&H.references)return H.references.reduce(function(X,ee){return X+ee.info.duration||0},0)}return A||T}function d(C){var E=S(C,0),f=8;E&1&&(f+=4),E&4&&(f+=4);for(var A=0,T=S(C,4),p=0;p<T;p++){if(E&256){var c=S(C,f);A+=c,f+=4}E&512&&(f+=4),E&1024&&(f+=4),E&2048&&(f+=4)}return A}function o(C,E,f){b(E,["moof","traf"]).forEach(function(A){b(A,["tfhd"]).forEach(function(T){var p=S(T,4),c=C[p];if(!c)return;var s=c.timescale||9e4;b(A,["tfdt"]).forEach(function(a){var x=a.data[a.start],y=S(a,4);if(x===0)h(a,4,y-f*s);else{y*=Math.pow(2,32),y+=S(a,8),y-=f*s,y=Math.max(y,0);var m=Math.floor(y/(O+1)),D=Math.floor(y%(O+1));h(a,4,m),h(a,8,D)}})})})}function l(C){var E={valid:null,remainder:null},f=b(C,["moof"]);if(f){if(f.length<2)return E.remainder=C,E}else return E;var A=f[f.length-1];return E.valid=Object(K.sliceUint8)(C,0,A.start-8),E.remainder=Object(K.sliceUint8)(C,A.start-8),E}function u(C,E){var f=new Uint8Array(C.length+E.length);return f.set(C),f.set(E,C.length),f}},"./src/utils/output-filter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function N(B,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=k}var O=N.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(k,R,S){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=R,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return N}),L.d(z,"addCueToTrack",function(){return O}),L.d(z,"clearCurrentCues",function(){return B}),L.d(z,"removeCuesInRange",function(){return k}),L.d(z,"getCuesInRange",function(){return S});var K=L("./src/utils/logger.ts");function N(h,b){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=h,b.dispatchEvent(P)}function O(h,b){var P=h.mode;if(P==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(b.id))try{if(h.addCue(b),!h.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(g){K.logger.debug("[texttrack-utils]: "+g);var w=new self.TextTrackCue(b.startTime,b.endTime,b.text);w.id=b.id,h.addCue(w)}P==="disabled"&&(h.mode=P)}function B(h){var b=h.mode;if(b==="disabled"&&(h.mode="hidden"),h.cues)for(var P=h.cues.length;P--;)h.removeCue(h.cues[P]);b==="disabled"&&(h.mode=b)}function k(h,b,P){var w=h.mode;if(w==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0)for(var g=S(h.cues,b,P),v=0;v<g.length;v++)h.removeCue(g[v]);w==="disabled"&&(h.mode=w)}function R(h,b){if(b<h[0].startTime)return 0;var P=h.length-1;if(b>h[P].endTime)return-1;for(var w=0,g=P;w<=g;){var v=Math.floor((g+w)/2);if(b<h[v].startTime)g=v-1;else if(b>h[v].startTime&&w<P)w=v+1;else return v}return h[w].startTime-b<b-h[g].startTime?w:g}function S(h,b,P){var w=[],g=R(h,b);if(g>-1)for(var v=g,d=h.length;v<d;v++){var o=h[v];if(o.startTime>=b&&o.endTime<=P)w.push(o);else if(o.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(q,z,L){"use strict";L.r(z);var K={toString:function(O){for(var B="",k=O.length,R=0;R<k;R++)B+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return B}};z.default=K},"./src/utils/timescale-conversion.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return N}),L.d(z,"toTimescaleFromScale",function(){return O}),L.d(z,"toMsFromMpegTsClock",function(){return B}),L.d(z,"toMpegTsClockFromTimescale",function(){return k});var K=9e4;function N(R,S,h,b){h===void 0&&(h=1),b===void 0&&(b=!1);var P=R*S*h;return b?Math.round(P):P}function O(R,S,h,b){return h===void 0&&(h=1),b===void 0&&(b=!1),N(R,S,1/h,b)}function B(R,S){return S===void 0&&(S=!1),N(R,1e3,1/K,S)}function k(R,S){return S===void 0&&(S=1),N(R,K,1/S)}},"./src/utils/typed-array.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return K});function K(N,O,B){return Uint8Array.prototype.slice?N.slice(O,B):new Uint8Array(Array.prototype.slice.call(N,O,B))}},"./src/utils/vttcue.ts":function(q,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],N=["start","middle","end","left","right"];function O(h,b){if(typeof b!="string")return!1;if(!Array.isArray(h))return!1;var P=b.toLowerCase();return~h.indexOf(P)?P:!1}function B(h){return O(K,h)}function k(h){return O(N,h)}function R(h){for(var b=arguments.length,P=new Array(b>1?b-1:0),w=1;w<b;w++)P[w-1]=arguments[w];for(var g=1;g<arguments.length;g++){var v=arguments[g];for(var d in v)h[d]=v[d]}return h}function S(h,b,P){var w=this,g={enumerable:!0};w.hasBeenReset=!1;var v="",d=!1,o=h,l=b,u=P,C=null,E="",f=!0,A="auto",T="start",p=50,c="middle",s=50,a="middle";Object.defineProperty(w,"id",R({},g,{get:function(){return v},set:function(y){v=""+y}})),Object.defineProperty(w,"pauseOnExit",R({},g,{get:function(){return d},set:function(y){d=!!y}})),Object.defineProperty(w,"startTime",R({},g,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",R({},g,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",R({},g,{get:function(){return u},set:function(y){u=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",R({},g,{get:function(){return C},set:function(y){C=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",R({},g,{get:function(){return E},set:function(y){var m=B(y);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",R({},g,{get:function(){return f},set:function(y){f=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",R({},g,{get:function(){return A},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",R({},g,{get:function(){return T},set:function(y){var m=k(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");T=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",R({},g,{get:function(){return p},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},g,{get:function(){return c},set:function(y){var m=k(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},g,{get:function(){return s},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");s=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},g,{get:function(){return a},set:function(y){var m=k(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");a=m,this.hasBeenReset=!0}})),w.displayState=void 0}return S.prototype.getCueAsHTML=function(){var h=self.WebVTT;return h.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return O}),L.d(z,"fixLineBreaks",function(){return b}),L.d(z,"VTTParser",function(){return P});var K=L("./src/utils/vttcue.ts"),N=function(){function w(){}var g=w.prototype;return g.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},w}();function O(w){function g(d,o,l,u){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var v=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?g(v[2],v[3],0,v[4]):g(v[1],v[2],v[3],v[4]):null}var B=function(){function w(){this.values=Object.create(null)}var g=w.prototype;return g.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},g.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},g.has=function(d){return d in this.values},g.alt=function(d,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(d,o);break}},g.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},g.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},w}();function k(w,g,v,d){var o=d?w.split(d):[w];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(v);if(u.length!==2)continue;var C=u[0],E=u[1];g(C,E)}}var R=new K.default(0,0,""),S=R.align==="middle"?"middle":"center";function h(w,g,v){var d=w;function o(){var C=O(w);if(C===null)throw new Error("Malformed timestamp: "+d);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,E){var f=new B;k(C,function(p,c){var s;switch(p){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(p,v[a].region);break}break;case"vertical":f.alt(p,c,["rl","lr"]);break;case"line":s=c.split(","),f.integer(p,s[0]),f.percent(p,s[0])&&f.set("snapToLines",!1),f.alt(p,s[0],["auto"]),s.length===2&&f.alt("lineAlign",s[1],["start",S,"end"]);break;case"position":s=c.split(","),f.percent(p,s[0]),s.length===2&&f.alt("positionAlign",s[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":f.percent(p,c);break;case"align":f.alt(p,c,["start",S,"end","left","right"]);break}},/:/,/\s/),E.region=f.get("region",null),E.vertical=f.get("vertical","");var A=f.get("line","auto");A==="auto"&&R.line===-1&&(A=-1),E.line=A,E.lineAlign=f.get("lineAlign","start"),E.snapToLines=f.get("snapToLines",!0),E.size=f.get("size",100),E.align=f.get("align",S);var T=f.get("position","auto");T==="auto"&&R.position===50&&(T=E.align==="start"||E.align==="left"?0:E.align==="end"||E.align==="right"?100:50),E.position=T}function u(){w=w.replace(/^\s+/,"")}if(u(),g.startTime=o(),u(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);w=w.substr(3),u(),g.endTime=o(),u(),l(w,g)}function b(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var g=w.prototype;return g.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var T=o.buffer,p=0;for(T=b(T);p<T.length&&T[p]!=="\r"&&T[p]!==`
|
|
`;)++p;var c=T.substr(0,p);return T[p]==="\r"&&++p,T[p]===`
|
|
`&&++p,o.buffer=T.substr(p),c}function u(T){k(T,function(p,c){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=l();var E=C.match(/^()?WEBVTT([ \t].*)?$/);if(!E||!E[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:C=l();switch(o.state){case"HEADER":/:/.test(C)?u(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new K.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{h(C,o.cue,o.regionList)}catch(T){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=C.indexOf("-->")!==-1;if(!C||A&&(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+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(T){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},g.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},w}()},"./src/utils/webvtt-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return P}),L.d(z,"parseWebVTT",function(){return g});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),k=L("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,S=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},h=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),C=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(o)||!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(u)||!Object(K.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*C,o},b=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function P(v,d,o){return b(v.toString())+b(d.toString())+b(o)}var w=function(d,o,l){var u=d[o],C=d[u.prevCC];if(!C||!C.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(E=C)!==null&&E!==void 0&&E.new;){var E;d.ccOffset+=u.start-C.start,u.new=!1,u=C,C=d[u.prevCC]}d.presentationOffset=l};function g(v,d,o,l,u,C,E,f){var A=new N.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
|
|
`).split(`
|
|
`),p=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),s="00:00.000",a=0,x=0,y,m=!0,D=!1;A.oncue=function(U){var F=l[u],W=l.ccOffset,M=(a-c)/9e4;if(F!=null&&F.new&&(x!==void 0?W=l.ccOffset=F.start:w(l,u,M)),M&&(W=M-l.presentationOffset),D){var I=U.endTime-U.startTime,H=Object(k.normalizePts)((U.startTime+W-x)*9e4,C*9e4)/9e4;U.startTime=H,U.endTime=H+I}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=P(U.startTime,U.endTime,X)),U.endTime>0&&p.push(U)},A.onparsingerror=function(U){y=U},A.onflush=function(){if(y){f(y);return}E(p)},T.forEach(function(U){if(m)if(S(U,"X-TIMESTAMP-MAP=")){m=!1,D=!0,U.substr(16).split(",").forEach(function(F){S(F,"LOCAL:")?s=F.substr(6):S(F,"MPEGTS:")&&(a=parseInt(F.substr(7)))});try{x=h(s)/1e3}catch(F){D=!1,y=F}return}else U===""&&(m=!1);A.parse(U+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),N=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,B=function(){function k(S){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=S?S.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var R=k.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var h=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),h&&(h.onreadystatechange=null,h.onprogress=null,h.readyState!==4&&(this.stats.aborted=!0,h.abort()))},R.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(h,b,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=h,this.config=b,this.callbacks=P,this.retryDelay=b.retryDelay,this.loadInternal()},R.loadInternal=function(){var h=this.config,b=this.context;if(!h)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var g=this.xhrSetup;try{if(g)try{g(P,b.url)}catch(o){P.open("GET",b.url,!0),g(P,b.url)}P.readyState||P.open("GET",b.url,!0);var v=this.context.headers;if(v)for(var d in v)P.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:P.status,text:o.message},b,P);return}b.rangeEnd&&P.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),h.timeout),P.send()},R.readystatechange=function(){var h=this.context,b=this.loader,P=this.stats;if(!h||!b)return;var w=b.readyState,g=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){b.onreadystatechange=null,b.onprogress=null;var v=b.status;if(v>=200&&v<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var d,o;if(h.responseType==="arraybuffer"?(d=b.response,o=d.byteLength):(d=b.responseText,o=d.length),P.loaded=P.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(P,h,d,b),!this.callbacks)return;var u={url:b.responseURL,data:d};this.callbacks.onSuccess(u,P,h,b)}else P.retry>=g.maxRetry||v>=400&&v<499?(K.logger.error(v+" while loading "+h.url),this.callbacks.onError({code:v,text:b.statusText},h,b)):(K.logger.warn(v+" while loading "+h.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,g.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout)},R.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var h=this.callbacks;h&&(this.abortInternal(),h.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(h){var b=this.stats;b.loaded=h.loaded,h.lengthComputable&&(b.total=h.total)},R.getCacheAge=function(){var h=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");h=b?parseFloat(b):null}return h},k}();z.default=B}}).default})},vHTk:function(Ze,We,J){Ze.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(Ze,We){function J(){this.buffer=new Array,this.length=0}J.prototype={get:function(q){var z=Math.floor(q/8);return(this.buffer[z]>>>7-q%8&1)==1},put:function(q,z){for(var L=0;L<z;L++)this.putBit((q>>>z-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(q){var z=Math.floor(this.length/8);this.buffer.length<=z&&this.buffer.push(0),q&&(this.buffer[z]|=128>>>this.length%8),this.length++}},Ze.exports=J},we55:function(Ze,We,J){Ze.exports={bg:"bg___3PaSA",flexRow:"flexRow___1k1iY",flexJustifyCenter:"flexJustifyCenter___MzzvD",flexAlignEnd:"flexAlignEnd___1KYBf",flexAlignCenter:"flexAlignCenter___3XoYY",flexColumn:"flexColumn___28jeJ",formWrap:"formWrap___2IoYS",titleWrap:"titleWrap___2LenH",fieldWrap:"fieldWrap___3zhLT",mdWrap:"mdWrap___3fVSN",backgroundFa:"backgroundFa___21qxJ",button:"button___3eTeL"}},wzkS:function(Ze,We,J){"use strict";J.d(We,"c",function(){return N}),J.d(We,"b",function(){return O}),J.d(We,"d",function(){return B}),J.d(We,"a",function(){return R}),J.d(We,"e",function(){return S});var q=J("9og8"),z=J("WmNS"),L=J.n(z),K=J("ErOA");function N(h){return Object(K.c)("libraries/".concat(h,".json"))}function O(){return Object(K.c)("library_tags.json")}function B(h){return k.apply(this,arguments)}function k(){return k=Object(q.a)(L.a.mark(function h(b){var P;return L.a.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,Object(K.b)("attachments/".concat(b,".json"));case 2:return P=g.sent,g.abrupt("return",P.status===0);case 4:case"end":return g.stop()}},h)})),k.apply(this,arguments)}function R(h){return Object(K.f)("libraries.json",h)}function S(h,b){return Object(K.g)("libraries/".concat(h,".json"),b)}},y5JW:function(Ze,We,J){"use strict";J.d(We,"c",function(){return v}),J.d(We,"a",function(){return d});var q=J("DZo9"),z=J("8z0m"),L=J("+L6B"),K=J("2/Rp"),N=J("9og8"),O=J("miYZ"),B=J("tsqr"),k=J("k1fw"),R=J("oBTY"),S=J("WmNS"),h=J.n(S),b=J("cDcd"),P=J.n(b),w=J("m3rI"),g=J("wzkS"),v="\u3000\u3000";function d(o){var l=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,u)).toFixed(1)+" "+l[u]}We.b=function(o){var l=o.value,u=l===void 0?[]:l,C=o.action,E=o.onChange,f=o.className,A=o.maxSize,T=A===void 0?150:A,p=o.title,c=p===void 0?"\u6587\u4EF6\u4E0A\u4F20":p,s=o.accept,a=s===void 0?null:s,x={multiple:!1,fileList:u,accept:a,withCredentials:!0,beforeUpload:function(D){var U=D.size/1024/1024;return!0},action:"".concat(w.a.API_SERVER,"/api/attachments.json"),onChange:function(D){var U,F,W=Object(R.a)(D.fileList);if(W=W.map(function(H){return H.name.indexOf(v)===-1&&(H.name="".concat(H.name).concat(v).concat(d(H.size))),Object(k.a)({},H)}),D.file.status==="done"&&((U=D.file)===null||U===void 0||((F=U.response)===null||F===void 0)?void 0:F.status)===-1){var M,I;B.b.error((M=D.file)===null||M===void 0||((I=M.response)===null||I===void 0)?void 0:I.message),E([]);return}E(W)},onRemove:function(){var m=Object(N.a)(h.a.mark(function U(F){var W,M,I;return h.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=F.size/1024/1024,!(F.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<T){X.next=7;break}return X.abrupt("return",!0);case 7:if(M=F.response?F.response.id:F.uid,!M){X.next=15;break}return X.next=11,Object(g.d)(F.response?F.response.id:F.id);case 11:return I=X.sent,X.abrupt("return",I);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},U)}));function D(U){return m.apply(this,arguments)}return D}()};function y(m){m.preventDefault(),m.stopPropagation()}return P.a.createElement("div",{className:"single-upload ".concat(f||"")},P.a.createElement(z.a,x,P.a.createElement(K.a,{type:"primary",title:u.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:u.length>0,ghost:!0},c),P.a.createElement("span",{onClick:y,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",T,"M)"," ")))}},yQHh:function(Ze,We,J){}}]);
|