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
747 KiB
143 lines
747 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[274,5,6,7],{"+NIl":function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,L){"use strict";function G(C,w){C.cmdState.push(w)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var w=C.cmdState.pop();w&&w.closeBracket()}function B(C){for(var w=C.cmdState,v=w.length-1;v>=0;v--){var d=w[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function F(C,w,v){return function(){this.name=C,this.bracketNo=0,this.style=w,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 M={};M.importmodule=F("importmodule","tag",["string","builtin"]),M.documentclass=F("documentclass","tag",["","atom"]),M.usepackage=F("usepackage","tag",["atom"]),M.begin=F("begin","tag",["atom"]),M.end=F("end","tag",["atom"]),M.label=F("label","tag",["atom"]),M.ref=F("ref","tag",["atom"]),M.eqref=F("eqref","tag",["atom"]),M.cite=F("cite","tag",["atom"]),M.bibitem=F("bibitem","tag",["atom"]),M.Bibitem=F("Bibitem","tag",["atom"]),M.RBibitem=F("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,w){C.f=w}function y(C,w){var v;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return v=M.hasOwnProperty(d)?M[d]:M.DEFAULT,v=new v,G(w,v),D(w,O),v.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(w,function(u,s){return S(u,s,"\\]")}),"keyword";if(C.match("\\("))return D(w,function(u,s){return S(u,s,"\\)")}),"keyword";if(C.match("$$"))return D(w,function(u,s){return S(u,s,"$$")}),"keyword";if(C.match("$"))return D(w,function(u,s){return S(u,s,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=I(w),v)v.closeBracket(o),D(w,O);else return"error";return"bracket"}else return o=="{"||o=="["?(v=M.DEFAULT,v=new v,G(w,v),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),v=B(w),v.name=="begin"&&(v.argument=C.current()),v.styleIdentifier())}function S(C,w,v){if(C.eatSpace())return null;if(v&&C.match(v))return D(w,y),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function O(C,w){var v=C.peek(),d;return v=="{"||v=="["?(d=I(w),d.openBracket(v),C.eat(v),D(w,y),"bracket"):/[ \t\r]/.test(v)?(C.eat(v),null):(D(w,y),R(w),y(C,w))}return{startState:function(){var C=L.inMathMode?function(w,v){return S(w,v)}:y;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,w){return w.f(C,w)},blankLine:function(C){C.f=y,C.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(ut,qe,te){},"19Vz":function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){re.defineOption("placeholder","",function(F,M,D){var y=D&&D!=re.Init;if(M&&!y)F.on("blur",I),F.on("change",R),F.on("swapDoc",R),re.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){G(F)}),R(F);else if(!M&&y){F.off("blur",I),F.off("change",R),F.off("swapDoc",R),re.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),V(F);var S=F.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}M&&!F.hasFocus()&&I(F)});function V(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function L(F){V(F);var M=F.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=F.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var D=F.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),M.appendChild(D),F.display.lineSpace.insertBefore(M,F.display.lineSpace.firstChild)}function G(F){setTimeout(function(){var M=!1,D=F.getInputField();D.nodeName=="TEXTAREA"?M=!D.value:F.lineCount()==1&&(M=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),M?L(F):V(F)},20)}function I(F){B(F)&&L(F)}function R(F){var M=F.getWrapperElement(),D=B(F);M.className=M.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(F):V(F)}function B(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(G,I){var R=G.indentUnit,B={},F=I.htmlMode?V:L;for(var M in F)B[M]=F[M];for(var M in I)B[M]=I[M];var D,y;function S(a,g){function m(U){return g.tokenize=U,U(a,g)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(w("atom","]]>")):null:a.match("--")?m(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=w("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",g.tokenize=O,"tag bracket");if(E=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}S.isInText=!0;function O(a,g){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return g.tokenize=S,D=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return D="equals",null;if(m=="<"){g.tokenize=S,g.state=s,g.tagName=g.tagStart=null;var E=g.tokenize(a,g);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(g.tokenize=C(m),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var g=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return g.isInAttribute=!0,g}function w(a,g){return function(m,E){for(;!m.eol();){if(m.match(g)){E.tokenize=S;break}m.next()}return a}}function v(a){return function(g,m){for(var E;(E=g.next())!=null;){if(E=="<")return m.tokenize=v(a+1),m.tokenize(g,m);if(E==">")if(a==1){m.tokenize=S;break}else return m.tokenize=v(a-1),m.tokenize(g,m)}return"meta"}}function d(a,g,m){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,g){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(g))return;o(a)}}function s(a,g,m){return a=="openTag"?(m.tagStart=g.column(),x):a=="closeTag"?p:s}function x(a,g,m){return a=="word"?(m.tagName=g.current(),y="tag",b):B.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,g,m)):(y="error",x)}function p(a,g,m){if(a=="word"){var E=g.current();return m.context&&m.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||B.matchClosing===!1?(y="tag",f):(y="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(y="tag bracket",f(a,g,m)):(y="error",A)}function f(a,g,m){return a!="endTag"?(y="error",f):(o(m),s)}function A(a,g,m){return y="error",f(a,g,m)}function b(a,g,m){if(a=="word")return y="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,P=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new d(m,E,P==m.indented)),s}return y="error",b}function h(a,g,m){return a=="equals"?c:(B.allowMissing||(y="error"),b(a,g,m))}function c(a,g,m){return a=="string"?l:a=="word"&&B.allowUnquoted?(y="string",b):(y="error",b(a,g,m))}function l(a,g,m){return a=="string"?l:b(a,g,m)}return{startState:function(a){var g={tokenize:S,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;D=null;var m=g.tokenize(a,g);return(m||D)&&m!="comment"&&(y=null,g.state=g.state(D||m,a,g),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,g,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=S)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var P=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(P&&P[1])for(;E;)if(E.tagName==P[2]){E=E.prev;break}else if(B.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(P)for(;E;){var U=B.contextGrabbers[E.tagName];if(U&&U.hasOwnProperty(P[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+R: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=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],m=a.context;m;m=m.prev)m.tagName&&g.push(m.tagName);return g.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(ut,qe,te){"use strict";te.d(qe,"a",function(){return u});var re=te("Ty5D"),V=te("dI71"),L=te("cDcd"),G=te.n(L),I=te("YS25"),R=te("17x9"),B=te.n(R),F=te("wx14"),M=te("zLVn"),D=te("9R94"),y=function(c){Object(V.a)(l,c);function l(){for(var g,m=arguments.length,E=new Array(m),P=0;P<m;P++)E[P]=arguments[P];return g=c.call.apply(c,[this].concat(E))||this,g.history=Object(I.a)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),S=function(c){Object(V.a)(l,c);function l(){for(var g,m=arguments.length,E=new Array(m),P=0;P<m;P++)E[P]=arguments[P];return g=c.call.apply(c,[this].concat(E))||this,g.history=Object(I.b)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},w=function(l){return l},v=G.a.forwardRef;typeof v=="undefined"&&(v=w);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,l){var a=c.innerRef,g=c.navigate,m=c.onClick,E=Object(M.a)(c,["innerRef","navigate","onClick"]),P=E.target,U=Object(F.a)({},E,{onClick:function(W){try{m&&m(W)}catch(_){throw W.preventDefault(),_}!W.defaultPrevented&&W.button===0&&(!P||P==="_self")&&!d(W)&&(W.preventDefault(),g())}});return w!==v?U.ref=l||a:U.ref=a,G.a.createElement("a",U)}),u=v(function(c,l){var a=c.component,g=a===void 0?o:a,m=c.replace,E=c.to,P=c.innerRef,U=Object(M.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(j){j||Object(D.a)(!1);var W=j.history,_=C(O(E,j.location),j.location),k=_?W.createHref(_):"",K=Object(F.a)({},U,{href:k,navigate:function(){var q=O(E,j.location),ae=m?W.replace:W.push;ae(q)}});return w!==v?K.ref=l||P:K.innerRef=P,G.a.createElement(g,K)})});if(!1)var s,x;var p=function(l){return l},f=G.a.forwardRef;typeof f=="undefined"&&(f=p);function A(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(g){return g}).join(" ")}var b=f(function(c,l){var a=c["aria-current"],g=a===void 0?"page":a,m=c.activeClassName,E=m===void 0?"active":m,P=c.activeStyle,U=c.className,j=c.exact,W=c.isActive,_=c.location,k=c.sensitive,K=c.strict,Y=c.style,q=c.to,ae=c.innerRef,Ee=Object(M.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(ve){ve||Object(D.a)(!1);var ge=_||ve.location,fe=C(O(q,ge),ge),me=fe.pathname,oe=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),pe=oe?Object(re.f)(ge.pathname,{path:oe,exact:j,sensitive:k,strict:K}):null,$=!!(W?W(pe,ge):pe),ie=$?A(U,E):U,Z=$?Object(F.a)({},Y,{},P):Y,xe=Object(F.a)({"aria-current":$&&g||null,className:ie,style:Z,to:fe},Ee);return p!==f?xe.ref=l||ae:xe.innerRef=ae,G.a.createElement(u,xe)})});if(!1)var h},"7Cbv":function(ut,qe,te){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function L(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(V)}var G=/^(?:[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 I(O){return typeof O=="string"&&G.test(O)}for(var R=I,B=[],F=0;F<256;++F)B.push((F+256).toString(16).substr(1));function M(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(B[O[C+0]]+B[O[C+1]]+B[O[C+2]]+B[O[C+3]]+"-"+B[O[C+4]]+B[O[C+5]]+"-"+B[O[C+6]]+B[O[C+7]]+"-"+B[O[C+8]]+B[O[C+9]]+"-"+B[O[C+10]]+B[O[C+11]]+B[O[C+12]]+B[O[C+13]]+B[O[C+14]]+B[O[C+15]]).toLowerCase();if(!R(w))throw TypeError("Stringified UUID is invalid");return w}var D=M;function y(O,C,w){O=O||{};var v=O.random||(O.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,C){w=w||0;for(var d=0;d<16;++d)C[w+d]=v[d];return C}return D(v)}var S=qe.a=y},"7ahc":function(ut,qe,te){"use strict";te.d(qe,"a",function(){return x});var re=te("k1fw"),V=te("0Owb"),L=te("+L6B"),G=te("2/Rp"),I=te("y8nQ"),R=te("Vl3Y"),B=te("tJVT"),F=te("OaEy"),M=te("2fM7"),D=te("cDcd"),y=te.n(D),S=te("VrN/"),O=te.n(S),C=te("p77/"),w=te.n(C),v=te("c5Ni"),d=te.n(v),o=M.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},s={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};qe.b=function(p){var f=p.callback,A=p.onCancel,b=Object(D.useState)("python"),h=Object(B.a)(b,2),c=h[0],l=h[1];function a(m){l(s[m][1])}function g(m){f(m)}return y.a.createElement(R.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(M.a,{onChange:a},Object.keys(s).map(function(m){return y.a.createElement(o,{key:m,value:m},s[m][0])}))),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(x,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(G.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function x(p){var f=p.value,A=p.onChange,b=p.mode,h=p.options,c=h===void 0?{}:h,l=Object(D.useRef)(),a=Object(D.useState)(),g=Object(B.a)(a,2),m=g[0],E=g[1];return Object(D.useEffect)(function(){if(m){function P(U){var j=U.getValue();A&&A(j)}return m.on("change",P),function(){m.off("change",P)}}},[m,A]),Object(D.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(D.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(D.useEffect)(function(){if(l.current&&!m){var P=O.a.fromTextArea(l.current,Object(re.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(P)}},[l.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:l}))}},"8EBN":function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<re.modeInfo.length;V++){var L=re.modeInfo[V];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return re.findModeByMIME("application/xml");if(/\+json$/.test(G))return re.findModeByMIME("application/json")},re.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},re.findModeByFileName=function(G){for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),F=B>-1&&G.substring(B+1,G.length);if(F)return re.findModeByExtension(F)},re.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"8hTe":function(ut,qe,te){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,qe,te){"use strict";var re=te("DYRE"),V=te("zeV3"),L=te("+L6B"),G=te("2/Rp"),I=te("k1fw"),R=te("tJVT"),B=te("cDcd"),F=te.n(B),M=te("vg9a"),D=te("DlQD"),y=te.n(D),S=te("rUJ1");function O(ge,fe){var me=ge.match(/^(\s+)(?:```)/);if(me===null)return fe;var oe=me[1];return fe.split(`
|
|
`).map(function(pe){var $=pe.match(/^\s+/);if($===null)return pe;var ie=Object(R.a)($,1),Z=ie[0];return Z.length>=oe.length?pe.slice(oe.length):pe}).join(`
|
|
`)}var C=[],w=["<ul>"],v=new y.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,w=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(ge,fe,me,oe){if(fe>=ge.length||ge[fe].level<=me)return fe;var pe=ge[fe];oe.push("<li><a href='#"+pe.anchor+"'>"+pe.text+"</a>"),fe++;var $=[];return fe=s(ge,fe,pe.level,$),$.length>0&&(oe.push("<ul>"),$.forEach(function(ie){oe.push(ie)}),oe.push("</ul>")),oe.push("</li>"),fe=s(ge,fe,me,oe),fe}function x(){return s(C,0,0,w),w.push("</ul>"),w.join("")}var p={heading:function(fe){var me=d.exec(fe);if(me)return{type:"heading",raw:me[0],depth:me[1].length,text:me[2]}},fences:function(fe){var me=this.rules.block.fences.exec(fe);if(me){var oe=me[0],pe=O(oe,me[3]||""),$=me[2]?me[2].trim():me[2];if(["latex","katex","math"].indexOf($)>=0){var ie=b(),Z=pe;pe=ie,h[ie]={type:"block",expression:Z}}return{type:"code",raw:oe,lang:$,text:pe}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,b=function(){return"__special_katext_id_".concat(A++,"__")},h={};function c(){return h}function l(){A=0,h={}}function a(ge){return ge=ge.replace(f,function(fe,me){var oe=b();return h[oe]={type:"inline",expression:me},oe}),ge}var g=v.listitem;v.listitem=function(ge){return g(a(ge))};var m=v.paragraph;v.paragraph=function(ge){return m(a(ge))};var E=v.tablecell;v.tablecell=function(ge,fe){return E(a(ge),fe)},v.code=function(ge,fe,me){var oe=(fe||"").match(/\S*/)[0];return oe?["latex","katex","math"].indexOf(oe)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(me?ge:Object(S.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(me?ge:Object(S.escape)(ge,!0))+"</code></pre>"},v.heading=function(ge,fe,me){var oe=this.options.headerPrefix+me.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:oe,level:fe,text:ge}),"<h"+fe+' id="'+oe+'">'+ge+"</h"+fe+">"},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:p,renderer:v});var P=y.a,U=te("SJMd"),j=te("ulZh"),W=te.n(j),_=te("m3rI"),k=te("Oy/b"),K=te("p5ED"),Y=te("8hTe"),q=te.n(Y),ae=/<pre[^>]*>/g;function Ee(ge){var fe=document.createElement("div");return fe.innerHTML=ge,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var ve=qe.a=function(ge){var fe=ge.value,me=fe===void 0?"":fe,oe=ge.edit,pe=oe===void 0?!1:oe,$=ge.className,ie=ge.showTextOnly,Z=ge.showLines,xe=ge.replaces,Le=ge.zoomImg,be=ge.hasMask,Ce=ge.style,_e=Ce===void 0?{}:Ce,ke=ge.stylesPrev,Ue=ke===void 0?{}:ke,Pe=String(me),Oe=Object(B.useRef)(),Je=Object(B.useRef)(),Qe=Object(B.useState)(""),We=Object(R.a)(Qe,2),Ge=We[0],Ze=We[1],He=Object(B.useState)("office"),Ke=Object(R.a)(He,2),Se=Ke[0],et=Ke[1],Ye=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,J=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Pe=Pe.replace(de,"("+_.a.API_SERVER+"/api/attachments/").replace(J,'"'+_.a.API_SERVER+"/api/attachments/").replace(Q,'"'+_.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Ae){}var ee=P(Pe),se=c();if(Pe.match(/\[TOC\]/)&&(ee=ee.replace("<p>[TOC]</p>",x()),o()),ee=ee.replace(/(__special_katext_id_\d+__)/g,function(Ae,we){var Me=se[we],$e=Me.type,ze=Me.expression;return Object(k.renderToString)(Ee(ze)||"",{displayMode:$e==="block",throwOnError:!1,output:"html"})}),ee=ee.replace(/▁/g,"\u2581\u2581\u2581"),l(),ie){var ce=document.createElement("div");return ce.innerHTML=ee,ce.innerText}return setTimeout(function(){return he()},500),ee},[Pe]),De=Object(B.useRef)();u.WebkitLineClamp=Z,Z&&(_e=Object(I.a)(Object(I.a)({},_e),u));function Fe(de){var J=de.target;if(J.tagName.toUpperCase()==="IMG"){if(Le){var Q=J.getAttribute("src");Ze(Q),et("image")}}else if(J.tagName.toUpperCase()==="A"){var ee=J.getAttribute("href");if(ee.indexOf("office")>-1)de.preventDefault(),Ze(ee),et("office");else if(ee.indexOf("application/pdf")>-1)de.preventDefault(),Ze(ee),et("pdf");else if(ee.indexOf("text/html")>-1)de.preventDefault(),Ze(ee),et("html");else if(ee.startsWith("#")){de.preventDefault();var se=document.getElementById(ee.replace("#",""));se&&se.scrollIntoView(!0)}}}var he=function(){var J,Q=(J=De.current)===null||J===void 0?void 0:J.querySelectorAll("video");Q==null||Q.forEach(function(ee){if(ee.oncontextmenu=function(){return!1},ee.src.indexOf(".m3u8")>-1&&!ee.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(ee.src),se.attachMedia(ee)}}})};Object(B.useEffect)(function(){if(De.current&&Ye&&(Ye.match(ae)&&window.PR.prettyPrint()),De.current)return De.current.addEventListener("click",Fe),function(){De.current.removeEventListener("click",Fe),l(),o()}},[Ye,De.current,Fe]);var le=function(J){if(!pe)return;J.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=J.target.clientWidth+"px",Oe.current.style.height=J.target.clientHeight+"px",Oe.current.style.top=J.target.offsetTop+"px",Oe.current.style.left=J.target.offsetLeft+"px",Je.current.src=J.target.getAttribute("src")):Oe.current.style.display="none"};return F.a.createElement("div",{style:{position:"relative"}},F.a.createElement("div",{ref:De,style:Object(I.a)({},_e),className:"".concat($||""," markdown-body ").concat(q.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:Ye}}),F.a.createElement("div",{ref:Oe,className:q.a.button},F.a.createElement(V.a,null,F.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),F.a.createElement(G.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),F.a.createElement("img",{ref:Je,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),F.a.createElement(K.a,{close:!0,data:Ge,type:Ge!=null&&Ge.length?Se:"",style:Object(I.a)({},Ue),onClose:function(){return Ze("")}}))}},"9VGf":function(ut,qe,te){"use strict";te.d(qe,"a",function(){return L});var re=te("cDcd"),V=te.n(re);function L(G,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=G}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var F=setInterval(B,I);return function(){return clearInterval(F)}}},[I])}},BU3w:function(ut,qe,te){"use strict";te.d(qe,"a",function(){return R});var re=te("MNnm"),V="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var F=document.querySelector("head");return F||document.body}function G(B){var F,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var D=document.createElement("style");if((F=M.csp)===null||F===void 0?void 0:F.nonce){var y;D.nonce=(y=M.csp)===null||y===void 0?void 0:y.nonce}D.innerHTML=B;var S=L(M),O=S.firstChild;return M.prepend&&S.prepend?S.prepend(D):M.prepend&&O?S.insertBefore(D,O):S.appendChild(D),D}var I=new Map;function R(B,F){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=L(M);if(!I.has(D)){var y=G("",M),S=y.parentNode;I.set(D,S),S.removeChild(y)}var O=Array.from(I.get(D).children).find(function(o){return o.tagName==="STYLE"&&o[V]===F});if(O){var C,w;if(((C=M.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((w=M.csp)===null||w===void 0?void 0:w.nonce)){var v;O.nonce=(v=M.csp)===null||v===void 0?void 0:v.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=G(B,M);return d[V]=F,d}},Bd2K:function(ut,qe,te){(function(re){re(te("VrN/"),te("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(M,D,y){if(y!=re.Init&&y&&M.removeKeyMap("autoCloseTags"),!D)return;var S={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(S["'/'"]=function(O){return R(O)}),(typeof D!="object"||D.whenOpening!==!1)&&(S["'>'"]=function(O){return G(O)}),M.addKeyMap(S)});var V=["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 G(M){if(M.getOption("disableInput"))return re.Pass;for(var D=M.listSelections(),y=[],S=M.getOption("autoCloseTags"),O=0;O<D.length;O++){if(!D[O].empty())return re.Pass;var C=D[O].head,w=M.getTokenAt(C),v=re.innerMode(M.getMode(),w.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var s=v.mode.configuration=="html",x=typeof S=="object"&&S.dontCloseTags||s&&V,p=typeof S=="object"&&S.indentTags||s&&L;w.end>C.ch&&(u=u.slice(0,u.length-w.end+C.ch));var f=u.toLowerCase();if(!u||w.type=="string"&&(w.end!=C.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==C.ch-w.start-1||x&&B(x,f)>-1||F(M,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],u,C,!0))return re.Pass;var A=typeof S=="object"&&S.emptyTags;if(A&&B(A,u)>-1){y[O]={text:"/>",newPos:re.Pos(C.line,C.ch+2)};continue}var b=p&&B(p,f)>-1;y[O]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+u+">",newPos:b?re.Pos(C.line+1,0):re.Pos(C.line,C.ch+1)}}for(var h=typeof S=="object"&&S.dontIndentOnAutoClose,O=D.length-1;O>=0;O--){var c=y[O];M.replaceRange(c.text,D[O].head,D[O].anchor,"+insert");var l=M.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},M.setSelections(l),!h&&c.indent&&(M.indentLine(c.newPos.line,null,!0),M.indentLine(c.newPos.line+1,null,!0))}}function I(M,D){for(var y=M.listSelections(),S=[],O=D?"/":"</",C=M.getOption("autoCloseTags"),w=typeof C=="object"&&C.dontIndentOnSlash,v=0;v<y.length;v++){if(!y[v].empty())return re.Pass;var d=y[v].head,o=M.getTokenAt(d),u=re.innerMode(M.getMode(),o.state),s=u.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return re.Pass;var x,p=u.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(p&&u.mode.name=="javascript")x=O+"script";else if(p&&u.mode.name=="css")x=O+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(s);if(!f||f.length&&F(M,f,f[f.length-1],d))return re.Pass;x=O+f[f.length-1]}M.getLine(d.line).charAt(o.end)!=">"&&(x+=">"),S[v]=x}if(M.replaceSelections(S),y=M.listSelections(),!w)for(var v=0;v<y.length;v++)(v==y.length-1||y[v].head.line<y[v+1].head.line)&&M.indentLine(y[v].head.line)}function R(M){return M.getOption("disableInput")?re.Pass:I(M,!0)}re.commands.closeTag=function(M){return I(M)};function B(M,D){if(M.indexOf)return M.indexOf(D);for(var y=0,S=M.length;y<S;++y)if(M[y]==D)return y;return-1}function F(M,D,y,S,O){if(!re.scanForClosingTag)return!1;var C=Math.min(M.lastLine()+1,S.line+500),w=re.scanForClosingTag(M,S,null,C);if(!w||w.tag!=y)return!1;for(var v=O?1:0,d=D.length-1;d>=0&&D[d]==y;d--)++v;S=w.to;for(var d=1;d<v;d++){var o=re.scanForClosingTag(M,S,null,C);if(!o||o.tag!=y)return!1;S=o.to}return!0}})},BjJ7:function(ut,qe,te){"use strict";te.d(qe,"d",function(){return V}),te.d(qe,"c",function(){return L}),te.d(qe,"e",function(){return G}),te.d(qe,"b",function(){return I}),te.d(qe,"a",function(){return B});var re=te("m3rI");function V(F){var M=!0;if(F.length>0){for(var D=0;D<F.length;D++)if(F[D].compile_success==0||!F[D].compile_success){M=!1;break}}else M=!1;return M}function L(F){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],y=0;y<F.length;y++){var S=F[y],O=M?"".concat(M,"/").concat(S.name):"".concat(S.name);D.push({title:S.name,isLeaf:!(S.type==="tree"),key:O})}return D}function G(F,M,D){for(var y=0;y<F.length;y++){var S=F[y];if(S.key===M){S.children=D;break}S.children&&G(S.children,M,D)}return F}function I(F,M,D){var y;return function(){var S=this,O=arguments,C=function(){y=null,D||F.apply(S,O)},w=D&&!y;clearTimeout(y),y=setTimeout(C,M),w&&F.apply(S,O)}}var R=!0,B=re.a.API_SERVER},"C+DQ":function(ut,qe,te){},DlQD:function(ut,qe,te){(function(re,V){ut.exports=V()})(this,function(){"use strict";function re(he,le){for(var de=0;de<le.length;de++){var J=le[de];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(he,J.key,J)}}function V(he,le,de){return le&&re(he.prototype,le),de&&re(he,de),he}function L(he,le){if(!he)return;if(typeof he=="string")return G(he,le);var de=Object.prototype.toString.call(he).slice(8,-1);if(de==="Object"&&he.constructor&&(de=he.constructor.name),de==="Map"||de==="Set")return Array.from(he);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return G(he,le)}function G(he,le){(le==null||le>he.length)&&(le=he.length);for(var de=0,J=new Array(le);de<le;de++)J[de]=he[de];return J}function I(he,le){var de;if(typeof Symbol=="undefined"||he[Symbol.iterator]==null){if(Array.isArray(he)||(de=L(he))||le&&he&&typeof he.length=="number"){de&&(he=de);var J=0;return function(){return J>=he.length?{done:!0}:{done:!1,value:he[J++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return de=he[Symbol.iterator](),de.next.bind(de)}function R(he,le){return le={exports:{}},he(le,le.exports),le.exports}var B=R(function(he){function le(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function de(J){he.exports.defaults=J}he.exports={defaults:le(),getDefaults:le,changeDefaults:de}}),F=B.defaults,M=B.getDefaults,D=B.changeDefaults,y=/[&<>"']/,S=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(le){return w[le]};function d(he,le){if(le){if(y.test(he))return he.replace(S,v)}else if(O.test(he))return he.replace(C,v);return he}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(he){return he.replace(o,function(le,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var s=/(^|[^\[])\^/g;function x(he,le){he=he.source||he,le=le||"";var de={replace:function(Q,ee){return ee=ee.source||ee,ee=ee.replace(s,"$1"),he=he.replace(Q,ee),de},getRegex:function(){return new RegExp(he,le)}};return de}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(he,le,de){if(he){var J;try{J=decodeURIComponent(u(de)).replace(p,"").toLowerCase()}catch(Q){return null}if(J.indexOf("javascript:")===0||J.indexOf("vbscript:")===0||J.indexOf("data:")===0)return null}le&&!f.test(de)&&(de=a(le,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Q){return null}return de}var b={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(he,le){b[" "+he]||(h.test(he)?b[" "+he]=he+"/":b[" "+he]=P(he,"/",!0)),he=b[" "+he];var de=he.indexOf(":")===-1;return le.substring(0,2)==="//"?de?le:he.replace(c,"$1")+le:le.charAt(0)==="/"?de?le:he.replace(l,"$1")+le:he+le}var g={exec:function(){}};function m(he){for(var le=1,de,J;le<arguments.length;le++){de=arguments[le];for(J in de)Object.prototype.hasOwnProperty.call(de,J)&&(he[J]=de[J])}return he}function E(he,le){var de=he.replace(/\|/g,function(ee,se,ce){for(var Ae=!1,we=se;--we>=0&&ce[we]==="\\";)Ae=!Ae;return Ae?"|":" |"}),J=de.split(/ \|/),Q=0;if(J.length>le)J.splice(le);else for(;J.length<le;)J.push("");for(;Q<J.length;Q++)J[Q]=J[Q].trim().replace(/\\\|/g,"|");return J}function P(he,le,de){var J=he.length;if(J===0)return"";for(var Q=0;Q<J;){var ee=he.charAt(J-Q-1);if(ee===le&&!de)Q++;else if(ee!==le&&de)Q++;else break}return he.substr(0,J-Q)}function U(he,le){if(he.indexOf(le[1])===-1)return-1;for(var de=he.length,J=0,Q=0;Q<de;Q++)if(he[Q]==="\\")Q++;else if(he[Q]===le[0])J++;else if(he[Q]===le[1]&&(J--,J<0))return Q;return-1}function j(he){he&&he.sanitize&&!he.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:u,edit:x,cleanUrl:A,resolveUrl:a,noopTest:g,merge:m,splitCells:E,rtrim:P,findClosingBracket:U,checkSanitizeDeprecation:j},_=B.defaults,k=W.rtrim,K=W.splitCells,Y=W.escape,q=W.findClosingBracket;function ae(he,le,de){var J=le.href,Q=le.title?Y(le.title):null,ee=he[1].replace(/\\([\[\]])/g,"$1");return he[0].charAt(0)!=="!"?{type:"link",raw:de,href:J,title:Q,text:ee}:{type:"image",raw:de,href:J,title:Q,text:Y(ee)}}function Ee(he,le){var de=he.match(/^(\s+)(?:```)/);if(de===null)return le;var J=de[1];return le.split(`
|
|
`).map(function(Q){var ee=Q.match(/^\s+/);if(ee===null)return Q;var se=ee[0];return se.length>=J.length?Q.slice(J.length):Q}).join(`
|
|
`)}var ve=function(){function he(de){this.options=de||_}var le=he.prototype;return le.space=function(J){var Q=this.rules.block.newline.exec(J);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},le.code=function(J,Q){var ee=this.rules.block.code.exec(J);if(ee){var se=Q[Q.length-1];if(se&&se.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var ce=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:k(ce,`
|
|
`)}}},le.fences=function(J){var Q=this.rules.block.fences.exec(J);if(Q){var ee=Q[0],se=Ee(ee,Q[3]||"");return{type:"code",raw:ee,lang:Q[2]?Q[2].trim():Q[2],text:se}}},le.heading=function(J){var Q=this.rules.block.heading.exec(J);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function(J){var Q=this.rules.block.nptable.exec(J);if(Q){var ee={type:"table",header:K(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(ee.header.length===ee.align.length){var se=ee.align.length,ce;for(ce=0;ce<se;ce++)/^ *-+: *$/.test(ee.align[ce])?ee.align[ce]="right":/^ *:-+: *$/.test(ee.align[ce])?ee.align[ce]="center":/^ *:-+ *$/.test(ee.align[ce])?ee.align[ce]="left":ee.align[ce]=null;for(se=ee.cells.length,ce=0;ce<se;ce++)ee.cells[ce]=K(ee.cells[ce],ee.header.length);return ee}}},le.hr=function(J){var Q=this.rules.block.hr.exec(J);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function(J){var Q=this.rules.block.blockquote.exec(J);if(Q){var ee=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:ee}}},le.list=function(J){var Q=this.rules.block.list.exec(J);if(Q){for(var ee=Q[0],se=Q[2],ce=se.length>1,Ae=se[se.length-1]===")",we={type:"list",raw:ee,ordered:ce,start:ce?+se.slice(0,-1):"",loose:!1,items:[]},Me=Q[0].match(this.rules.block.item),$e=!1,ze,mt,dt,ot,Ct,bt,Bt,Ft=Me.length,Et=0;Et<Ft;Et++)ze=Me[Et],ee=ze,mt=ze.length,ze=ze.replace(/^ *([*+-]|\d+[.)]) */,""),~ze.indexOf(`
|
|
`)&&(mt-=ze.length,ze=this.options.pedantic?ze.replace(/^ {1,4}/gm,""):ze.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Et!==Ft-1&&(dt=this.rules.block.bullet.exec(Me[Et+1])[0],(ce?dt.length===1||!Ae&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==se)&&(ot=Me.slice(Et+1).join(`
|
|
`),we.raw=we.raw.substring(0,we.raw.length-ot.length),Et=Ft-1)),Ct=$e||/\n\n(?!\s*$)/.test(ze),Et!==Ft-1&&($e=ze.charAt(ze.length-1)===`
|
|
`,Ct||(Ct=$e)),Ct&&(we.loose=!0),bt=/^\[[ xX]\] /.test(ze),Bt=void 0,bt&&(Bt=ze[1]!==" ",ze=ze.replace(/^\[[ xX]\] +/,"")),we.items.push({type:"list_item",raw:ee,task:bt,checked:Bt,loose:Ct,text:ze});return we}},le.html=function(J){var Q=this.rules.block.html.exec(J);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):Y(Q[0]):Q[0]}},le.def=function(J){var Q=this.rules.block.def.exec(J);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var ee=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function(J){var Q=this.rules.block.table.exec(J);if(Q){var ee={type:"table",header:K(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ee.header.length===ee.align.length){ee.raw=Q[0];var se=ee.align.length,ce;for(ce=0;ce<se;ce++)/^ *-+: *$/.test(ee.align[ce])?ee.align[ce]="right":/^ *:-+: *$/.test(ee.align[ce])?ee.align[ce]="center":/^ *:-+ *$/.test(ee.align[ce])?ee.align[ce]="left":ee.align[ce]=null;for(se=ee.cells.length,ce=0;ce<se;ce++)ee.cells[ce]=K(ee.cells[ce].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},le.lheading=function(J){var Q=this.rules.block.lheading.exec(J);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function(J){var Q=this.rules.block.paragraph.exec(J);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},le.text=function(J,Q){var ee=this.rules.block.text.exec(J);if(ee){var se=Q[Q.length-1];return se&&se.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},le.escape=function(J){var Q=this.rules.inline.escape.exec(J);if(Q)return{type:"escape",raw:Q[0],text:Y(Q[1])}},le.tag=function(J,Q,ee){var se=this.rules.inline.tag.exec(J);if(se)return!Q&&/^<a /i.test(se[0])?Q=!0:Q&&/^<\/a>/i.test(se[0])&&(Q=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Q,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},le.link=function(J){var Q=this.rules.inline.link.exec(J);if(Q){var ee=q(Q[2],"()");if(ee>-1){var se=Q[0].indexOf("!")===0?5:4,ce=se+Q[1].length+ee;Q[2]=Q[2].substring(0,ee),Q[0]=Q[0].substring(0,ce).trim(),Q[3]=""}var Ae=Q[2],we="";if(this.options.pedantic){var Me=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Me?(Ae=Me[1],we=Me[3]):we=""}else we=Q[3]?Q[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var $e=ae(Q,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:we&&we.replace(this.rules.inline._escapes,"$1")},Q[0]);return $e}},le.reflink=function(J,Q){var ee;if((ee=this.rules.inline.reflink.exec(J))||(ee=this.rules.inline.nolink.exec(J))){var se=(ee[2]||ee[1]).replace(/\s+/g," ");if(se=Q[se.toLowerCase()],!se||!se.href){var ce=ee[0].charAt(0);return{type:"text",raw:ce,text:ce}}var Ae=ae(ee,se,ee[0]);return Ae}},le.strong=function(J,Q,ee){ee===void 0&&(ee="");var se=this.rules.inline.strong.start.exec(J);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*J.length);var ce=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var Ae;(se=ce.exec(Q))!=null;)if(Ae=this.rules.inline.strong.middle.exec(Q.slice(0,se.index+3)),Ae)return{type:"strong",raw:J.slice(0,Ae[0].length),text:J.slice(2,Ae[0].length-2)}}},le.em=function(J,Q,ee){ee===void 0&&(ee="");var se=this.rules.inline.em.start.exec(J);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*J.length);var ce=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var Ae;(se=ce.exec(Q))!=null;)if(Ae=this.rules.inline.em.middle.exec(Q.slice(0,se.index+2)),Ae)return{type:"em",raw:J.slice(0,Ae[0].length),text:J.slice(1,Ae[0].length-1)}}},le.codespan=function(J){var Q=this.rules.inline.code.exec(J);if(Q){var ee=Q[2].replace(/\n/g," "),se=/[^ ]/.test(ee),ce=ee.startsWith(" ")&&ee.endsWith(" ");return se&&ce&&(ee=ee.substring(1,ee.length-1)),ee=Y(ee,!0),{type:"codespan",raw:Q[0],text:ee}}},le.br=function(J){var Q=this.rules.inline.br.exec(J);if(Q)return{type:"br",raw:Q[0]}},le.del=function(J){var Q=this.rules.inline.del.exec(J);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function(J,Q){var ee=this.rules.inline.autolink.exec(J);if(ee){var se,ce;return ee[2]==="@"?(se=Y(this.options.mangle?Q(ee[1]):ee[1]),ce="mailto:"+se):(se=Y(ee[1]),ce=se),{type:"link",raw:ee[0],text:se,href:ce,tokens:[{type:"text",raw:se,text:se}]}}},le.url=function(J,Q){var ee;if(ee=this.rules.inline.url.exec(J)){var se,ce;if(ee[2]==="@")se=Y(this.options.mangle?Q(ee[0]):ee[0]),ce="mailto:"+se;else{var Ae;do Ae=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(Ae!==ee[0]);se=Y(ee[0]),ee[1]==="www."?ce="http://"+se:ce=se}return{type:"link",raw:ee[0],text:se,href:ce,tokens:[{type:"text",raw:se,text:se}]}}},le.inlineText=function(J,Q,ee){var se=this.rules.inline.text.exec(J);if(se){var ce;return Q?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:ce=Y(this.options.smartypants?ee(se[0]):se[0]),{type:"text",raw:se[0],text:ce}}},he}(),ge=W.noopTest,fe=W.edit,me=W.merge,oe={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:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};oe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,oe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,oe.def=fe(oe.def).replace("label",oe._label).replace("title",oe._title).getRegex(),oe.bullet=/(?:[*+-]|\d{1,9}[.)])/,oe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,oe.item=fe(oe.item,"gm").replace(/bull/g,oe.bullet).getRegex(),oe.list=fe(oe.list).replace(/bull/g,oe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+oe.def.source+")").getRegex(),oe._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",oe._comment=/<!--(?!-?>)[\s\S]*?-->/,oe.html=fe(oe.html,"i").replace("comment",oe._comment).replace("tag",oe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe.paragraph=fe(oe._paragraph).replace("hr",oe.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",oe._tag).getRegex(),oe.blockquote=fe(oe.blockquote).replace("paragraph",oe.paragraph).getRegex(),oe.normal=me({},oe),oe.gfm=me({},oe.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*|$)"}),oe.gfm.nptable=fe(oe.gfm.nptable).replace("hr",oe.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",oe._tag).getRegex(),oe.gfm.table=fe(oe.gfm.table).replace("hr",oe.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",oe._tag).getRegex(),oe.pedantic=me({},oe.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",oe._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:ge,paragraph:fe(oe.normal._paragraph).replace("hr",oe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",oe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var pe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,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:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};pe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",pe.punctuation=fe(pe.punctuation).replace(/punctuation/g,pe._punctuation).getRegex(),pe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",pe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",pe.em.start=fe(pe.em.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.middle=fe(pe.em.middle).replace(/punctuation/g,pe._punctuation).replace(/overlapSkip/g,pe._overlapSkip).getRegex(),pe.em.endAst=fe(pe.em.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.em.endUnd=fe(pe.em.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.start=fe(pe.strong.start).replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.middle=fe(pe.strong.middle).replace(/punctuation/g,pe._punctuation).replace(/blockSkip/g,pe._blockSkip).getRegex(),pe.strong.endAst=fe(pe.strong.endAst,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.strong.endUnd=fe(pe.strong.endUnd,"g").replace(/punctuation/g,pe._punctuation).getRegex(),pe.blockSkip=fe(pe._blockSkip,"g").getRegex(),pe.overlapSkip=fe(pe._overlapSkip,"g").getRegex(),pe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,pe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,pe._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])?)+(?![-_])/,pe.autolink=fe(pe.autolink).replace("scheme",pe._scheme).replace("email",pe._email).getRegex(),pe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,pe.tag=fe(pe.tag).replace("comment",oe._comment).replace("attribute",pe._attribute).getRegex(),pe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,pe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,pe.link=fe(pe.link).replace("label",pe._label).replace("href",pe._href).replace("title",pe._title).getRegex(),pe.reflink=fe(pe.reflink).replace("label",pe._label).getRegex(),pe.reflinkSearch=fe(pe.reflinkSearch,"g").replace("reflink",pe.reflink).replace("nolink",pe.nolink).getRegex(),pe.normal=me({},pe),pe.pedantic=me({},pe.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:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",pe._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pe._label).getRegex()}),pe.gfm=me({},pe.normal,{escape:fe(pe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),pe.gfm.url=fe(pe.gfm.url,"i").replace("email",pe.gfm._extended_email).getRegex(),pe.breaks=me({},pe.gfm,{br:fe(pe.br).replace("{2,}","*").getRegex(),text:fe(pe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:oe,inline:pe},ie=B.defaults,Z=$.block,xe=$.inline;function Le(he){return he.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 be(he){var le="",de,J,Q=he.length;for(de=0;de<Q;de++)J=he.charCodeAt(de),Math.random()>.5&&(J="x"+J.toString(16)),le+="&#"+J+";";return le}var Ce=function(){function he(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ie,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var J={block:Z.normal,inline:xe.normal};this.options.pedantic?(J.block=Z.pedantic,J.inline=xe.pedantic):this.options.gfm&&(J.block=Z.gfm,this.options.breaks?J.inline=xe.breaks:J.inline=xe.gfm),this.tokenizer.rules=J}he.lex=function(J,Q){var ee=new he(Q);return ee.lex(J)};var le=he.prototype;return le.lex=function(J){return J=J.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(J,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(J,Q,ee){Q===void 0&&(Q=[]),ee===void 0&&(ee=!0),J=J.replace(/^ +$/gm,"");for(var se,ce,Ae,we;J;){if(se=this.tokenizer.space(J)){J=J.substring(se.raw.length),se.type&&Q.push(se);continue}if(se=this.tokenizer.code(J,Q)){J=J.substring(se.raw.length),se.type?Q.push(se):(we=Q[Q.length-1],we.raw+=`
|
|
`+se.raw,we.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.heading(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.nptable(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.hr(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.blockquote(J)){J=J.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ee),Q.push(se);continue}if(se=this.tokenizer.list(J)){for(J=J.substring(se.raw.length),Ae=se.items.length,ce=0;ce<Ae;ce++)se.items[ce].tokens=this.blockTokens(se.items[ce].text,[],!1);Q.push(se);continue}if(se=this.tokenizer.html(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(ee&&(se=this.tokenizer.def(J))){J=J.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.lheading(J)){J=J.substring(se.raw.length),Q.push(se);continue}if(ee&&(se=this.tokenizer.paragraph(J))){J=J.substring(se.raw.length),Q.push(se);continue}if(se=this.tokenizer.text(J,Q)){J=J.substring(se.raw.length),se.type?Q.push(se):(we=Q[Q.length-1],we.raw+=`
|
|
`+se.raw,we.text+=`
|
|
`+se.text);continue}if(J){var Me="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Me);break}else throw new Error(Me)}}return Q},le.inline=function(J){var Q,ee,se,ce,Ae,we,Me=J.length;for(Q=0;Q<Me;Q++){we=J[Q];switch(we.type){case"paragraph":case"text":case"heading":{we.tokens=[],this.inlineTokens(we.text,we.tokens);break}case"table":{for(we.tokens={header:[],cells:[]},ce=we.header.length,ee=0;ee<ce;ee++)we.tokens.header[ee]=[],this.inlineTokens(we.header[ee],we.tokens.header[ee]);for(ce=we.cells.length,ee=0;ee<ce;ee++)for(Ae=we.cells[ee],we.tokens.cells[ee]=[],se=0;se<Ae.length;se++)we.tokens.cells[ee][se]=[],this.inlineTokens(Ae[se],we.tokens.cells[ee][se]);break}case"blockquote":{this.inline(we.tokens);break}case"list":{for(ce=we.items.length,ee=0;ee<ce;ee++)this.inline(we.items[ee].tokens);break}}}return J},le.inlineTokens=function(J,Q,ee,se,ce){Q===void 0&&(Q=[]),ee===void 0&&(ee=!1),se===void 0&&(se=!1),ce===void 0&&(ce="");var Ae,we=J,Me;if(this.tokens.links){var $e=Object.keys(this.tokens.links);if($e.length>0)for(;(Me=this.tokenizer.rules.inline.reflinkSearch.exec(we))!=null;)$e.includes(Me[0].slice(Me[0].lastIndexOf("[")+1,-1))&&(we=we.slice(0,Me.index)+"["+"a".repeat(Me[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Me=this.tokenizer.rules.inline.blockSkip.exec(we))!=null;)we=we.slice(0,Me.index)+"["+"a".repeat(Me[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;J;){if(Ae=this.tokenizer.escape(J)){J=J.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.tag(J,ee,se)){J=J.substring(Ae.raw.length),ee=Ae.inLink,se=Ae.inRawBlock,Q.push(Ae);continue}if(Ae=this.tokenizer.link(J)){J=J.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),Q.push(Ae);continue}if(Ae=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,se)),Q.push(Ae);continue}if(Ae=this.tokenizer.strong(J,we,ce)){J=J.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,se),Q.push(Ae);continue}if(Ae=this.tokenizer.em(J,we,ce)){J=J.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,se),Q.push(Ae);continue}if(Ae=this.tokenizer.codespan(J)){J=J.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.br(J)){J=J.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.del(J)){J=J.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,se),Q.push(Ae);continue}if(Ae=this.tokenizer.autolink(J,be)){J=J.substring(Ae.raw.length),Q.push(Ae);continue}if(!ee&&(Ae=this.tokenizer.url(J,be))){J=J.substring(Ae.raw.length),Q.push(Ae);continue}if(Ae=this.tokenizer.inlineText(J,se,Le)){J=J.substring(Ae.raw.length),ce=Ae.raw.slice(-1),Q.push(Ae);continue}if(J){var ze="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return Q},V(he,null,[{key:"rules",get:function(){return{block:Z,inline:xe}}}]),he}(),_e=B.defaults,ke=W.cleanUrl,Ue=W.escape,Pe=function(){function he(de){this.options=de||_e}var le=he.prototype;return le.code=function(J,Q,ee){var se=(Q||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(J,se);ce!=null&&ce!==J&&(ee=!0,J=ce)}return se?'<pre><code class="'+this.options.langPrefix+Ue(se,!0)+'">'+(ee?J:Ue(J,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ee?J:Ue(J,!0))+`</code></pre>
|
|
`},le.blockquote=function(J){return`<blockquote>
|
|
`+J+`</blockquote>
|
|
`},le.html=function(J){return J},le.heading=function(J,Q,ee,se){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+se.slug(ee)+'">'+J+"</h"+Q+`>
|
|
`:"<h"+Q+">"+J+"</h"+Q+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function(J,Q,ee){var se=Q?"ol":"ul",ce=Q&&ee!==1?' start="'+ee+'"':"";return"<"+se+ce+`>
|
|
`+J+"</"+se+`>
|
|
`},le.listitem=function(J){return"<li>"+J+`</li>
|
|
`},le.checkbox=function(J){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(J){return"<p>"+J+`</p>
|
|
`},le.table=function(J,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+J+`</thead>
|
|
`+Q+`</table>
|
|
`},le.tablerow=function(J){return`<tr>
|
|
`+J+`</tr>
|
|
`},le.tablecell=function(J,Q){var ee=Q.header?"th":"td",se=Q.align?"<"+ee+' align="'+Q.align+'">':"<"+ee+">";return se+J+"</"+ee+`>
|
|
`},le.strong=function(J){return"<strong>"+J+"</strong>"},le.em=function(J){return"<em>"+J+"</em>"},le.codespan=function(J){return"<code>"+J+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(J){return"<del>"+J+"</del>"},le.link=function(J,Q,ee){if(J=ke(this.options.sanitize,this.options.baseUrl,J),J===null)return ee;var se='<a href="'+Ue(J)+'"';return Q&&(se+=' title="'+Q+'"'),se+=">"+ee+"</a>",se},le.image=function(J,Q,ee){if(J=ke(this.options.sanitize,this.options.baseUrl,J),J===null)return ee;var se='<img src="'+J+'" alt="'+ee+'"';return Q&&(se+=' title="'+Q+'"'),se+=this.options.xhtml?"/>":">",se},le.text=function(J){return J},he}(),Oe=function(){function he(){}var le=he.prototype;return le.strong=function(J){return J},le.em=function(J){return J},le.codespan=function(J){return J},le.del=function(J){return J},le.html=function(J){return J},le.text=function(J){return J},le.link=function(J,Q,ee){return""+ee},le.image=function(J,Q,ee){return""+ee},le.br=function(){return""},he}(),Je=function(){function he(){this.seen={}}var le=he.prototype;return le.slug=function(J){var Q=J.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var ee=Q;do this.seen[ee]++,Q=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},he}(),Qe=B.defaults,We=W.unescape,Ge=function(){function he(de){this.options=de||Qe,this.options.renderer=this.options.renderer||new Pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new Je}he.parse=function(J,Q){var ee=new he(Q);return ee.parse(J)};var le=he.prototype;return le.parse=function(J,Q){Q===void 0&&(Q=!0);var ee="",se,ce,Ae,we,Me,$e,ze,mt,dt,ot,Ct,bt,Bt,Ft,Et,Cr,Rr,lr,pr=J.length;for(se=0;se<pr;se++){ot=J[se];switch(ot.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,We(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(mt="",ze="",we=ot.header.length,ce=0;ce<we;ce++)ze+=this.renderer.tablecell(this.parseInline(ot.tokens.header[ce]),{header:!0,align:ot.align[ce]});for(mt+=this.renderer.tablerow(ze),dt="",we=ot.cells.length,ce=0;ce<we;ce++){for($e=ot.tokens.cells[ce],ze="",Me=$e.length,Ae=0;Ae<Me;Ae++)ze+=this.renderer.tablecell(this.parseInline($e[Ae]),{header:!1,align:ot.align[Ae]});dt+=this.renderer.tablerow(ze)}ee+=this.renderer.table(mt,dt);continue}case"blockquote":{dt=this.parse(ot.tokens),ee+=this.renderer.blockquote(dt);continue}case"list":{for(Ct=ot.ordered,bt=ot.start,Bt=ot.loose,we=ot.items.length,dt="",ce=0;ce<we;ce++)Et=ot.items[ce],Cr=Et.checked,Rr=Et.task,Ft="",Et.task&&(lr=this.renderer.checkbox(Cr),Bt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=lr+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=lr+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:lr}):Ft+=lr),Ft+=this.parse(Et.tokens,Bt),dt+=this.renderer.listitem(Ft,Rr,Cr);ee+=this.renderer.list(dt,Ct,bt);continue}case"html":{ee+=this.renderer.html(ot.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(dt=ot.tokens?this.parseInline(ot.tokens):ot.text;se+1<pr&&J[se+1].type==="text";)ot=J[++se],dt+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);ee+=Q?this.renderer.paragraph(dt):dt;continue}default:{var fr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return ee},le.parseInline=function(J,Q){Q=Q||this.renderer;var ee="",se,ce,Ae=J.length;for(se=0;se<Ae;se++){ce=J[se];switch(ce.type){case"escape":{ee+=Q.text(ce.text);break}case"html":{ee+=Q.html(ce.text);break}case"link":{ee+=Q.link(ce.href,ce.title,this.parseInline(ce.tokens,Q));break}case"image":{ee+=Q.image(ce.href,ce.title,ce.text);break}case"strong":{ee+=Q.strong(this.parseInline(ce.tokens,Q));break}case"em":{ee+=Q.em(this.parseInline(ce.tokens,Q));break}case"codespan":{ee+=Q.codespan(ce.text);break}case"br":{ee+=Q.br();break}case"del":{ee+=Q.del(this.parseInline(ce.tokens,Q));break}case"text":{ee+=Q.text(ce.text);break}default:{var we='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(we);return}else throw new Error(we)}}}return ee},he}(),Ze=W.merge,He=W.checkSanitizeDeprecation,Ke=W.escape,Se=B.getDefaults,et=B.changeDefaults,Ye=B.defaults;function De(he,le,de){if(typeof he=="undefined"||he===null)throw new Error("marked(): input parameter is undefined or null");if(typeof he!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(he)+", string expected");if(typeof le=="function"&&(de=le,le=null),le=Ze({},De.defaults,le||{}),He(le),de){var J=le.highlight,Q;try{Q=Ce.lex(he,le)}catch(Ae){return de(Ae)}var ee=function(we){var Me;if(!we)try{Me=Ge.parse(Q,le)}catch($e){we=$e}return le.highlight=J,we?de(we):de(null,Me)};if(!J||J.length<3)return ee();if(delete le.highlight,!Q.length)return ee();var se=0;De.walkTokens(Q,function(Ae){Ae.type==="code"&&(se++,setTimeout(function(){J(Ae.text,Ae.lang,function(we,Me){if(we)return ee(we);Me!=null&&Me!==Ae.text&&(Ae.text=Me,Ae.escaped=!0),se--,se===0&&ee()})},0))}),se===0&&ee();return}try{var ce=Ce.lex(he,le);return le.walkTokens&&De.walkTokens(ce,le.walkTokens),Ge.parse(ce,le)}catch(Ae){if(Ae.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+Ke(Ae.message+"",!0)+"</pre>";throw Ae}}De.options=De.setOptions=function(he){return Ze(De.defaults,he),et(De.defaults),De},De.getDefaults=Se,De.defaults=Ye,De.use=function(he){var le=Ze({},he);if(he.renderer&&function(){var J=De.defaults.renderer||new Pe,Q=function(ce){var Ae=J[ce];J[ce]=function(){for(var we=arguments.length,Me=new Array(we),$e=0;$e<we;$e++)Me[$e]=arguments[$e];var ze=he.renderer[ce].apply(J,Me);return ze===!1&&(ze=Ae.apply(J,Me)),ze}};for(var ee in he.renderer)Q(ee);le.renderer=J}(),he.tokenizer&&function(){var J=De.defaults.tokenizer||new ve,Q=function(ce){var Ae=J[ce];J[ce]=function(){for(var we=arguments.length,Me=new Array(we),$e=0;$e<we;$e++)Me[$e]=arguments[$e];var ze=he.tokenizer[ce].apply(J,Me);return ze===!1&&(ze=Ae.apply(J,Me)),ze}};for(var ee in he.tokenizer)Q(ee);le.tokenizer=J}(),he.walkTokens){var de=De.defaults.walkTokens;le.walkTokens=function(J){he.walkTokens(J),de&&de(J)}}De.setOptions(le)},De.walkTokens=function(he,le){for(var de=I(he),J;!(J=de()).done;){var Q=J.value;le(Q);switch(Q.type){case"table":{for(var ee=I(Q.tokens.header),se;!(se=ee()).done;){var ce=se.value;De.walkTokens(ce,le)}for(var Ae=I(Q.tokens.cells),we;!(we=Ae()).done;)for(var Me=we.value,$e=I(Me),ze;!(ze=$e()).done;){var mt=ze.value;De.walkTokens(mt,le)}break}case"list":{De.walkTokens(Q.items,le);break}default:Q.tokens&&De.walkTokens(Q.tokens,le)}}},De.Parser=Ge,De.parser=Ge.parse,De.Renderer=Pe,De.TextRenderer=Oe,De.Lexer=Ce,De.lexer=Ce.lex,De.Tokenizer=ve,De.Slugger=Je,De.parse=De;var Fe=De;return Fe})},ELLl:function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(w,v,d){d&&d!=re.Init&&(w.removeKeyMap(I),w.state.closeBrackets=null),v&&(R(G(v,"pairs")),w.state.closeBrackets=v,w.addKeyMap(I))});function G(w,v){return v=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[v]!=null?w[v]:V[v]}var I={Backspace:M,Enter:D};function R(w){for(var v=0;v<w.length;v++){var d=w.charAt(v),o="'"+d+"'";I[o]||(I[o]=B(d))}}R(V.pairs+"`");function B(w){return function(v){return S(v,w)}}function F(w){var v=w.state.closeBrackets;if(!v||v.override)return v;var d=w.getModeAt(w.getCursor());return d.closeBrackets||v}function M(w){var v=F(w);if(!v||w.getOption("disableInput"))return re.Pass;for(var d=G(v,"pairs"),o=w.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(w,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}for(var u=o.length-1;u>=0;u--){var x=o[u].head;w.replaceRange("",L(x.line,x.ch-1),L(x.line,x.ch+1),"+delete")}}function D(w){var v=F(w),d=v&&G(v,"explode");if(!d||w.getOption("disableInput"))return re.Pass;for(var o=w.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(w,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}w.operation(function(){var x=w.lineSeparator()||`
|
|
`;w.replaceSelection(x+x,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;w.indentLine(f,null,!0),w.indentLine(f+1,null,!0)}})}function y(w){var v=re.cmpPos(w.anchor,w.head)>0;return{anchor:new L(w.anchor.line,w.anchor.ch+(v?-1:1)),head:new L(w.head.line,w.head.ch+(v?1:-1))}}function S(w,v){var d=F(w);if(!d||w.getOption("disableInput"))return re.Pass;var o=G(d,"pairs"),u=o.indexOf(v);if(u==-1)return re.Pass;for(var s=G(d,"closeBefore"),x=G(d,"triples"),p=o.charAt(u+1)==v,f=w.listSelections(),A=u%2==0,b,h=0;h<f.length;h++){var c=f[h],l=c.head,a,g=w.getRange(l,L(l.line,l.ch+1));if(A&&!c.empty())a="surround";else if((p||!A)&&g==v)p&&C(w,l)?a="both":x.indexOf(v)>=0&&w.getRange(l,L(l.line,l.ch+3))==v+v+v?a="skipThree":a="skip";else if(p&&l.ch>1&&x.indexOf(v)>=0&&w.getRange(L(l.line,l.ch-2),l)==v+v){if(l.ch>2&&/\bstring/.test(w.getTokenTypeAt(L(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(p){var m=l.ch==0?" ":w.getRange(L(l.line,l.ch-1),l);if(!re.isWordChar(g)&&m!=v&&!re.isWordChar(m))a="both";else return re.Pass}else if(A&&(g.length===0||/\s/.test(g)||s.indexOf(g)>-1))a="both";else return re.Pass;if(!b)b=a;else if(b!=a)return re.Pass}var E=u%2?o.charAt(u-1):v,P=u%2?v:o.charAt(u+1);w.operation(function(){if(b=="skip")w.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(b=="surround"){for(var j=w.getSelections(),U=0;U<j.length;U++)j[U]=E+j[U]+P;w.replaceSelections(j,"around"),j=w.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=y(j[U]);w.setSelections(j)}else b=="both"?(w.replaceSelection(E+P,null),w.triggerElectric(E+P),w.execCommand("goCharLeft")):b=="addFour"&&(w.replaceSelection(E+E+E+E,"before"),w.execCommand("goCharRight"))})}function O(w,v){var d=w.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return d.length==2?d:null}function C(w,v){var d=w.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(w.getTokenTypeAt(v)))}})},GfqC:function(ut,qe,te){"use strict";var re=te("cDcd"),V=te.n(re),L=te("TSYQ"),G=te.n(L);function I(W,_){var k="cannot "+W.method+" "+W.action+" "+_.status+"'",K=new Error(k);return K.status=_.status,K.method=W.method,K.url=W.action,K}function R(W){var _=W.responseText||W.response;if(!_)return _;try{return JSON.parse(_)}catch(k){return _}}function B(W){var _=new XMLHttpRequest;W.onProgress&&_.upload&&(_.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var k=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var q=W.data[Y];if(Array.isArray(q)){q.forEach(function(ae){k.append(Y+"[]",ae)});return}k.append(Y,W.data[Y])}),W.file instanceof Blob?k.append(W.filename,W.file,W.file.name):k.append(W.filename,W.file),_.onerror=function(q){W.onError(q)},_.onload=function(){return _.status<200||_.status>=300?W.onError(I(W,_),R(_)):W.onSuccess(R(_),_)},_.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in _&&(_.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&_.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(Y){K[Y]!==null&&_.setRequestHeader(Y,K[Y])}),_.send(k),{abort:function(){_.abort()}}}var F=+new Date,M=0;function D(){return"rc-upload-"+F+"-"+ ++M}function y(W,_){return W.indexOf(_,W.length-_.length)!==-1}var S=function(W,_){if(W&&_){var k=Array.isArray(_)?_:_.split(","),K=W.name||"",Y=W.type||"",q=Y.replace(/\/.*$/,"");return k.some(function(ae){var Ee=ae.trim();return Ee.charAt(0)==="."?y(K.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?q===Ee.replace(/\/.*$/,""):Y===Ee})}return!0};function O(W,_){var k=W.createReader(),K=[];function Y(){k.readEntries(function(q){var ae=Array.prototype.slice.apply(q);K=K.concat(ae);var Ee=!ae.length;Ee?_(K):Y()})}Y()}var C=function(_,k,K){var Y=function q(ae,Ee){Ee=Ee||"",ae.isFile?ae.file(function(ve){K(ve)&&(ae.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=ae.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),k([ve]))}):ae.isDirectory&&O(ae,function(ve){ve.forEach(function(ge){q(ge,""+Ee+ae.name+"/")})})};_.forEach(function(q){Y(q.webkitGetAsEntry())})},w=C,v=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var k=arguments[_];for(var K in k)Object.prototype.hasOwnProperty.call(k,K)&&(W[K]=k[K])}return W},d=function(){function W(_,k){var K=[],Y=!0,q=!1,ae=void 0;try{for(var Ee=_[Symbol.iterator](),ve;!(Y=(ve=Ee.next()).done)&&!(K.push(ve.value),k&&K.length===k);Y=!0);}catch(ge){q=!0,ae=ge}finally{try{!Y&&Ee.return&&Ee.return()}finally{if(q)throw ae}}return K}return function(_,k){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return W(_,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(_,k){for(var K=0;K<k.length;K++){var Y=k[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,k,K){return k&&W(_.prototype,k),K&&W(_,K),_}}();function u(W,_,k){return _ in W?Object.defineProperty(W,_,{value:k,enumerable:!0,configurable:!0,writable:!0}):W[_]=k,W}function s(W,_){var k={};for(var K in W){if(_.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;k[K]=W[K]}return k}function x(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function p(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function f(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}var A=function(_){return Object.keys(_).reduce(function(k,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(k[K]=_[K]),k},{})},b=function(W){f(_,W);function _(){var k,K,Y,q;x(this,_);for(var ae=arguments.length,Ee=Array(ae),ve=0;ve<ae;ve++)Ee[ve]=arguments[ve];return q=(K=(Y=p(this,(k=_.__proto__||Object.getPrototypeOf(_)).call.apply(k,[this].concat(Ee))),Y),Y.state={uid:D()},Y.reqs={},Y.onChange=function(ge){var fe=ge.target.files;Y.uploadFiles(fe),Y.reset()},Y.onClick=function(ge){var fe=Y.fileInput;if(!fe)return;var me=Y.props,oe=me.children,pe=me.onClick;oe&&oe.type==="button"&&(fe.parentNode.focus(),fe.parentNode.querySelector("button").blur()),fe.click(),pe&&pe(ge)},Y.onKeyDown=function(ge){ge.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(ge){var fe=Y.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(Y.props.directory)w(Array.prototype.slice.call(ge.dataTransfer.items),Y.uploadFiles,function(oe){return S(oe,Y.props.accept)});else{var me=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(oe){return S(oe,Y.props.accept)});fe===!1&&(me=me.slice(0,1)),Y.uploadFiles(me)}},Y.uploadFiles=function(ge){var fe=Array.prototype.slice.call(ge);fe.map(function(me){return me.uid=D(),me}).forEach(function(me){Y.upload(me,fe)})},Y.saveFileInput=function(ge){Y.fileInput=ge},K),p(Y,q)}return o(_,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,Y){var q=this,ae=this.props;if(!ae.beforeUpload)return setTimeout(function(){return q.post(K)},0);var Ee=ae.beforeUpload(K,Y);Ee&&Ee.then?Ee.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?q.post(ve):q.post(K)}).catch(function(ve){console.log(ve)}):Ee!==!1&&setTimeout(function(){return q.post(K)},0);return}},{key:"post",value:function(K){var Y=this;if(!this._isMounted)return;var q=this.props,ae=q.onStart,Ee=q.onProgress,ve=q.transformFile,ge=ve===void 0?function(fe){return fe}:ve;new Promise(function(fe){var me=q.action;return typeof me=="function"&&(me=me(K)),fe(me)}).then(function(fe){var me=K.uid,oe=q.customRequest||B,pe=Promise.resolve(ge(K)).then(function($){var ie=q.data;return typeof ie=="function"&&(ie=ie($)),Promise.all([$,ie])}).catch(function($){console.error($)});pe.then(function($){var ie=d($,2),Z=ie[0],xe=ie[1],Le={action:fe,filename:q.name,data:xe,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Ee?function(be){Ee(be,K)}:null,onSuccess:function(Ce,_e){delete Y.reqs[me],q.onSuccess(Ce,K,_e)},onError:function(Ce,_e){delete Y.reqs[me],q.onError(Ce,_e,K)}};ae(K),Y.reqs[me]=oe(Le)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(K){var Y=this.reqs;if(K){var q=K;K&&K.uid&&(q=K.uid),Y[q]&&Y[q].abort&&Y[q].abort(),delete Y[q]}else Object.keys(Y).forEach(function(ae){Y[ae]&&Y[ae].abort&&Y[ae].abort(),delete Y[ae]})}},{key:"render",value:function(){var K,Y=this.props,q=Y.component,ae=Y.prefixCls,Ee=Y.className,ve=Y.disabled,ge=Y.id,fe=Y.style,me=Y.multiple,oe=Y.accept,pe=Y.children,$=Y.directory,ie=Y.openFileDialogOnClick,Z=Y.onMouseEnter,xe=Y.onMouseLeave,Le=s(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=G()((K={},u(K,ae,!0),u(K,ae+"-disabled",ve),u(K,Ee,Ee),K)),Ce=ve?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:xe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(q,v({},Ce,{className:be,role:"button",style:fe}),V.a.createElement("input",v({},A(Le),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:oe,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:me,onChange:this.onChange})),pe)}}]),_}(re.Component),h=b,c=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var k=arguments[_];for(var K in k)Object.prototype.hasOwnProperty.call(k,K)&&(W[K]=k[K])}return W},l=function(){function W(_,k){for(var K=0;K<k.length;K++){var Y=k[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,k,K){return k&&W(_.prototype,k),K&&W(_,K),_}}();function a(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function g(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function m(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}function E(){}var P=function(W){m(_,W);function _(){var k,K,Y,q;a(this,_);for(var ae=arguments.length,Ee=Array(ae),ve=0;ve<ae;ve++)Ee[ve]=arguments[ve];return q=(K=(Y=g(this,(k=_.__proto__||Object.getPrototypeOf(_)).call.apply(k,[this].concat(Ee))),Y),Y.saveUploader=function(ge){Y.uploader=ge},K),g(Y,q)}return l(_,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),_}(re.Component);P.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=P,j=qe.a=U},HmJG:function(ut,qe,te){},LdHM:function(ut,qe,te){"use strict";te.d(qe,"b",function(){return s}),te.d(qe,"a",function(){return p});var re=te("1OyB"),V=te("vuIU"),L=te("Ji7U"),G=te("LK+K"),I=te("cDcd"),R=te("rePB"),B=te("Ff2n"),F=te("ODXe"),M=te("4IlW"),D=te("bX4T"),y=te("YrtM"),S=te("TSYQ"),O=te.n(S),C=te("+nKL"),w=te("8OUc"),v=function(K,Y){var q=K.prefixCls,ae=K.id,Ee=K.flattenOptions,ve=K.childrenAsData,ge=K.values,fe=K.searchValue,me=K.multiple,oe=K.defaultActiveFirstOption,pe=K.height,$=K.itemHeight,ie=K.notFoundContent,Z=K.open,xe=K.menuItemSelectedIcon,Le=K.virtual,be=K.onSelect,Ce=K.onToggleOpen,_e=K.onActiveValue,ke=K.onScroll,Ue=K.onMouseEnter,Pe="".concat(q,"-item"),Oe=Object(y.a)(function(){return Ee},[Z,Ee],function(Fe,he){return he[0]&&Fe[1]!==he[1]}),Je=I.useRef(null),Qe=function(he){he.preventDefault()},We=function(he){Je.current&&Je.current.scrollTo({index:he})},Ge=function(he){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Oe.length,J=0;J<de;J+=1){var Q=(he+J*le+de)%de,ee=Oe[Q],se=ee.group,ce=ee.data;if(!se&&!ce.disabled)return Q}return-1},Ze=I.useState(function(){return Ge(0)}),He=Object(F.a)(Ze,2),Ke=He[0],Se=He[1],et=function(he){Se(he);var le=Oe[he];if(!le){_e(null,-1);return}_e(le.data.value,he)};I.useEffect(function(){et(oe!==!1?Ge(0):-1)},[Oe.length,fe]),I.useEffect(function(){var Fe=setTimeout(function(){if(!me&&Z&&ge.size===1){var he=Array.from(ge)[0],le=Oe.findIndex(function(de){var J=de.data;return J.value===he});et(le),We(le)}});return function(){return clearTimeout(Fe)}},[Z]);var Ye=function(he){he!==void 0&&be(he,{selected:!ge.has(he)}),me||Ce(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(he){var le=he.which;switch(le){case M.a.UP:case M.a.DOWN:{var de=0;if(le===M.a.UP?de=-1:le===M.a.DOWN&&(de=1),de!==0){var J=Ge(Ke+de,de);We(J),et(J)}break}case M.a.ENTER:{var Q=Oe[Ke];Q&&!Q.data.disabled?Ye(Q.data.value):Ye(void 0),Z&&he.preventDefault();break}case M.a.ESC:Ce(!1)}},onKeyUp:function(){},scrollTo:function(he){We(he)}}}),Oe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Pe,"-empty"),onMouseDown:Qe},ie);function De(Fe){var he=Oe[Fe];if(!he)return null;var le=he.data||{},de=le.value,J=le.label,Q=le.children,ee=Object(D.a)(le,!0),se=ve?Q:J;return he?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},ee,{key:Fe,role:"option",id:"".concat(ae,"_list_").concat(Fe),"aria-selected":ge.has(de)}),de):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(Ke-1),De(Ke),De(Ke+1)),I.createElement(C.a,{itemKey:"key",ref:Je,data:Oe,height:pe,itemHeight:$,fullHeight:!1,onMouseDown:Qe,onScroll:ke,virtual:Le,onMouseEnter:Ue},function(Fe,he){var le,de=Fe.group,J=Fe.groupOption,Q=Fe.data,ee=Q.label,se=Q.key;if(de)return I.createElement("div",{className:O()(Pe,"".concat(Pe,"-group"))},ee!==void 0?ee:se);var ce=Q.disabled,Ae=Q.value,we=Q.title,Me=Q.children,$e=Q.style,ze=Q.className,mt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),dt=ge.has(Ae),ot="".concat(Pe,"-option"),Ct=O()(Pe,ot,ze,(le={},Object(R.a)(le,"".concat(ot,"-grouped"),J),Object(R.a)(le,"".concat(ot,"-active"),Ke===he&&!ce),Object(R.a)(le,"".concat(ot,"-disabled"),ce),Object(R.a)(le,"".concat(ot,"-selected"),dt),le)),bt=ve?Me:ee,Bt=!xe||typeof xe=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:Ct,title:we,onMouseMove:function(){if(Ke===he||ce)return;et(he)},onClick:function(){ce||Ye(Ae)},style:$e}),I.createElement("div",{className:"".concat(ot,"-content")},bt||Ae),I.isValidElement(xe)||dt,Bt&&I.createElement(w.a,{className:"".concat(Pe,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},d=I.forwardRef(v);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var s=u,x=function(){return null};x.isSelectOptGroup=!0;var p=x,f=te("VTBJ"),A=te("Zm9Q");function b(k){var K=k.key,Y=k.props,q=Y.children,ae=Y.value,Ee=Object(B.a)(Y,["children","value"]);return Object(f.a)({key:K,value:ae!==void 0?ae:K,children:q},Ee)}function h(k){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(k).map(function(Y,q){if(!I.isValidElement(Y)||!Y.type)return null;var ae=Y.type.isSelectOptGroup,Ee=Y.key,ve=Y.props,ge=ve.children,fe=Object(B.a)(ve,["children"]);return K||!ae?b(Y):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?q:Ee,"__"),label:Ee},fe),{},{options:h(ge)})}).filter(function(Y){return Y})}var c=te("2Qr1"),l=te("qNPg"),a=te("U8pU"),g=te("Kwbf"),m=te("WKfj");function E(k){var K=k.mode,Y=k.options,q=k.children,ae=k.backfill,Ee=k.allowClear,ve=k.placeholder,ge=k.getInputElement,fe=k.showSearch,me=k.onSearch,oe=k.defaultOpen,pe=k.autoFocus,$=k.labelInValue,ie=k.value,Z=k.inputValue,xe=k.optionLabelProp,Le=K==="multiple"||K==="tags",be=fe!==void 0?fe:Le||K==="combobox",Ce=Y||h(q);if(Object(g.a)(K!=="tags"||Ce.every(function(Pe){return!Pe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var _e=Ce.some(function(Pe){return Pe.options?Pe.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in Pe?Pe.value:Pe.key)=="number"});Object(g.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(K!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(K==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(g.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(g.b)(K!=="combobox"||!ge||!Ee||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!be&&K!=="combobox"&&K!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!oe||pe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var ke=Object(m.d)(ie);Object(g.a)(!$||ke.every(function(Pe){return Object(a.a)(Pe)==="object"&&("key"in Pe||"value"in Pe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Le||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var Ue=null;Object(A.a)(q).some(function(Pe){if(!I.isValidElement(Pe)||!Pe.type)return!1;var Oe=Pe.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var Je=Object(A.a)(Pe.props.children).every(function(Qe){return!I.isValidElement(Qe)||!Pe.type||Qe.type.isSelectOption?!0:(Ue=Qe.type,!1)});return!Je}return Ue=Oe,!0}),Ue&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ue.displayName||Ue.name||Ue,"`.")),Object(g.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=E,U=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:P,fillOptionsWithMissingValue:c.a}),j=function(k){Object(L.a)(Y,k);var K=Object(G.a)(Y);function Y(){var q;return Object(re.a)(this,Y),q=K.apply(this,arguments),q.selectRef=I.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(V.a)(Y,[{key:"render",value:function(){return I.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=p;var W=j,_=qe.c=W},M8RZ:function(ut,qe,te){"use strict";te.d(qe,"a",function(){return M});var re=te("fWQN"),V=te("mtLc"),L=te("yKVA"),G=te("879j"),I=te("cDcd"),R=te.n(I),B=te("faye"),F=te.n(B),M=function(D){Object(L.a)(S,D);var y=Object(G.a)(S);function S(O){var C;Object(re.a)(this,S),C=y.call(this,O);var w=window.document;return C.node=w.createElement("div"),w.body.appendChild(C.node),C}return Object(V.a)(S,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(R.a.Component)},Ot1p:function(ut,qe,te){"use strict";var re=te("2qtc"),V=te("kLXV"),L=te("rAM+"),G=te("miYZ"),I=te("tsqr"),R=te("9og8"),B=te("tJVT"),F=te("jrin"),M=te("WmNS"),D=te.n(M),y=te("cDcd"),S=te.n(y),O=te("VrN/"),C=te.n(O),w=te("bdgK"),v=te("p77/"),d=te("Bd2K"),o=te("ELLl"),u=te("19Vz"),s=te("lZu9"),x=te("+NIl"),p=te("kSUc"),f=te("9Bee"),A=function(ce){var Ae=ce.value,we=Ae===void 0?"":Ae,Me=ce.className,$e=ce.showTextOnly,ze=ce.showLines,mt=ce.style,dt=mt===void 0?{}:mt,ot=Object(y.useMemo)(function(){return""},[we]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},b=te("0Owb"),h=te("dejd"),c=te("C+DQ"),l=te("1vsH"),a=te("m3rI"),g=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ce){var Ae=ce.onActionCallback,we=ce.title,Me=ce.icon,$e=ce.actionName,ze=ce.className,mt=ze===void 0?"":ze,dt=ce.children;function ot(){Ae($e)}return S.a.createElement("a",{title:we,className:mt,onClick:ot},S.a.createElement("i",{className:"md-iconfont ".concat(Me)}),dt)}var E=function(ce){var Ae=ce.watch,we=ce.showNullButton,Me=ce.onActionCallback,$e=ce.fullScreen,ze=ce.insertTemp,mt=ce.hidetoolBar,dt=ce.uuid,ot=ce.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(g,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ct.map(function(bt,Bt){return S.a.createElement("li",{key:Bt},bt.actionName?S.a.createElement(m,Object(b.a)({},bt,{onActionCallback:Me})):S.a.createElement("span",{className:"v-line"}))}),we?S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Me},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ze&&S.a.createElement("li",null,S.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ze),onActionCallback:Me},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(m,{icon:"".concat($e?"icon-shrink":"icon-enlarge"),title:$e?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Me})))},P=te("M8RZ"),U=te("+L6B"),j=te("2/Rp"),W=te("y8nQ"),_=te("Vl3Y"),k=te("5NDa"),K=te("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},q=function(ce){var Ae=ce.callback,we=ce.onCancel;function Me($e){Ae($e)}return S.a.createElement(_.a,Object(b.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Me}),S.a.createElement(_.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(K.a,null)),S.a.createElement(_.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(K.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:we},"\u53D6\u6D88")))},ae=te("7ahc"),Ee=te("HmJG"),ve=te("BjJ7"),ge=_.a.useForm,fe={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},oe=function(ce){var Ae=ce.callback,we=ce.onCancel,Me=ge(),$e=Object(B.a)(Me,1),ze=$e[0];function mt(Ct){Ae(Ct)}function dt(Ct,bt){if(Ct.status===-1){I.b.error(Ct.message);return}ze.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:bt.type})}function ot(Ct){var bt=Ct.target.files[0];$(bt,dt)}return S.a.createElement(_.a,Object(b.a)({form:ze},me,{className:"upload-image-panel",onFinish:mt}),S.a.createElement(_.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(_.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(K.a,{style:fe})),S.a.createElement(pe,{onFileChange:ot}))),S.a.createElement(_.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(K.a,{style:{width:264}})),S.a.createElement(_.a.Item,{style:{textAlign:"right"}},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:we},"\u53D6\u6D88")))};function pe(ce){var Ae=ce.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:Ae}))}function $(ce,Ae){if(!ce)throw new String("\u6CA1\u6709\u6587\u4EF6");var we=new FormData;we.append("editormd-image-file",ce),we.append("file_param_name","editormd-image-file"),we.append("byxhr","true");var Me=new window.XMLHttpRequest;Me.withCredentials=!0,Me.addEventListener("load",function($e){Ae(JSON.parse($e.target.responseText),ce)},!1),Me.addEventListener("error",function($e){console.error($e)},!1),Me.open("POST","".concat(ve.a,"/api/attachments.json")),Me.send(we)}var ie=te("giR+"),Z=te("fyUT"),xe=te("7Kak"),Le=te("9yH6"),be=Le.a.Group,Ce={margin:"0 8px"},_e=function(ce){var Ae=ce.callback,we=ce.onCancel;function Me($e){Ae($e)}return S.a.createElement(_.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Me},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:Ce},"\u884C\u6570"),S.a.createElement(_.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(Z.a,null)),S.a.createElement("span",{style:Ce},"\u5217\u6570"),S.a.createElement(_.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(Z.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(_.a.Item,{name:"align"},S.a.createElement(be,null,S.a.createElement(Le.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(Le.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(Le.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(Le.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:we},"\u53D6\u6D88")))},ke=te("ErOA"),Ue=te("7Cbv"),Pe="link",Oe="upload-image",Je="code-block",Qe="add-table",We="------------",Ge={default:We,left:":".concat(We),center:":".concat(We,":"),right:"".concat(We,":")},Ze=te("9VGf"),He,Ke;function Se(){}var et=0,Ye=1e4,De="\u2581",Fe=`
|
|
**\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 he(ce){return/^\d+$/.test(ce)?"".concat(ce,"px"):ce}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=le?"Cmd":"Ctrl",J=["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"],Q=(He={},Object(F.a)(He,de+"-B","bold"),Object(F.a)(He,de+"-I","italic"),He),ee=(Ke={},Object(F.a)(Ke,Pe,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ke,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ke,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Ke,Qe,"\u6DFB\u52A0\u8868\u683C"),Ke),se=qe.a=function(ce){var Ae=ce.defaultValue,we=Ae===void 0?"":Ae,Me=ce.onChange,$e=ce.width,ze=$e===void 0?"100%":$e,mt=ce.height,dt=mt===void 0?400:mt,ot=ce.miniToolbar,Ct=ot===void 0?!1:ot,bt=ce.isFocus,Bt=bt===void 0?!1:bt,Ft=ce.watch,Et=ce.insertTemp,Cr=ce.mode,Rr=Cr===void 0?"markdown":Cr,lr=ce.id,pr=lr===void 0?"markdown-editor-id":lr,fr=ce.showResizeBar,ia=fr===void 0?!1:fr,Ar=ce.noStorage,Hn=Ar===void 0?!1:Ar,Kn=ce.showNullButton,Rt=Kn===void 0?!1:Kn,nt=ce.hidetoolBar,kr=nt===void 0?!1:nt,mn=ce.fullScreen,Zt=mn===void 0?!1:mn,Tt=ce.onBlur,gr=ce.onCMBeforeChange,Pr=ce.onFullScreen,pn=ce.className,Ne=pn===void 0?"":pn,ct=ce.disablePaste,Gn=ct===void 0?!1:ct,gn=ce.placeholder,vn=gn===void 0?"":gn,Qr=ce.values,yn=Qr===void 0?"":Qr,ht=Object(y.useState)(null),Ai=Object(B.a)(ht,2),Be=Ai[0],bn=Ai[1],hr=Object(y.useState)(we),zn=Object(B.a)(hr,2),Zr=zn[0],vr=zn[1],Vn=Object(y.useState)(Ft),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Li=Object(y.useState)(Zt),$n=Object(B.a)(Li,2),br=$n[0],Di=$n[1],aa=Object(y.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(y.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Qn=qr[1],sa=Object(y.useState)(dt),_i=Object(B.a)(sa,2),Oi=_i[0],En=_i[1],Ri=Object(y.useState)(!1),ki=Object(B.a)(Ri,2),la=ki[0],xn=ki[1],en=Object(y.useRef)(Object(Ue.a)()),tn=Object(y.useRef)(!1),Tn=Object(y.useRef)(),Mr=Object(y.useRef)(),Ir=Object(y.useRef)(),Fr=Object(y.useRef)(),Sn=Object(y.useRef)(),Pi=function(){var it=Object(R.a)(D.a.mark(function ft(){var st,gt;return D.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(ke.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=Lt.sent,gt!=null&&(st=gt.attachments)!==null&&st!==void 0&&st.length&&(console.log("cm:",Be,Mr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Be.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Be.replaceSelection("[".concat(yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Lt.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(y.useEffect)(function(){vr(yn),Be==null||Be.setValue(yn)},[yn]),Object(y.useEffect)(function(){Pr==null||Pr(br)},[br]),Object(y.useEffect)(function(){if(Mr.current){var it=C.a.fromTextArea(Mr.current,{mode:Rr,lineNumbers:!Ct,lineWrapping:!0,value:we,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(st,gt){if(Gn){gt.preventDefault();return}var xt=gt.clipboardData;if(xt){var Lt=xt.types.toString(),yt=xt.items;if(Lt==="Files"||xt.types.indexOf("Files")>-1){if(gt.preventDefault(),Rr=="stex")return;try{var Ut,qt=yt[1];((Ut=yt[0])===null||Ut===void 0?void 0:Ut.kind)==="file"&&(qt=yt[0]);var vt=qt.getAsFile(),Ur=vt.name.split(".").pop();$(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):J.includes(Ur)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(st,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(st,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(st,gt){Ir.current.classList.add("mouse-hover-md");var xt;if(xt=gt.dataTransfer.files,xt.length>0){gt.preventDefault(),gt.stopPropagation();for(var Lt=function(qt){var vt=xt[qt],Ur=vt.name.split(".").pop();$(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):J.includes(Ur)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},yt=0;yt<xt.length;yt++)Lt(yt)}}),bn(it),function(){it.off("paste",ft)}}},[]);var ur=Object(y.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(y.useEffect)(function(){function it(){var st=new w.default(function(gt){var xt=Object(L.a)(gt),Lt;try{for(xt.s();!(Lt=xt.n()).done;){var yt=Lt.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(ur(),Be.setSize("100%","100%"),Be.refresh())}}catch(Ut){xt.e(Ut)}finally{xt.f()}});return st.observe(Mr.current.parentElement),st}if(Be){var ft=it();return function(){ft.unobserve(Mr.current.parentElement)}}},[Be,ur]),Object(y.useEffect)(function(){if(Be){for(var it=[],ft=function(){var yt=gt[st];xt=Object(B.a)(yt,2);var Ut=xt[0],qt=xt[1],vt=Object(F.a)({},Ut,function(){Mi(qt)});it.push(vt),Be.addKeyMap(vt)},st=0,gt=Object.entries(Q);st<gt.length;st++){var xt;ft()}return Tn.current=setInterval(function(){tn.current&&Pi()},4e3),function(){clearInterval(Tn.current);var Lt=Object(L.a)(it),yt;try{for(Lt.s();!(yt=Lt.n()).done;){var Ut=yt.value;Be.removeKeyMap(Ut)}}catch(qt){Lt.e(qt)}finally{Lt.f()}}}},[Be]),Object(y.useEffect)(function(){Zt!==br&&Di(Zt)},[Zt]),Object(Ze.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+Ye&&(!ft||ft!==Zr)&&(window.sessionStorage.setItem(pr,Zr),xn(!0))}},Ye),Object(y.useEffect)(function(){Yn(Ft)},[Be,Ft]),Object(y.useEffect)(function(){Be&&(Bt&&Be.focus())},[Be,Bt]),Object(y.useEffect)(function(){if(yr&&Be){var it=Be.getScrollerElement();function ft(st){var gt=st.target;if(Sn.current){var xt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*xt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[Be,yr]),Object(y.useEffect)(function(){if(Be&&gr){function it(ft,st){gr(ft,st)}return Be.on("beforeChange",it),function(){Be.off("beforeChange",it)}}},[Be,gr]),Object(y.useEffect)(function(){if(Be&&Tt){function it(){Tt(Be.getValue())}return Be.on("blur",it),function(){Be.off("blur",it)}}},[Be,Tt]),Object(y.useEffect)(function(){if(Be){function it(ft){var st=ft.getValue();vr(st),Qn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Me&&Me(st)}return Be.on("change",it),function(){Be.off("change",it)}}},[Be,Me]),Object(y.useEffect)(function(){Be&&(we==null?(Be.setValue(""),vr("")):we!==Be.getValue()&&(Be.setValue(we),vr(we),Be.setCursor(Be.lineCount(),0)))},[Be,we]);var Mi=Object(y.useCallback)(function(it){var ft=Be.getCursor(),st=Be.getSelection(),gt=st.split(`
|
|
`);switch(it){case"bold":return Be.replaceSelection("**"+st+"**"),st===""&&Be.setCursor(ft.line,ft.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+st+"*"),st===""&&Be.setCursor(ft.line,ft.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+st+"`"),st===""&&Be.setCursor(ft.line,ft.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+st+"$$`"),st===""&&Be.setCursor(ft.line,ft.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+st+"\n```"),Be.setCursor(ft.line+1,st.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return st===""?Be.replaceSelection("- "+st):Be.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),Be.focus();case"list-ol":return st===""?Be.replaceSelection("1. "+st):Be.replaceSelection(gt.map(function(xt,Lt){return xt===""?"":"".concat(Lt+1,". ").concat(xt)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return st===""&&Be.setCursor(ft.line,ft.ch+1),Be.replaceSelection(De),Be.focus();case"inster-template-1":return st===""&&Be.setCursor(ft.line,ft.ch),Be.replaceSelection(Fe),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Yn(!yr),Be.focus();case"trigger-full-screen":return Di(!br),Be.focus();case Pe:Wr(Pe);return;case Je:Wr(Je);return;case Oe:Wr(Oe);return;case Qe:Wr(Qe);return;default:throw new Error}},[Be,yr,br]),wn=Object(y.useCallback)(function(it){Wr("");switch($t){case Pe:var ft=it.title,st=it.link;return Be.replaceSelection("[".concat(ft,"](").concat(st,")")),Be.focus();case Je:var gt=it.language,xt=it.content;return Be.replaceSelection(["```"+gt,xt,"```"].join(`
|
|
`)),Be.focus();case Oe:var Lt=it.src,yt=it.alt;return yt?Be.replaceSelection(".concat(Lt,' "').concat(yt,'" )')):Be.replaceSelection("")),Be.focus();case Qe:for(var Ut=it.row,qt=it.col,vt=it.align,Ur=`
|
|
`,St=0;St<Ut;St++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)St===1&&Vt.push(Ge[vt]),er.push(" ");St===1&&(Ur+="| ".concat(Vt.join(" | "),` |
|
|
`)),Ur+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(Ur+`
|
|
`),Be.focus();default:throw new Error}},[Be,$t]),Zn=Object(y.useMemo)(function(){switch($t){case Pe:return S.a.createElement(q,{callback:wn,onCancel:Hr});case Je:return S.a.createElement(ae.b,{callback:wn,onCancel:Hr});case Oe:return S.a.createElement(oe,{callback:wn,onCancel:Hr});case Qe:return S.a.createElement(_e,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(y.useEffect)(function(){if(Fr.current){var it=Fr.current,ft=!1,st=0;function gt(yt){ft=!0,st=yt.pageY}function xt(){ft=!1}function Lt(yt){if(ft){var Ut=yt.pageY-st;Ut<0&&(Ut=0),Ut>300&&(Ut=300);var qt=dt+Ut+"px";En(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",Lt),document.addEventListener("mouseup",xt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",Lt),document.removeEventListener("mouseup",xt)}}},[Be,Fr]),Object(y.useEffect)(function(){En(dt)},[dt]);var Lr=he(ze),qn=he(Oi),xr={width:Lr,height:qn},ei=Object(y.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),st=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,st=st<10?"0"+st:st,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(st,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Qn(0)}function rn(){xn(!1),Qn(0),Be.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var st=Be.getValue();st=st.replace(it,ft),vr(st),Be==null||Be.setValue(st)}return S.a.createElement(y.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},S.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(br?"full-screen":""),style:xr},S.a.createElement(E,{insertTemp:Et,watch:yr,fullScreen:br,showNullButton:Rt,onActionCallback:Mi,hidetoolBar:kr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:Mr,placeholder:vn})),yr?S.a.createElement("div",{ref:Sn,className:"preview-container"},Rr==="stex"&&S.a.createElement(A,{value:Zr}),Rr!=="stex"&&S.a.createElement(f.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?S.a.createElement("a",{ref:Fr,className:"editor-resize"}):null,S.a.createElement(P.a,null,ee[$t]?S.a.createElement(V.a,{centered:!0,title:ee[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},R7cW:function(ut,qe,te){"use strict";te.r(qe);var re=te("+L6B"),V=te("2/Rp"),L=te("DZo9"),G=te("8z0m"),I=te("0Owb"),R=te("5NDa"),B=te("5rEg"),F=te("sPJy"),M=te("bE4q"),D=te("k1fw"),y=te("oBTY"),S=te("9og8"),O=te("miYZ"),C=te("tsqr"),w=te("y8nQ"),v=te("Vl3Y"),d=te("tJVT"),o=te("WmNS"),u=te.n(o),s=te("cDcd"),x=te.n(s),p=te("Ty5D"),f=te("9kvl"),A=te("55Ip"),b=te("Ot1p"),h=te("XYT7"),c=te("m3rI"),l=te("YiJy"),a=te.n(l),g=function(E){var P,U=E.shixunHomeworks,j=E.newCourse,W=E.globalSetting,_=E.loading,k=E.dispatch,K=E.match,Y=Object(p.i)(),q=v.a.useForm(),ae=Object(d.a)(q,1),Ee=ae[0],ve=Object(s.useState)({}),ge=Object(d.a)(ve,2),fe=ge[0],me=ge[1],oe=Object(s.useState)(!1),pe=Object(d.a)(oe,2),$=pe[0],ie=pe[1],Z=Object(s.useState)([]),xe=Object(d.a)(Z,2),Le=xe[0],be=xe[1],Ce=Object(s.useState)([]),_e=Object(d.a)(Ce,2),ke=_e[0],Ue=_e[1],Pe=U.commonHomeWorkEditDefaultData,Oe={name:"file",multiple:!0,action:c.a.API_SERVER+"/api/attachments.json",defaultFileList:Le,onChange:function(Ze){var He=Ze.file.status;He!=="uploading",He==="done"?C.b.success("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):He==="error"&&C.b.error("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(s.useEffect)(function(){Qe()},[Y.topicId]);var Je=function(Ze){return Ze==null?void 0:Ze.map(function(He){return{uid:He.id,response:{id:He.id},name:He.title,status:"done",url:He.url}})},Qe=function(){var Ge=Object(S.a)(u.a.mark(function Ze(){var He;return u.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,k({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:Y.topicId}});case 2:He=Se.sent,He&&(Ee.setFieldsValue({name:He.name}),Ee.setFieldsValue({description:He.description}),Ee.setFieldsValue({reference_answer:He.reference_answer}),be(Object(y.a)(Je(He.attachments))),Ue(Object(y.a)(Je(He.reference_attachments))),ie(!0));case 4:case"end":return Se.stop()}},Ze)}));return function(){return Ge.apply(this,arguments)}}(),We=function(){var Ge=Object(S.a)(u.a.mark(function Ze(He){var Ke,Se,et,Ye;return u.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:return Ke=Object(D.a)({},fe),Ke.attachment_ids&&(Ke.attachment_ids=Ke==null||((Se=Ke.attachment_ids.fileList)===null||Se===void 0)?void 0:Se.map(function(he){var le;return(le=he.response)===null||le===void 0?void 0:le.id})),Ke.reference_attachment_ids&&(Ke.reference_attachment_ids=Ke==null||((et=Ke.reference_attachment_ids.fileList)===null||et===void 0)?void 0:et.map(function(he){var le;return(le=he.response)===null||le===void 0?void 0:le.id})),Fe.next=5,Object(h.n)(Object(D.a)(Object(D.a)({id:Y.topicId},Ke),{},{base_on_project:null,type:1}));case 5:Ye=Fe.sent,Ye&&f.d.push("/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail"));case 7:case"end":return Fe.stop()}},Ze)}));return function(He){return Ge.apply(this,arguments)}}();return x.a.createElement("section",{className:a.a.bg},x.a.createElement("section",{className:"animated fadeIn"},x.a.createElement("aside",{className:"mt10"},x.a.createElement(M.a,{separator:">"},x.a.createElement(M.a.Item,null,x.a.createElement(A.a,{to:"/users/".concat(Y.username,"/").concat(Y.topictype==="personal"?"topics":"topicbank","/").concat(Y.topictype)},Y.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),x.a.createElement(M.a.Item,null,x.a.createElement(A.a,{to:"/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail")},"\u8BE6\u60C5")),x.a.createElement(M.a.Item,null,"\u7F16\u8F91")))),x.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),x.a.createElement(v.a,{form:Ee,className:a.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){me(Object(D.a)({},Ee.getFieldsValue()))},onFinish:We},x.a.createElement("div",{className:a.a.fieldWrap},x.a.createElement(v.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},x.a.createElement(B.a,{maxLength:60,suffix:"".concat(((P=fe.name)===null||P===void 0?void 0:P.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),x.a.createElement("div",{className:a.a.mdWrap},x.a.createElement(v.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"}]},x.a.createElement(b.a,{id:"topic-normal-description",watch:!0,defaultValue:Pe.description})),x.a.createElement("div",null,x.a.createElement(v.a.Item,{name:"attachment_ids"},$&&x.a.createElement(G.a,Object(I.a)({defaultFileList:Le},Oe),x.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),x.a.createElement("div",{className:a.a.mdWrap},x.a.createElement(v.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},x.a.createElement(b.a,{id:"topic-normal-reference_answer",defaultValue:Pe.reference_answer,watch:!0})),x.a.createElement("div",null,x.a.createElement(v.a.Item,{name:"reference_attachment_ids"},$&&x.a.createElement(G.a,Object(I.a)({},Oe,{defaultFileList:ke}),x.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),x.a.createElement("div",{className:a.a.backgroundFa},x.a.createElement("div",{className:"pt40 mb30"},x.a.createElement(v.a.Item,null,x.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(a.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),x.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:a.a.button,onClick:function(){return f.d.push("/users/".concat(Y.username,"/topics/").concat(Y.topicId,"/").concat(Y.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};qe.default=Object(f.a)(function(m){var E=m.shixunHomeworks,P=m.newCourse,U=m.loading,j=m.globalSetting;return{shixunHomeworks:E,newCourse:P,globalSetting:j,loading:U.effects}})(g)},SJMd:function(ut,qe){/**
|
|
* @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 te,re,V,L=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var F=window,M=["break,continue,do,else,for,if,return,while"],D=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="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=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],s=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[S,C,O,v,d,o,u,s],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",A="kwd",b="com",h="typ",c="lit",l="pun",a="pln",g="tag",m="dec",E="src",P="atn",U="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(be){for(var Ce=0,_e=!1,ke=!1,Ue=0,Pe=be.length;Ue<Pe;++Ue){var Oe=be[Ue];if(Oe.ignoreCase)ke=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,ke=!1;break}}var Je={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(Ke){var Se=Ke.charCodeAt(0);if(Se!==92)return Se;var et=Ke.charAt(1);return Se=Je[et],Se||("0"<=et&&et<="7"?parseInt(Ke.substring(1),8):et==="u"||et==="x"?parseInt(Ke.substring(2),16):Ke.charCodeAt(1))}function We(Ke){if(Ke<32)return(Ke<16?"\\x0":"\\x")+Ke.toString(16);var Se=String.fromCharCode(Ke);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function Ge(Ke){var Se=Ke.substring(1,Ke.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")),et=[],Ye=Se[0]==="^",De=["["];Ye&&De.push("^");for(var Fe=Ye?1:0,he=Se.length;Fe<he;++Fe){var le=Se[Fe];if(/\\[bdsw]/i.test(le))De.push(le);else{var de=Qe(le),J;Fe+2<he&&Se[Fe+1]==="-"?(J=Qe(Se[Fe+2]),Fe+=2):J=de,et.push([de,J]),J<65||de>122||(J<65||de>90||et.push([Math.max(65,de)|32,Math.min(J,90)|32]),J<97||de>122||et.push([Math.max(97,de)&~32,Math.min(J,122)&~32]))}}et.sort(function(ce,Ae){return ce[0]-Ae[0]||Ae[1]-ce[1]});for(var Q=[],ee=[],Fe=0;Fe<et.length;++Fe){var se=et[Fe];se[0]<=ee[1]+1?ee[1]=Math.max(ee[1],se[1]):Q.push(ee=se)}for(var Fe=0;Fe<Q.length;++Fe){var se=Q[Fe];De.push(We(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&De.push("-"),De.push(We(se[1])))}return De.push("]"),De.join("")}function Ze(Ke){for(var Se=Ke.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")),et=Se.length,Ye=[],De=0,Fe=0;De<et;++De){var he=Se[De];if(he==="(")++Fe;else if(he.charAt(0)==="\\"){var le=+he.substring(1);le&&(le<=Fe?Ye[le]=-1:Se[De]=We(le))}}for(var De=1;De<Ye.length;++De)Ye[De]===-1&&(Ye[De]=++Ce);for(var De=0,Fe=0;De<et;++De){var he=Se[De];if(he==="(")++Fe,Ye[Fe]||(Se[De]="(?:");else if(he.charAt(0)==="\\"){var le=+he.substring(1);le&&le<=Fe&&(Se[De]="\\"+Ye[le])}}for(var De=0;De<et;++De)Se[De]==="^"&&Se[De+1]!=="^"&&(Se[De]="");if(Ke.ignoreCase&&_e)for(var De=0;De<et;++De){var he=Se[De],de=he.charAt(0);he.length>=2&&de==="["?Se[De]=Ge(he):de!=="\\"&&(Se[De]=he.replace(/[a-zA-Z]/g,function(ee){var se=ee.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Se.join("")}for(var He=[],Ue=0,Pe=be.length;Ue<Pe;++Ue){var Oe=be[Ue];if(Oe.global||Oe.multiline)throw new Error(""+Oe);He.push("(?:"+Ze(Oe)+")")}return new RegExp(He.join("|"),ke?"gi":"g")}function k(be,Ce){var _e=/(?:^|\s)nocode(?:\s|$)/,ke=[],Ue=0,Pe=[],Oe=0;function Je(Qe){var We=Qe.nodeType;if(We==1){if(_e.test(Qe.className))return;for(var Ge=Qe.firstChild;Ge;Ge=Ge.nextSibling)Je(Ge);var Ze=Qe.nodeName.toLowerCase();(Ze==="br"||Ze==="li")&&(ke[Oe]=`
|
|
`,Pe[Oe<<1]=Ue++,Pe[Oe++<<1|1]=Qe)}else if(We==3||We==4){var He=Qe.nodeValue;He.length&&(Ce?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),ke[Oe]=He,Pe[Oe<<1]=Ue,Ue+=He.length,Pe[Oe++<<1|1]=Qe)}}return Je(be),{sourceCode:ke.join("").replace(/\n$/,""),spans:Pe}}function K(be,Ce,_e,ke,Ue){if(!_e)return;var Pe={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:Ce,decorations:null};ke(Pe),Ue.push.apply(Ue,Pe.decorations)}var Y=/\S/;function q(be){for(var Ce=void 0,_e=be.firstChild;_e;_e=_e.nextSibling){var ke=_e.nodeType;Ce=ke===1?Ce?be:_e:ke===3&&Y.test(_e.nodeValue)?be:Ce}return Ce===be?void 0:Ce}function ae(be,Ce){var _e={},ke;(function(){for(var Oe=be.concat(Ce),Je=[],Qe={},We=0,Ge=Oe.length;We<Ge;++We){var Ze=Oe[We],He=Ze[3];if(He)for(var Ke=He.length;--Ke>=0;)_e[He.charAt(Ke)]=Ze;var Se=Ze[1],et=""+Se;Qe.hasOwnProperty(et)||(Je.push(Se),Qe[et]=null)}Je.push(/[\0-\uffff]/),ke=_(Je)})();var Ue=Ce.length,Pe=function(Oe){for(var Je=Oe.sourceCode,Qe=Oe.basePos,We=Oe.sourceNode,Ge=[Qe,a],Ze=0,He=Je.match(ke)||[],Ke={},Se=0,et=He.length;Se<et;++Se){var Ye=He[Se],De=Ke[Ye],Fe=void 0,he;if(typeof De=="string")he=!1;else{var le=_e[Ye.charAt(0)];if(le)Fe=Ye.match(le[1]),De=le[0];else{for(var de=0;de<Ue;++de)if(le=Ce[de],Fe=Ye.match(le[1]),Fe){De=le[0];break}Fe||(De=a)}he=De.length>=5&&De.substring(0,5)==="lang-",he&&!(Fe&&typeof Fe[1]=="string")&&(he=!1,De=E),he||(Ke[Ye]=De)}var J=Ze;if(Ze+=Ye.length,!he)Ge.push(Qe+J,De);else{var Q=Fe[1],ee=Ye.indexOf(Q),se=ee+Q.length;Fe[2]&&(se=Ye.length-Fe[2].length,ee=se-Q.length);var ce=De.substring(5);K(We,Qe+J,Ye.substring(0,ee),Pe,Ge),K(We,Qe+J+ee,Q,pe(ce,Q),Ge),K(We,Qe+J+se,Ye.substring(se),Pe,Ge)}}Oe.decorations=Ge};return Pe}function Ee(be){var Ce=[],_e=[];be.tripleQuotedStrings?Ce.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?Ce.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&_e.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=be.hashComments;ke&&(be.cStyleComments?(ke>1?Ce.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([b,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(_e.push([b,/^\/\/[^\r\n]*/,null]),_e.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ue=be.regexLiterals;if(Ue){var Pe=Ue>1?"":`
|
|
\r`,Oe=Pe?".":"[\\S\\s]",Je="/(?=[^/*"+Pe+"])(?:[^/\\x5B\\x5C"+Pe+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+Pe+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+W+"("+Je+")")])}var Qe=be.types;Qe&&_e.push([h,Qe]);var We=(""+be.keywords).replace(/^ | $/g,"");We.length&&_e.push([A,new RegExp("^(?:"+We.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ge="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Ge+="(?!s*/)"),_e.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Ge),null]),ae(Ce,_e)}var ve=Ee({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(be,Ce,_e){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Ue=/\r\n?|\n/,Pe=be.ownerDocument,Oe=Pe.createElement("li");be.firstChild;)Oe.appendChild(be.firstChild);var Je=[Oe];function Qe(Se){var et=Se.nodeType;if(et==1&&!ke.test(Se.className))if(Se.nodeName==="br")We(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Ye=Se.firstChild;Ye;Ye=Ye.nextSibling)Qe(Ye);else if((et==3||et==4)&&_e){var De=Se.nodeValue,Fe=De.match(Ue);if(Fe){var he=De.substring(0,Fe.index);Se.nodeValue=he;var le=De.substring(Fe.index+Fe[0].length);if(le){var de=Se.parentNode;de.insertBefore(Pe.createTextNode(le),Se.nextSibling)}We(Se),he||Se.parentNode.removeChild(Se)}}}function We(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function et(Fe,he){var le=he?Fe.cloneNode(!1):Fe,de=Fe.parentNode;if(de){var J=et(de,1),Q=Fe.nextSibling;J.appendChild(le);for(var ee=Q;ee;ee=Q)Q=ee.nextSibling,J.appendChild(ee)}return le}for(var Ye=et(Se.nextSibling,0),De;(De=Ye.parentNode)&&De.nodeType===1;)Ye=De;Je.push(Ye)}for(var Ge=0;Ge<Je.length;++Ge)Qe(Je[Ge]);Ce===(Ce|0)&&Je[0].setAttribute("value",Ce);var Ze=Pe.createElement("ol");Ze.className="linenums";for(var He=Math.max(0,Ce-1|0)||0,Ge=0,Ke=Je.length;Ge<Ke;++Ge)Oe=Je[Ge],Oe.className="L"+(Ge+He)%10,Oe.firstChild||Oe.appendChild(Pe.createTextNode("\xA0")),Ze.appendChild(Oe);be.appendChild(Ze)}function fe(be){var Ce=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ce=Ce&&+Ce[1]<=8;var _e=/\n/g,ke=be.sourceCode,Ue=ke.length,Pe=0,Oe=be.spans,Je=Oe.length,Qe=0,We=be.decorations,Ge=We.length,Ze=0;We[Ge]=Ue;var He,Ke;for(Ke=He=0;Ke<Ge;)We[Ke]!==We[Ke+2]?(We[He++]=We[Ke++],We[He++]=We[Ke++]):Ke+=2;for(Ge=He,Ke=He=0;Ke<Ge;){for(var Se=We[Ke],et=We[Ke+1],Ye=Ke+2;Ye+2<=Ge&&We[Ye+1]===et;)Ye+=2;We[He++]=Se,We[He++]=et,Ke=Ye}Ge=We.length=He;var De=be.sourceNode,Fe="";De&&(Fe=De.style.display,De.style.display="none");try{for(var he=null;Qe<Je;){var le=Oe[Qe],de=Oe[Qe+2]||Ue,J=We[Ze+2]||Ue,Ye=Math.min(de,J),Q=Oe[Qe+1],ee;if(Q.nodeType!==1&&(ee=ke.substring(Pe,Ye))){Ce&&(ee=ee.replace(_e,"\r")),Q.nodeValue=ee;var se=Q.ownerDocument,ce=se.createElement("span");ce.className=We[Ze+1];var Ae=Q.parentNode;Ae.replaceChild(ce,Q),ce.appendChild(Q),Pe<de&&(Oe[Qe+1]=Q=se.createTextNode(ke.substring(Ye,de)),Ae.insertBefore(Q,ce.nextSibling))}Pe=Ye,Pe>=de&&(Qe+=2),Pe>=J&&(Ze+=2)}}finally{De&&(De.style.display=Fe)}}var me={};function oe(be,Ce){for(var _e=Ce.length;--_e>=0;){var ke=Ce[_e];me.hasOwnProperty(ke)?F.console&&console.warn("cannot override language handler %s",ke):me[ke]=be}}function pe(be,Ce){return be&&me.hasOwnProperty(be)||(be=/^\s*</.test(Ce)?"default-markup":"default-code"),me[be]}oe(ve,["default-code"]),oe(ae([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["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"]),oe(ae([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),oe(ae([],[[U,/^[\s\S]+/]]),["uq.val"]),oe(Ee({keywords:S,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),oe(Ee({keywords:"null,true,false"}),["json"]),oe(Ee({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),oe(Ee({keywords:O,cStyleComments:!0}),["java"]),oe(Ee({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),oe(Ee({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),oe(Ee({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),oe(Ee({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),oe(Ee({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),oe(Ee({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),oe(ae([],[[f,/^[\s\S]+/]]),["regex"]);function $(be){var Ce=be.langExtension;try{var _e=k(be.sourceNode,be.pre),ke=_e.sourceCode;be.sourceCode=ke,be.spans=_e.spans,be.basePos=0,pe(Ce,ke)(be),fe(be)}catch(Ue){F.console&&console.log(Ue&&Ue.stack||Ue)}}function ie(be,Ce,_e){var ke=_e||!1,Ue=Ce||null,Pe=document.createElement("div");Pe.innerHTML="<pre>"+be+"</pre>",Pe=Pe.firstChild,ke&&ge(Pe,ke,!0);var Oe={langExtension:Ue,numberLines:ke,sourceNode:Pe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Oe),Pe.innerHTML}function Z(be,Ce){var _e=Ce||document.body,ke=_e.ownerDocument||document;function Ue(le){return _e.getElementsByTagName(le)}for(var Pe=[Ue("pre"),Ue("code"),Ue("xmp")],Oe=[],Je=0;Je<Pe.length;++Je)for(var Qe=0,We=Pe[Je].length;Qe<We;++Qe)Oe.push(Pe[Je][Qe]);Pe=null;var Ge=Date;Ge.now||(Ge={now:function(){return+new Date}});var Ze=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ke=/\bprettyprint\b/,Se=/\bprettyprinted\b/,et=/pre|xmp/i,Ye=/^code$/i,De=/^(?:pre|code|xmp)$/i,Fe={};function he(){for(var le=F.PR_SHOULD_USE_CONTINUATION?Ge.now()+250:Infinity;Ze<Oe.length&&Ge.now()<le;Ze++){for(var de=Oe[Ze],J=Fe,Q=de;Q=Q.previousSibling;){var ee=Q.nodeType,se=(ee===7||ee===8)&&Q.nodeValue;if(se?!/^\??prettify\b/.test(se):ee!==3||/\S/.test(Q.nodeValue))break;if(se){J={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ft,Et,Cr){J[Et]=Cr});break}}var ce=de.className;if((J!==Fe||Ke.test(ce))&&!Se.test(ce)){for(var Ae=!1,we=de.parentNode;we;we=we.parentNode){var Me=we.tagName;if(De.test(Me)&&we.className&&Ke.test(we.className)){Ae=!0;break}}if(!Ae){de.className+=" prettyprinted";var $e=J.lang;if(!$e){$e=ce.match(He);var ze;!$e&&(ze=q(de))&&Ye.test(ze.tagName)&&($e=ze.className.match(He)),$e&&($e=$e[1])}var mt;if(et.test(de.tagName))mt=1;else{var dt=de.currentStyle,ot=ke.defaultView,Ct=dt?dt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(de,null).getPropertyValue("white-space"):0;mt=Ct&&Ct.substring(0,3)==="pre"}var bt=J.linenums;(bt=bt==="true"||+bt)||(bt=ce.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&ge(de,bt,mt);var Bt={langExtension:$e,sourceNode:de,numberLines:bt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};$(Bt)}}}Ze<Oe.length?F.setTimeout(he,250):typeof be=="function"&&be()}he()}var xe=F.PR={createSimpleLexer:ae,registerLangHandler:oe,sourceDecorator:Ee,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:E,PR_STRING:f,PR_TAG:g,PR_TYPE:h,prettyPrintOne:L?F.prettyPrintOne=ie:R=ie,prettyPrint:B=L?F.prettyPrint=Z:B=Z},Le=F.define;typeof Le=="function"&&Le.amd&&Le("google-code-prettify",[],function(){return xe})})()},"VrN/":function(ut,qe,te){(function(re,V){ut.exports=V()})(this,function(){"use strict";var re=navigator.userAgent,V=navigator.platform,L=/gecko\/\d/i.test(re),G=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),R=/Edge\/(\d+)/.exec(re),B=G||I||R,F=B&&(G?document.documentMode||6:+(R||I)[1]),M=!R&&/WebKit\//.test(re),D=M&&/Qt\/\d+\.\d+/.test(re),y=!R&&/Chrome\//.test(re),S=/Opera\//.test(re),O=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),w=/PhantomJS/.test(re),v=!R&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=v||/Mac/.test(V),s=/\bCrOS\b/.test(re),x=/win/i.test(V),p=S&&re.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(S=!1,M=!0);var f=u&&(D||S&&(p==null||p<12.11)),A=L||B&&F>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=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 E(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 P(){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;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(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 _(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function k(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 K(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,N=i||0;;){var H=e.indexOf(" ",T);if(H<0||H>=t)return N+(t-T);N+=H-T,N+=n-N%n,T=H+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ae=50,Ee={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},fe={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var N=T-r;if(T==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var oe=[""];function pe(e){for(;oe.length<=e;)oe.push($(oe)+" ");return oe[e]}function $(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 Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function xe(){}function Le(e,t){var n;return Object.create?n=Object.create(e):(xe.prototype=e,n=new xe),t&&k(t,n),n}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ce(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&Ce(e)?!0:t.test(e):Ce(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ue=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Pe(e){return e.charCodeAt(0)>=768&&Ue.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&Pe(e.charAt(t));)t+=n;return t}function Je(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function Qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var N=e[T];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var We=null;function Ge(e,t,n){var r;We=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:We=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:We=i)}return r!=null?r:We}var Ze=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function z(X,ne,ue){this.level=X,this.from=ne,this.to=ue}return function(X,ne){var ue=ne=="ltr"?"L":"R";if(X.length==0||ne=="ltr"&&!r.test(X))return!1;for(var Te=X.length,ye=[],Re=0;Re<Te;++Re)ye.push(n(X.charCodeAt(Re)));for(var Ie=0,je=ue;Ie<Te;++Ie){var Ve=ye[Ie];Ve=="m"?ye[Ie]=je:je=Ve}for(var tt=0,Xe=ue;tt<Te;++tt){var rt=ye[tt];rt=="1"&&Xe=="r"?ye[tt]="n":T.test(rt)&&(Xe=rt,rt=="r"&&(ye[tt]="R"))}for(var lt=1,at=ye[0];lt<Te-1;++lt){var pt=ye[lt];pt=="+"&&at=="1"&&ye[lt+1]=="1"?ye[lt]="1":pt==","&&at==ye[lt+1]&&(at=="1"||at=="n")&&(ye[lt]=at),at=pt}for(var Dt=0;Dt<Te;++Dt){var Ht=ye[Dt];if(Ht==",")ye[Dt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Dt+1;Ot<Te&&ye[Ot]=="%";++Ot);for(var sr=Dt&&ye[Dt-1]=="!"||Ot<Te&&ye[Ot]=="1"?"1":"N",nr=Dt;nr<Ot;++nr)ye[nr]=sr;Dt=Ot-1}}for(var Mt=0,ir=ue;Mt<Te;++Mt){var zt=ye[Mt];ir=="L"&&zt=="1"?ye[Mt]="L":T.test(zt)&&(ir=zt)}for(var Nt=0;Nt<Te;++Nt)if(i.test(ye[Nt])){var It=void 0;for(It=Nt+1;It<Te&&i.test(ye[It]);++It);for(var kt=(Nt?ye[Nt-1]:ue)=="L",ar=(It<Te?ye[It]:ue)=="L",jn=kt==ar?kt?"L":"R":ue,Jr=Nt;Jr<It;++Jr)ye[Jr]=jn;Nt=It-1}for(var Yt=[],Or,Kt=0;Kt<Te;)if(N.test(ye[Kt])){var Va=Kt;for(++Kt;Kt<Te&&N.test(ye[Kt]);++Kt);Yt.push(new z(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=ne=="rtl"?1:0;for(++Kt;Kt<Te&&ye[Kt]!="L";++Kt);for(var Qt=jr;Qt<Kt;)if(H.test(ye[Qt])){jr<Qt&&(Yt.splice(fn,0,new z(1,jr,Qt)),fn+=hn);var Wn=Qt;for(++Qt;Qt<Kt&&H.test(ye[Qt]);++Qt);Yt.splice(fn,0,new z(2,Wn,Qt)),fn+=hn,jr=Qt}else++Qt;jr<Kt&&Yt.splice(fn,0,new z(1,jr,Kt))}return ne=="ltr"&&(Yt[0].level==1&&(Or=X.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new z(0,0,Or[0].length))),$(Yt).level==1&&(Or=X.match(/\s+$/))&&($(Yt).to-=Or[0].length,Yt.push(new z(0,Te-Or[0].length,Te)))),ne=="rtl"?Yt.reverse():Yt}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=Ze(e.text,t)),n}var Ke=[],Se=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]||Ke).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Ke}function Ye(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 T=q(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function De(e,t){var n=et(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 Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),De(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function he(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)q(n,t[r])==-1&&n.push(t[r])}function le(e,t){return et(e,t).length>0}function de(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function J(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){J(e),Q(e)}function ce(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var we=function(){if(B&&F<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Me;function $e(e){if(Me==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Me=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&F<8))}var n=Me?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ze;function mt(e){if(ze!=null)return ze;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:ze=r.right-n.right<3}var dt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=T.indexOf("\r");N!=-1?(n.push(T.slice(0,N)),t+=N+1):(n.push(T),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Bt(e){if(bt!=null)return bt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ft={},Et={};function Cr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ft[e]=t}function Rr(e,t){Et[e]=t}function lr(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=Le(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=lr(t);var n=Ft[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};k(t,n)}function Ar(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.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},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function kr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var N=T.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function mn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Zt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,n=q(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 gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],z=H.height;if(t<z)break;t-=z}return n+N}function Pr(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return Ne(e.line,e.ch)}function vn(e,t){return ct(e,t)<0?t:e}function Qr(e,t){return ct(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,nt(e,n).text.length):Ai(t,nt(e,t.line).text.length)}function Ai(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Be(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof bn?new hr(e,Ar(e.mode,t.state),n,t.lookAhead):new hr(e,Ar(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?Ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],T={};br(e,t.text,e.doc.mode,n,function(X,ne){return i.push(X,ne)},T,r);for(var N=n.state,H=function(X){n.baseTokens=i;var ne=e.state.overlays[X],ue=1,Te=0;n.state=!0,br(e,t.text,ne.mode,n,function(ye,Re){for(var Ie=ue;Te<ye;){var je=i[ue];je>ye&&i.splice(ue,1,ye,i[ue+1],je),ue+=2,Te=Math.min(ye,je)}if(!Re)return;if(ne.opaque)i.splice(Ie,ue-Ie,ye,"overlay "+Re),ue=Ie+2;else for(;Ie<ue;Ie+=2){var Ve=i[Ie+1];i[Ie+1]=(Ve?Ve+" ":"")+"overlay "+Re}},T),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)H(z);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function Zr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=vr(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&Ar(e.doc.mode,r.state),T=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var T=Di(e,t,n),N=T>r.first&&nt(r,T-1).stateAfter,H=N?hr.fromSaved(r,N,T):new hr(r,Kn(r.mode),T);return r.iter(T,t,function(z){Vn(e,z.text,H);var X=H.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,T=new Rt(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&Xn(i,n.state);!T.eol();)yr(i,T,n.state),T.start=T.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function yr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Li(e,t,n,r){var i=e.doc,T=i.mode,N;t=ht(i,t);var H=nt(i,t.line),z=vr(e,t.line,n),X=new Rt(H.text,e.options.tabSize,z),ne;for(r&&(ne=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,N=yr(T,X,z.state),r&&ne.push(new Yn(X,N,Ar(i.mode,z.state)));return r?ne:new Yn(X,N,z.state)}function $n(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 br(e,t,n,r,i,T,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var z=0,X=null,ne=new Rt(t,e.options.tabSize,r),ue,Te=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),T);!ne.eol();){if(ne.pos>e.options.maxHighlightLength?(H=!1,N&&Vn(e,t,r,ne.pos),ne.pos=t.length,ue=null):ue=$n(yr(n,ne,r.state,Te),T),Te){var ye=Te[0].name;ye&&(ue="m-"+(ue?ye+" "+ue:ye))}if(!H||X!=ue){for(;z<ne.start;)z=Math.min(ne.start,z+5e3),i(z,X);X=ue}ne.start=ne.pos}for(;z<ne.pos;){var Re=Math.min(ne.pos,z+5e3);i(Re,X),z=Re}}function Di(e,t,n){for(var r,i,T=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=T.first)return T.first;var z=nt(T,H-1),X=z.stateAfter;if(X&&(!n||H+(X instanceof bn?X.lookAhead:0)<=T.modeFrontier))return H;var ne=K(z.text,null,e.options.tabSize);(i==null||r>ne)&&(i=H-1,r=ne)}return i}function aa(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=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,$t=!1;function Wr(){Jn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Qn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function _i(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,H=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);if(H||T.from==t&&N.type=="bookmark"&&(!n||!T.marker.insertLeft)){var z=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new qr(N,T.from,z?null:T.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,H=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);if(H||T.from==t&&N.type=="bookmark"&&(!n||T.marker.insertLeft)){var z=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new qr(N,z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function En(e,t){if(t.full)return null;var n=Pr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Pr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,N=ct(t.from,t.to)==0,H=_i(n,i,N),z=Oi(r,T,N),X=t.text.length==1,ne=$(t.text).length+(X?i:0);if(H)for(var ue=0;ue<H.length;++ue){var Te=H[ue];if(Te.to==null){var ye=Er(z,Te.marker);ye?X&&(Te.to=ye.to==null?null:ye.to+ne):Te.to=i}}if(z)for(var Re=0;Re<z.length;++Re){var Ie=z[Re];if(Ie.to!=null&&(Ie.to+=ne),Ie.from==null){var je=Er(H,Ie.marker);je||(Ie.from=ne,X&&(H||(H=[])).push(Ie))}else Ie.from+=ne,X&&(H||(H=[])).push(Ie)}H&&(H=Ri(H)),z&&z!=H&&(z=Ri(z));var Ve=[H];if(!X){var tt=t.text.length-2,Xe;if(tt>0&&H)for(var rt=0;rt<H.length;++rt)H[rt].to==null&&(Xe||(Xe=[])).push(new qr(H[rt].marker,null,null));for(var lt=0;lt<tt;++lt)Ve.push(Xe);Ve.push(z)}return Ve}function Ri(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 ki(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var Re=0;Re<ye.markedSpans.length;++Re){var Ie=ye.markedSpans[Re].marker;Ie.readOnly&&(!r||q(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var N=r[T],H=N.find(0),z=0;z<i.length;++z){var X=i[z];if(ct(X.to,H.from)<0||ct(X.from,H.to)>0)continue;var ne=[z,1],ue=ct(X.from,H.from),Te=ct(X.to,H.to);(ue<0||!N.inclusiveLeft&&!ue)&&ne.push({from:X.from,to:H.from}),(Te>0||!N.inclusiveRight&&!Te)&&ne.push({from:H.to,to:X.to}),i.splice.apply(i,ne),z+=ne.length-3}return i}function la(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 xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=ct(r.from,i.from)||en(e)-en(t);if(T)return-T;var N=ct(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function Mr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return Mr(e,!0)}function Fr(e){return Mr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||Tn(r,T.marker)<0)&&(r=T.marker)}return r}function Pi(e,t,n,r,i){var T=nt(e,t),N=$t&&T.markedSpans;if(N)for(var H=0;H<N.length;++H){var z=N[H];if(!z.marker.collapsed)continue;var X=z.marker.find(0),ne=ct(X.from,n)||en(z.marker)-en(i),ue=ct(X.to,r)||tn(z.marker)-tn(i);if(ne>=0&&ue<=0||ne<=0&&ue>=0)continue;if(ne<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||ne>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function Mi(e){for(var t;t=Fr(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Fr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=nt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Lr(e,n))return t;for(;r=Fr(n);)n=r.find(1,!0).line;return Tt(n)+1}function Lr(e,t){var n=$t&&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&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function xr(e){e=ur(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 T=n.parent;T;n=T,T=n.parent)for(var N=0;N<T.children.length;++N){var H=T.children[N];if(H==n)break;t+=H.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Fr(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},de(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Zt(e,i)}function it(e){e.parent=null,la(e)}var ft={},st={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?st:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function xt(e,t){var n=g("span",null,null,M?"padding-right: .1px":null),r={pre:g("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 T=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=yt,mt(e.display.measure)&&(N=He(T,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&Tt(T);Ur(T,r,Zr(e,T,H)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=j(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=j(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild($e(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(M){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Lt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function yt(e,t,n,r,i,T,N){if(!t)return;var H=e.splitSpaces?Ut(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,ne;if(!z.test(t))e.col+=t.length,ne=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ne),B&&F<9&&(X=!0),e.pos+=t.length;else{ne=document.createDocumentFragment();for(var ue=0;;){z.lastIndex=ue;var Te=z.exec(t),ye=Te?Te.index-ue:t.length-ue;if(ye){var Re=document.createTextNode(H.slice(ue,ue+ye));B&&F<9?ne.appendChild(a("span",[Re])):ne.appendChild(Re),e.map.push(e.pos,e.pos+ye,Re),e.col+=ye,e.pos+=ye}if(!Te)break;ue+=ye+1;var Ie=void 0;if(Te[0]==" "){var je=e.cm.options.tabSize,Ve=je-e.col%je;Ie=ne.appendChild(a("span",pe(Ve),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=Ve}else Te[0]=="\r"||Te[0]==`
|
|
`?(Ie=ne.appendChild(a("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",Te[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(Te[0]),Ie.setAttribute("cm-text",Te[0]),B&&F<9?ne.appendChild(a("span",[Ie])):ne.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||X||T||N){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var Xe=a("span",[ne],tt,T);if(N)for(var rt in N)N.hasOwnProperty(rt)&&rt!="style"&&rt!="class"&&Xe.setAttribute(rt,N[rt]);return e.content.appendChild(Xe)}e.content.appendChild(ne)}function Ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function qt(e,t){return function(n,r,i,T,N,H,z){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ne=X+r.length;;){for(var ue=void 0,Te=0;Te<t.length&&!(ue=t[Te],ue.to>X&&ue.from<=X);Te++);if(ue.to>=ne)return e(n,r,i,T,N,H,z);e(n,r.slice(0,ue.to-X),i,T,null,H,z),T=null,r=r.slice(ue.to-X),X=ue.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ur(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(T,T=n[N]),gt(n[N+1],t.cm.options));return}for(var H=i.length,z=0,X=1,ne="",ue,Te,ye=0,Re,Ie,je,Ve,tt;;){if(ye==z){Re=Ie=je=Te="",tt=null,Ve=null,ye=Infinity;for(var Xe=[],rt=void 0,lt=0;lt<r.length;++lt){var at=r[lt],pt=at.marker;if(pt.type=="bookmark"&&at.from==z&&pt.widgetNode)Xe.push(pt);else if(at.from<=z&&(at.to==null||at.to>z||pt.collapsed&&at.to==z&&at.from==z)){if(at.to!=null&&at.to!=z&&ye>at.to&&(ye=at.to,Ie=""),pt.className&&(Re+=" "+pt.className),pt.css&&(Te=(Te?Te+";":"")+pt.css),pt.startStyle&&at.from==z&&(je+=" "+pt.startStyle),pt.endStyle&&at.to==ye&&(rt||(rt=[])).push(pt.endStyle,at.to),pt.title&&((tt||(tt={})).title=pt.title),pt.attributes)for(var Dt in pt.attributes)(tt||(tt={}))[Dt]=pt.attributes[Dt];pt.collapsed&&(!Ve||Tn(Ve.marker,pt)<0)&&(Ve=at)}else at.from>z&&ye>at.from&&(ye=at.from)}if(rt)for(var Ht=0;Ht<rt.length;Ht+=2)rt[Ht+1]==ye&&(Ie+=" "+rt[Ht]);if(!Ve||Ve.from==z)for(var Ot=0;Ot<Xe.length;++Ot)vt(t,0,Xe[Ot]);if(Ve&&(Ve.from||0)==z){if(vt(t,(Ve.to==null?H+1:Ve.to)-z,Ve.marker,Ve.from==null),Ve.to==null)return;Ve.to==z&&(Ve=!1)}}if(z>=H)break;for(var sr=Math.min(H,ye);;){if(ne){var nr=z+ne.length;if(!Ve){var Mt=nr>sr?ne.slice(0,sr-z):ne;t.addToken(t,Mt,ue?ue+Re:Re,je,z+Mt.length==ye?Ie:"",Te,tt)}if(nr>=sr){ne=ne.slice(sr-z),z=sr;break}z=nr,je=""}ne=i.slice(T,T=n[X++]),ue=gt(n[X++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?Tt($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Lr(e,t)}function er(e,t,n){for(var r=[],i,T=t;T<n;T=i){var N=new St(e.doc,nt(e.doc,T),T);i=T+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Os(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 Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=et(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(ks,0));for(var T=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)T(N)}function ks(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?Ms(e,t):T=="gutter"?Ja(e,t,n,r):T=="class"?da(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function ri(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&&F<8&&(e.node.style.zIndex=2)),e.node}function Ps(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=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):xt(e,t)}function Ms(e,t){var n=t.text.className,r=$a(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,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ps(e,t),t.line.wrapClass?ri(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 Ja(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=ri(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=t.line.gutterMarkers;if(e.options.lineNumbers||T){var N=ri(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var z=0;z<e.display.gutterSpecs.length;++z){var X=e.display.gutterSpecs[z].className,ne=T.hasOwnProperty(X)&&T[X];ne&&H.appendChild(a("div",[ne],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Fs(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Qa(e,t,r),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var T=ri(n),N=0,H=t.widgets;N<H.length;++N){var z=H[N],X=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Us(z,X,n,r),e.display.input.setUneditable(X),i&&z.above?T.insertBefore(X,n.gutter||n.text):T.appendChild(X),Gt(z,"redraw")}}function Us(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 ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(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;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=ce(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(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 Dr(e){return ae-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Dr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Dr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var z=N[H],X=N[H+1];Math.abs(z.bottom-X.bottom)>2&&T.push((z.bottom+X.top)/2-n.top)}}T.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;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(Tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=xt(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return _r(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Cn(e,t){var n=Tt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _r(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),N;return t.cache.hasOwnProperty(T)?N=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[T]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,T,N,H,z,X=0;X<e.length;X+=3)if(H=e[X],z=e[X+1],t<H?(i=0,T=1,N="left"):t<z?(i=t-H,T=i+1):(X==e.length-3||t==z&&e[X+3]>t)&&(T=z-H,i=T-1,t>=z&&(N="right")),i!=null){if(r=e[X+2],H==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==z-H)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],N="right";break}return{node:r,start:i,end:T,collapse:N,coverStart:H,coverEnd:z}}function js(e,t){var n=ro;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=no(t.map,n,r),T=i.node,N=i.start,H=i.end,z=i.collapse,X;if(T.nodeType==3){for(var ne=0;ne<4;ne++){for(;N&&Pe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&Pe(t.line.text.charAt(i.coverStart+H));)++H;if(B&&F<9&&N==0&&H==i.coverEnd-i.coverStart?X=T.parentNode.getBoundingClientRect():X=js(m(T,N,H).getClientRects(),r),X.left||X.right||N==0)break;H=N,N=N-1,z="right"}B&&F<11&&(X=Hs(e.display.measure,X))}else{N>0&&(z=r="right");var ue;e.options.lineWrapping&&(ue=T.getClientRects()).length>1?X=ue[r=="right"?ue.length-1:0]:X=T.getBoundingClientRect()}if(B&&F<9&&!N&&(!X||!X.left&&!X.right)){var Te=T.parentNode.getClientRects()[0];Te?X={left:Te.left,right:Te.left+Ln(e.display),top:Te.top,bottom:Te.bottom}:X=ro}for(var ye=X.top-t.rect.top,Re=X.bottom-t.rect.top,Ie=(ye+Re)/2,je=t.view.measure.heights,Ve=0;Ve<je.length-1&&!(Ie<je[Ve]);Ve++);var tt=Ve?je[Ve-1]:0,Xe=je[Ve],rt={left:(z=="right"?X.right:X.left)-t.rect.left,right:(z=="left"?X.left:X.right)-t.rect.left,top:tt,bottom:Xe};return!X.left&&!X.right&&(rt.bogus=!0),e.options.singleCursorHeightPerLine||(rt.rtop=ye,rt.rbottom=Re),rt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(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 io(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 ao(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Ui(e,t,n,r,i){if(!i){var T=ma(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var N=xr(t);if(r=="local"?N+=Fi(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:so());var z=H.left+(r=="window"?0:oo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function pa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Ui(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,T){r=r||nt(e.doc,t.line),i||(i=Cn(e,r));function N(Re,Ie){var je=_r(e,i,Re,Ie?"right":"left",T);return Ie?je.left=je.right:je.right=je.left,Ui(e,r,je,n)}var H=He(r,e.doc.direction),z=t.ch,X=t.sticky;if(z>=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!H)return N(X=="before"?z-1:z,X=="before");function ne(Re,Ie,je){var Ve=H[Ie],tt=Ve.level==1;return N(je?Re-1:Re,tt!=je)}var ue=Ge(H,z,X),Te=We,ye=ne(z,ue,X=="before");return Te!=null&&(ye.other=ne(z,Te,X!="before")),ye}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=Ln(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var T=Ne(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),T=r.first+r.size-1;if(i>T)return ga(r.first+r.size-1,nt(r,T).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var H=Ks(e,N,i,t,n),z=Sn(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!z)return H;var X=z.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,T=Je(function(N){return _r(e,n,N-1).bottom<=r},i,0);return i=Je(function(N){return _r(e,n,N).top>r},T,i),{begin:T,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Ui(e,t,_r(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=xr(t);var T=Cn(e,t),N=ma(t),H=0,z=t.text.length,X=!0,ne=He(t,e.doc.direction);if(ne){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,T,ne,r,i);X=ue.level!=1,H=X?ue.from:ue.to-1,z=X?ue.to:ue.from-1}var Te=null,ye=null,Re=Je(function(lt){var at=_r(e,T,lt);return at.top+=N,at.bottom+=N,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(Te=lt,ye=at),!0):!1},H,z),Ie,je,Ve=!1;if(ye){var tt=r-ye.left<ye.right-r,Xe=tt==X;Re=Te+(Xe?0:1),je=Xe?"after":"before",Ie=tt?ye.left:ye.right}else{!X&&(Re==z||Re==H)&&Re++,je=Re==0?"after":Re==t.text.length?"before":_r(e,T,Re-(X?1:0)).bottom+N<=i==X?"after":"before";var rt=Tr(e,Ne(n,Re,je),"line",t,T);Ie=rt.left,Ve=i<rt.top?-1:i>=rt.bottom?1:0}return Re=Oe(t.text,Re,1),ga(n,Re,je,Ve,r-Ie)}function Gs(e,t,n,r,i,T,N){var H=Je(function(ue){var Te=i[ue],ye=Te.level!=1;return ya(Tr(e,Ne(n,ye?Te.to:Te.from,ye?"before":"after"),"line",t,r),T,N,!0)},0,i.length-1),z=i[H];if(H>0){var X=z.level!=1,ne=Tr(e,Ne(n,X?z.from:z.to,X?"after":"before"),"line",t,r);ya(ne,T,N,!0)&&ne.top>N&&(z=i[H-1])}return z}function zs(e,t,n,r,i,T,N){var H=co(e,t,r,N),z=H.begin,X=H.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ne=null,ue=null,Te=0;Te<i.length;Te++){var ye=i[Te];if(ye.from>=X||ye.to<=z)continue;var Re=ye.level!=1,Ie=_r(e,r,Re?Math.min(X,ye.to)-1:Math.max(z,ye.from)).right,je=Ie<T?T-Ie+1e9:Ie-T;(!ne||ue>je)&&(ne=ye,ue=je)}return ne||(ne=i[i.length-1]),ne.from<z&&(ne={from:z,to:ne.to,level:ne.level}),ne.to>X&&(ne={from:ne.from,to:X,level:ne.level}),ne}var an;function An(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}l(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Ln(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,N=0;T;T=T.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=T.offsetLeft+T.clientLeft+i,r[H]=T.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=An(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ln(e.display)-3);return function(i){if(Lr(e.doc,i))return 0;var T=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(T+=i.widgets[N].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Zt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&ce(t).getAttribute("cm-not-content")=="true")return null;var T,N,H=i.lineSpace.getBoundingClientRect();try{T=t.clientX-H.left,N=t.clientY-H.top}catch(ue){return null}var z=va(e,T,N),X;if(r&&z.xRel>0&&(X=nt(e.doc,z.line).text).length==z.ch){var ne=K(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((T-qa(e.display).left)/Ln(e.display))-ne))}return z}function sn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;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)$t&&Zn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var T=Ni(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var H=Ni(e,t,t,-1),z=Ni(e,n,n+r,1);H&&z?(i.view=i.view.slice(0,H.index).concat(er(e,H.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.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 T=r.view[sn(e,t)];if(T.node==null)return;var N=T.changes||(T.changes=[]);q(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),T,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,z=0;z<i;z++)H+=N[z].size;if(H!=t){if(r>0){if(i==N.length-1)return null;T=H+N[i].size-t,i++}else T=H-t;t+=T,n+=T}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function mo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var z=H.empty();(z||e.options.showCursorWhenSelecting)&&go(e,H.head,i),z||Xs(e,H,T)}return r}function go(e,t,n){var r=Tr(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 T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),N=qa(e.display),H=N.left,z=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,X=i.direction=="ltr";function ne(Xe,rt,lt,at){rt<0&&(rt=0),rt=Math.round(rt),at=Math.round(at),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Xe+`px;
|
|
top: `+rt+"px; width: "+(lt==null?z-Xe:lt)+`px;
|
|
height: `+(at-rt)+"px"))}function ue(Xe,rt,lt){var at=nt(i,Xe),pt=at.text.length,Dt,Ht;function Ot(Mt,ir){return pa(e,Ne(Xe,Mt),"div",at,ir)}function sr(Mt,ir,zt){var Nt=fo(e,at,null,Mt),It=ir=="ltr"==(zt=="after")?"left":"right",kt=zt=="after"?Nt.begin:Nt.end-(/\s/.test(at.text.charAt(Nt.end-1))?2:1);return Ot(kt,It)[It]}var nr=He(at,i.direction);return Qe(nr,rt||0,lt==null?pt:lt,function(Mt,ir,zt,Nt){var It=zt=="ltr",kt=Ot(Mt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=rt==null&&Mt==0,Jr=lt==null&&ir==pt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-kt.top<=3){var Kt=(X?jn:Jr)&&Yt,Va=(X?Jr:jn)&&Or,jr=Kt?H:(It?kt:ar).left,fn=Va?z:(It?ar:kt).right;ne(jr,kt.top,fn-jr,kt.bottom)}else{var hn,Qt,Wn,Xa;It?(hn=X&&jn&&Yt?H:kt.left,Qt=X?z:sr(Mt,zt,"before"),Wn=X?H:sr(ir,zt,"after"),Xa=X&&Jr&&Or?z:ar.right):(hn=X?sr(Mt,zt,"before"):H,Qt=!X&&jn&&Yt?z:kt.right,Wn=!X&&Jr&&Or?H:ar.left,Xa=X?sr(ir,zt,"after"):z),ne(hn,kt.top,Qt-hn,kt.bottom),kt.bottom<ar.top&&ne(H,kt.bottom,null,ar.top),ne(Wn,ar.top,Xa-Wn,ar.bottom)}(!Dt||Bi(kt,Dt)<0)&&(Dt=kt),Bi(ar,Dt)<0&&(Dt=ar),(!Ht||Bi(kt,Ht)<0)&&(Ht=kt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Dt,end:Ht}}var Te=t.from(),ye=t.to();if(Te.line==ye.line)ue(Te.line,Te.ch,ye.ch);else{var Re=nt(i,Te.line),Ie=nt(i,ye.line),je=ur(Re)==ur(Ie),Ve=ue(Te.line,Te.ch,je?Re.text.length+1:null).end,tt=ue(ye.line,je?0:null,ye.ch).start;je&&(Ve.top<tt.top-2?(ne(Ve.right,Ve.top,null,Ve.bottom),ne(H,tt.top,tt.left,tt.bottom)):ne(Ve.right,Ve.top,tt.left-Ve.right,Ve.bottom)),Ve.bottom<tt.top&&ne(H,Ve.bottom,null,tt.top)}n.appendChild(T)}function Ta(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()||Dn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(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(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(B&&F<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var X=i.node.getBoundingClientRect();N=X.bottom-X.top,!T&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ne=i.line.height-N;if((ne>.005||ne<-.005)&&(Zt(i.line,N),bo(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)bo(i.rest[ue]);if(H>e.display.sizerWidth){var Te=Math.ceil(H/Ln(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(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 Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=gr(t,r),N=gr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,z=n.ensure.to.line;H<T?(T=H,N=gr(t,xr(nt(t,H))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(T=gr(t,xr(nt(t,z))-e.wrapper.clientHeight),N=z)}return{from:T,to:Math.max(N,T+1)}}function Ys(e,t){if(Fe(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&&!w){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var N=!1,H=Tr(e,t),z=!n||n==t?H:Tr(e,n);i={left:Math.min(H.left,z.left),top:Math.min(H.top,z.top)-r,right:Math.max(H.left,z.left),bottom:Math.max(H.bottom,z.bottom)+r};var X=wa(e,i),ne=e.doc.scrollTop,ue=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-ne)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=fa(e),N={};t.bottom-t.top>T&&(t.bottom=t.top+T);var H=e.doc.height+ca(n),z=t.top<r,X=t.bottom>H-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+T){var ne=Math.min(t.top,(X?H:t.bottom)-T);ne!=i&&(N.scrollTop=ne)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,ye=nn(e)-n.gutters.offsetWidth,Re=t.right-t.left>ye;return Re&&(t.right=t.left+ye),t.left<10?N.scrollLeft=0:t.left<Te?N.scrollLeft=Math.max(0,t.left+ue-(Re?0:10)):t.right>ye+Te-3&&(N.scrollLeft=t.right+(Re?0:10)-ye),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _n(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),xo(e,t,!0),L&&La(e),di(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ln(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=u&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&Rs(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 T=0;T<t.length;T++)nl(t[T]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(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 Ki(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&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Dr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var T=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(T)for(var H=0;H<T.length;++H)T[H].lines.length||De(T[H],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&De(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&De(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function or(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,_(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var N=T.styles,H=T.text.length>e.options.maxHighlightLength?Ar(t.mode,r.state):null,z=zn(e,T,r,!0);H&&(r.state=H),T.styles=z.styles;var X=T.styleClasses,ne=z.classes;ne?T.styleClasses=ne:X&&(T.styleClasses=null);for(var ue=!N||N.length!=T.styles.length||X!=ne&&(!X||!ne||X.bgClass!=ne.bgClass||X.textClass!=ne.textClass),Te=0;!ue&&Te<N.length;++Te)ue=N[Te]!=T.styles[Te];ue&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Vn(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&or(e,function(){for(var T=0;T<i.length;T++)Kr(e,i[T],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)De.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=Dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 Gr(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&&mo(e)==0)return!1;Lo(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(T=Zn(e.doc,T),N=Hr(e.doc,N));var H=T!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=mo(e);if(!H&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Aa(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),_a(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 Ki(e,t);if(Aa(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),On(e,r),_a(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,N=T.firstChild;function H(Re){var Ie=Re.nextSibling;return M&&u&&e.display.currentWheelTarget==Re?Re.style.display="none":Re.parentNode.removeChild(Re),Ie}for(var z=r.view,X=r.viewFrom,ne=0;ne<z.length;ne++){var ue=z[ne];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=T){var Te=Fs(e,ue,X,n);T.insertBefore(Te,N)}else{for(;N!=ue.node;)N=H(N);var ye=i&&t!=null&&t<=X&&ue.lineNumber;ue.changes&&(q(ue.changes,"gutter")>-1&&(ye=!1),Ya(e,ue,X,n)),ye&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(pn(e.options,X)))),N=ue.node.nextSibling}X+=ue.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Dr(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=T),n[N].gutterBackground&&(n[N].gutterBackground.style.left=T));var H=n[N].alignable;if(H)for(var z=0;z<H.length;z++)H[z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(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")),T=i.firstChild.offsetWidth,N=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],N=null;if(typeof T!="string"&&(N=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(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],T=i.className,N=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+T));N&&(H.style.cssText=N),T=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ci(e){Do(e.display),tr(e),Ao(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=g("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=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],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&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!M&&!(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=Oa(r.gutters,r.lineNumbers),Do(i),n.init(i)}var Gi=0,dr=null;B?dr=-.53:L?dr=15:y?dr=-.7:O&&(dr=-1/3);function _o(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=_o(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=_o(t),r=n.x,i=n.y,T=e.display,N=T.scroller,H=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&z))return;if(i&&u&&M){e:for(var X=t.target,ne=T.view;X!=N;X=X.parentNode)for(var ue=0;ue<ne.length;ue++)if(ne[ue].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!S&&dr!=null){i&&z&&si(e,Math.max(0,N.scrollTop+i*dr)),ln(e,Math.max(0,N.scrollLeft+r*dr)),(!i||i&&z)&&J(t),T.wheelStartX=null;return}if(i&&dr!=null){var Te=i*dr,ye=e.doc.scrollTop,Re=ye+T.wrapper.clientHeight;Te<0?ye=Math.max(0,ye+Te-50):Re=Math.min(e.doc.height,Re+Te+50),La(e,{top:ye,bottom:Re})}Gi<20&&(T.wheelStartX==null?(T.wheelStartX=N.scrollLeft,T.wheelStartY=N.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var Ie=N.scrollLeft-T.wheelStartX,je=N.scrollTop-T.wheelStartY,Ve=je&&T.wheelDY&&je/T.wheelDY||Ie&&T.wheelDX&&Ie/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Ve)return;dr=(dr*Gi+Ve)/(Gi+1),++Gi},200)):(T.wheelDX+=r,T.wheelDY+=i))}var cr=function(e,t){this.ranges=e,this.primIndex=t};cr.prototype.primary=function(){return this.ranges[this.primIndex]},cr.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(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},cr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new cr(e,this.primIndex)},cr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},cr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Qr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Te,ye){return ct(Te.from(),ye.from())}),n=q(t,i);for(var T=1;T<t.length;T++){var N=t[T],H=t[T-1],z=ct(H.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var X=Qr(H.from(),N.from()),ne=vn(H.to(),N.to()),ue=H.empty()?N.from()==N.head:H.from()==H.head;T<=n&&--n,t.splice(--T,2,new wt(ue?ne:X,ue?X:ne))}}return new cr(t,n)}function zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Ne(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(Ro(i.anchor,t),Ro(i.head,t)))}return Sr(e.cm,n,e.sel.primIndex)}function ko(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),T=i,N=0;N<t.length;N++){var H=t[N],z=ko(H.from,i,T),X=ko(Vr(H),i,T);if(i=H.to,T=X,n=="around"){var ne=e.sel.ranges[N],ue=ct(ne.head,ne.anchor)<0;r[N]=new wt(ue?X:z,ue?z:X)}else r[N]=new wt(z,z)}return new cr(r,e.sel.primIndex)}function ka(e){e.doc.mode=pr(e.options,e.doc.modeOption),fi(e)}function fi(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,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(tt){return n?n[tt]:null}function T(tt,Xe,rt){ua(tt,Xe,rt,r),Gt(tt,"change",tt,t)}function N(tt,Xe){for(var rt=[],lt=tt;lt<Xe;++lt)rt.push(new rn(X[lt],i(lt),r));return rt}var H=t.from,z=t.to,X=t.text,ne=nt(e,H.line),ue=nt(e,z.line),Te=$(X),ye=i(X.length-1),Re=z.line-H.line;if(t.full)e.insert(0,N(0,X.length)),e.remove(X.length,e.size-X.length);else if(Po(e,t)){var Ie=N(0,X.length-1);T(ue,ue.text,ye),Re&&e.remove(H.line,Re),Ie.length&&e.insert(H.line,Ie)}else if(ne==ue)if(X.length==1)T(ne,ne.text.slice(0,H.ch)+Te+ne.text.slice(z.ch),ye);else{var je=N(1,X.length-1);je.push(new rn(Te+ne.text.slice(z.ch),ye,r)),T(ne,ne.text.slice(0,H.ch)+X[0],i(0)),e.insert(H.line+1,je)}else if(X.length==1)T(ne,ne.text.slice(0,H.ch)+X[0]+ue.text.slice(z.ch),i(0)),e.remove(H.line+1,Re);else{T(ne,ne.text.slice(0,H.ch)+X[0],i(0)),T(ue,Te+ue.text.slice(z.ch),ye);var Ve=N(1,X.length-1);Re>1&&e.remove(H.line+1,Re-1),e.insert(H.line+1,Ve)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,T,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var z=i.linked[H];if(z.doc==T)continue;var X=N&&z.sharedHist;if(n&&!X)continue;t(z.doc,X),r(z.doc,i,X)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),ka(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?U:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){or(e,function(){Io(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:gn(t.from),to:Vr(t),text:kr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Fo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Fo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))H=$(N.changes),ct(t.from,t.to)==0&&ct(t.from,H.to)==0?H.to=Vr(t):N.changes.push(Ma(e,t));else{var z=$(i.done);for((!z||!z.ranges)&&Vi(e.sel,i.done),N={changes:[Ma(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||De(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,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=N.markedSpans),++T})}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 Bo(e,t){var n=yl(e,t),r=En(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],N=r[i];if(T&&N){e:for(var H=0;H<N.length;++H){for(var z=N[H],X=0;X<T.length;++X)if(T[X].marker==z.marker)continue e;T.push(z)}}else N&&(n[i]=N)}return n}function Rn(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?cr.prototype.deepCopy.call(T):T);continue}var N=T.changes,H=[];r.push({changes:H});for(var z=0;z<N.length;++z){var X=N[z],ne=void 0;if(H.push({from:X.from,to:X.to,text:X.text}),t)for(var ue in X)(ne=ue.match(/^spans_(\d+)$/))&&(q(t,Number(ne[1]))>-1&&($(H)[ue]=X[ue],delete X[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var T=ct(t,i)<0;T!=ct(n,i)<0?(i=t,t=n):T!=ct(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,i);var N=Sr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,Sr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new wt(ht(e,i[T].anchor),ht(e,i[T].head))},origin:n&&n.origin};return De(e,"beforeSelectionChange",e,r),e.cm&&De(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Sr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&_n(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,he(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var N=t.ranges[T],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],z=$i(e,N.anchor,H&&H.anchor,n,r),X=$i(e,N.head,H&&H.head,n,r);(i||z!=N.anchor||X!=N.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new wt(z,X))}return i?Sr(e.cm,i,t.primIndex):t}function kn(e,t,n,r,i){var T=nt(e,t.line);if(T.markedSpans)for(var N=0;N<T.markedSpans.length;++N){var H=T.markedSpans[N],z=H.marker,X="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ne="selectRight"in z?!z.selectRight:z.inclusiveRight;if((H.from==null||(X?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ne?H.to>=t.ch:H.to>t.ch))){if(i&&(De(z,"beforeCursorEnter"),z.explicitlyCleared))if(T.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var ue=z.find(r<0?1:-1),Te=void 0;if((r<0?ne:X)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?T:null)),ue&&ue.line==t.line&&(Te=ct(ue,n))&&(r<0?Te<0:Te>0))return kn(e,ue,t,r,i)}var ye=z.find(r<0?-1:1);return(r<0?X:ne)&&(ye=Vo(e,ye,r,ye.line==t.line?T:null)),ye?kn(e,ye,t,r,i):null}}return t}function $i(e,t,n,r,i){var T=r||1,N=kn(e,t,n,T,i)||!i&&kn(e,t,n,T,!0)||kn(e,t,n,-T,i)||!i&&kn(e,t,n,-T,!0);return N||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Ne(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Xo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ve)}function Yo(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,T,N,H){i&&(r.from=ht(e,i)),T&&(r.to=ht(e,T)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),De(e,"beforeChange",e,r),e.cm&&De(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 Pn(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,Pn)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&ki(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ra(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,T){!T&&q(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,N=e.sel,H=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X<H.length&&!(T=H[X],n?T.ranges&&!T.equals(e.sel):!T.ranges);X++);if(X==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=H.pop(),T.ranges){if(Vi(T,z),n&&!T.equals(e.sel)){Xt(e,T,{clearRedo:!1});return}N=T}else if(r){H.push(T);return}else break;var ne=[];Vi(N,z),z.push({changes:ne,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var ue=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),Te=function(Ie){var je=T.changes[Ie];if(je.origin=t,ue&&!Yo(e,je,!1))return H.length=0,{};ne.push(Ma(e,je));var Ve=Ie?Ra(e,je):$(H);hi(e,je,Ve,Bo(e,je)),!Ie&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Vr(je)});var tt=[];Xr(e,function(Xe,rt){!rt&&q(tt,Xe.history)==-1&&(qo(Xe.history,je),tt.push(Xe.history)),hi(Xe,je,null,Bo(Xe,je))})},ye=T.changes.length-1;ye>=0;--ye){var Re=Te(ye);if(Re)return Re.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ie(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Jo(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);Jo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ne(T,nt(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=kr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,N=t.to,H=!1,z=T.line;e.options.lineWrapping||(z=Tt(ur(nt(r,T.line))),r.iter(z,N.line+1,function(ye){if(ye==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&he(e),Pa(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(z,T.line+t.text.length,function(ye){var Re=ei(ye);Re>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Re,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),di(e,400);var X=t.text.length-(N.line-T.line)-1;t.full?tr(e):T.line==N.line&&t.text.length==1&&!Po(e.doc,t)?Kr(e,T.line,"text"):tr(e,T.line,N.line+1,X);var ne=le(e,"changes"),ue=le(e,"change");if(ue||ne){var Te={from:T,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&Gt(e,"change",e,Te),ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function Mn(e,t,n,r,i){var T;r||(r=n),ct(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Pn(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],N=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var H=0;H<T.ranges.length;H++)Qo(T.ranges[H].anchor,t,n,r),Qo(T.ranges[H].head,t,n,r);continue}for(var z=0;z<T.changes.length;++z){var X=T.changes[z];if(n<X.from.line)X.from=Ne(X.from.line+r,X.from.ch),X.to=Ne(X.to.line+r,X.to.ch);else if(t<=X.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function mi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=nt(e,yn(e,t)):i=Tt(t),i==null?null:(r(T,i)&&e.cm&&Kr(e.cm,i,n),T)}function pi(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}pi.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,it(i),Gt(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 gi(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}gi.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 T=Math.min(t,i-e),N=r.height;if(r.removeInner(e,T),this.height-=N-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var H=[];this.collapse(H),this.children=[new pi(H)],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],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var z=new pi(i.lines.slice(H,H+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(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],T=i.chunkSize();if(e<T){var N=Math.min(t,T-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=T}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Tt(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 T=ni(this);Zt(n,Math.max(0,n.height-T)),e&&(or(e,function(){es(e,n,-T),Kr(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Lr(this.doc,r)||Zt(r,r.height+i),n&&or(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,Tt(r))})},de(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),mi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,T&&!Lr(e,N)){var z=xr(N)<e.scrollTop;Zt(N,N.height+ni(i)),z&&Ca(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&Gt(T,"lineWidgetAdded",T,i,typeof t=="number"?t:Tt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),le(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var N=this.lines[T],H=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,Tt(N),"text"):e&&(H.to!=null&&(i=Tt(N)),H.from!=null&&(r=Tt(N))),N.markedSpans=Qn(N.markedSpans,H),H.from==null&&this.collapsed&&!Lr(this.doc,N)&&e&&Zt(N,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var X=ur(this.lines[z]),ne=ei(X);ne>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ne,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],N=Er(T.markedSpans,this);if(N.from!=null&&(n=Ne(t?T:Tt(T),N.from),e==-1))return n;if(N.to!=null&&(r=Ne(t?T:Tt(T),N.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;or(r,function(){var i=t.line,T=Tt(t.line),N=ha(r,T);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Lr(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var z=ni(n)-H;z&&Zt(i,i.height+z)}Gt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},de(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var T=new Yr(e,i),N=ct(t,n);if(r&&k(r,T,!1),N>0||N==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=g("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Pi(e,t.line,t,n,T)||t.line!=n.line&&Pi(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,z=e.cm,X;if(e.iter(H,n.line+1,function(ue){z&&T.collapsed&&!z.options.lineWrapping&&ur(ue)==z.display.maxLine&&(X=!0),T.collapsed&&H!=t.line&&Zt(ue,0),sa(ue,new qr(T,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),T.collapsed&&e.iter(t.line,n.line+1,function(ue){Lr(e,ue)&&Zt(ue,0)}),T.clearOnEnter&&Se(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),T.collapsed)tr(z,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ne=t.line;ne<=n.line;ne++)Kr(z,ne,"text");T.atomic&&Go(z.doc),Gt(z,"markerAdded",z,T)}return T}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},de(yi);function Tl(e,t,n,r,i){r=k(r),r.shared=!1;var T=[In(e,t,n,r,i)],N=T[0],H=r.widgetNode;return Xr(e,function(z){H&&(r.widgetNode=H.cloneNode(!0)),T.push(In(z,ht(z,t),ht(z,n),r,i));for(var X=0;X<z.linked.length;++X)if(z.linked[X].isParent)return;N=$(T)}),new yi(T,N)}function rs(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(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(),T=e.clipPos(i.from),N=e.clipPos(i.to);if(ct(T,N)){var H=In(e,T,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];Xr(i.primary.doc,function(z){return T.push(z)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];q(T,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,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),gi.call(this,[new pi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=Ne(n,0);this.sel=zr(T),this.history=new zi(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)),Pa(this,{from:T,to:T,text:e}),Xt(this,zr(T),ve)};rr.prototype=Le(gi.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=mn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;Pn(this,{from:t,to:Ne(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(t),ve)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,Mn(this,e,t,n,r)},getRange:function(e,t,n){var r=kr(this,ht(this,e),ht(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(Pr(this,e))return nt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),ur(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(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:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Be(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ie(this.sel.ranges,e);jo(this,Be(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,Sr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ht(this,e),ht(this,t||e))),Xt(this,Sr(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=kr(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=kr(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:Wt(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var N=i.ranges[T];r[T]={from:N.from(),to:N.to(),text:this.splitLines(e[T]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Pn(this,r[z]);H?Ho(this,H):this.cm&&_n(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.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 zi(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:Rn(this.history.done),undone:Rn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=Rn(e.done.slice(0),null,!0),t.undone=Rn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return mi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ke(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Pr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=Tt(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:Wt(function(e,t,n){return mi(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(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var N=T.match(b(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=T.slice(0,N.index)+(!N.index||H==T.length?"":" ")+T.slice(H)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ht(this,e),ht(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=ht(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(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=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var N=T.markedSpans;if(N)for(var H=0;H<N.length;H++){var z=N[H];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;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 T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),ht(this,Ne(n,t))},indexFromPos:function(e){e=ht(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(mn(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(mn(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,rs(this)),r},unlinkDoc:function(e){if(e instanceof _t&&(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(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=Rn(this.history.done,r),e.history.undone=Rn(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):dt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wt(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 ns=0;function Al(e){var t=this;if(is(t),Fe(t,e)||Nr(t.display,e))return;J(e),B&&(ns=+new Date);var n=on(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,T=Array(i),N=0,H=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(T.filter(function(Re){return Re!=null}).join(t.doc.lineSeparator())),origin:"paste"};Pn(t.doc,ye),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(ye))))})()},z=function(ye,Re){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,ye.type)==-1){H();return}var Ie=new FileReader;Ie.onerror=function(){return H()},Ie.onload=function(){var je=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){H();return}T[Re]=je,H()},Ie.readAsText(ye)},X=0;X<r.length;X++)z(r[X],X);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 ne=e.dataTransfer.getData("Text");if(ne){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Yi(t.doc,zr(n,n)),ue)for(var Te=0;Te<ue.length;++Te)Mn(t.doc,"",ue[Te].anchor,ue[Te].head,"drag");t.replaceSelection(ne,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Fe(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),S&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(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)),l(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(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 T=0;T<n.length;T++)e(n[T])})}var os=!1;function _l(){if(os)return;Ol(),os=!0}function Ol(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Se(window,"blur",function(){return as(Dn)})}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"},bi=0;bi<10;bi++)$r[bi+48]=$r[bi+96]=String(bi);for(var Qi=65;Qi<=90;Qi++)$r[Qi]=String.fromCharCode(Qi);for(var Ei=1;Ei<=12;Ei++)$r[Ei+111]=$r[Ei+63235]="F"+Ei;var Br={};Br.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"},Br.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"},Br.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"},Br.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"]},Br.default=u?Br.macDefault:Br.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))T=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(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(" "),kl),T=0;T<i.length;T++){var N=void 0,H=void 0;T==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,T+1).join(" "),N="...");var z=t[H];if(!z)t[H]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Fn(e,t,n,r){t=Zi(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 Fn(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var N=Fn(e,t.fallthrough[T],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(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 us(e,t){if(S&&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),ls(n,e,t))}function Zi(e){return typeof e=="string"?Br[e]:e}function Un(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&ct(T.from,$(r).to)<=0;){var N=r.pop();if(ct(N.from,T.from)<0){T.from=N.from;break}}r.push(T)}or(e,function(){for(var H=r.length-1;H>=0;H--)Mn(e.doc,"",r[H].from,r[H].to,"+delete");_n(e)})}function Ua(e,t,n){var r=Oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=He(n,t.doc.direction);if(T){var N=i<0?$(T):T[0],H=i<0==(N.level==1),z=H?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var ne=Cn(t,n);X=i<0?n.text.length-1:0;var ue=_r(t,ne,X).top;X=Je(function(Te){return _r(t,ne,Te).top==ue},i<0==(N.level==1)?N.from:N.to-1,X),z=="before"&&(X=Ua(n,X,1))}else X=i<0?N.to:N.from;return new Ne(r,X,z)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=He(t,e.doc.direction);if(!i)return Na(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var T=Ge(i,n.ch,n.sticky),N=i[T];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Na(t,n,r);var H=function(Ve,tt){return Ua(t,Ve instanceof Ne?Ve.ch:Ve,tt)},z,X=function(Ve){return e.options.lineWrapping?(z=z||Cn(e,t),fo(e,t,z,Ve)):{begin:0,end:t.text.length}},ne=X(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ue=N.level==1==r<0,Te=H(n,ue?1:-1);if(Te!=null&&(ue?Te<=N.to&&Te<=ne.end:Te>=N.from&&Te>=ne.begin)){var ye=ue?"before":"after";return new Ne(n.line,Te,ye)}}var Re=function(Ve,tt,Xe){for(var rt=function(Dt,Ht){return Ht?new Ne(n.line,H(Dt,1),"before"):new Ne(n.line,Dt,"after")};Ve>=0&&Ve<i.length;Ve+=tt){var lt=i[Ve],at=tt>0==(lt.level!=1),pt=at?Xe.begin:H(Xe.end,-1);if(lt.from<=pt&&pt<lt.to)return rt(pt,at);if(pt=at?lt.from:H(lt.to,-1),Xe.begin<=pt&&pt<Xe.end)return rt(pt,at)}},Ie=Re(T+r,r,ne);if(Ie)return Ie;var je=r>0?ne.end:H(ne.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ie=Re(r>0?0:i.length-1,r,X(je)),Ie)?Ie:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Un(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Un(e,function(t){return{from:Ne(t.from().line,0),to:ht(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Un(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Un(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 Un(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(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(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")},fe)},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")},fe)},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/)?cs(e,t.head):r},fe)},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 T=n[i].from(),N=K(e.getLine(T.line),T.ch,r);t.push(pe(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return or(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=nt(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Ne(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ne(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);_n(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=ur(n);return r!=n&&(t=Tt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=Mi(n);return r!=n&&(t=Tt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=He(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=T&&t.ch;return Ne(n.line,N?0:T,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=xi[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)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Ul=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(J(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Nl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),Fe(t,e))return;B&&F<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);S&&(ja=r?n:null,!r&&n==88&&!Ct&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!u&&!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)&&(h(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(S&&n==ja){ja=null,J(e);return}if(S&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ct(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){M||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=Ae(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?Gl(t,r,T,e):ce(e)==n.scroller&&J(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Ti(e,ls(T,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=Ee}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(_(vo,e),0):e.curOp.focus=P();var i=Kl(e,n,r),T=e.doc.sel,N;e.options.dragDrop&&we&&!e.isReadOnly()&&n=="single"&&(N=T.contains(t))>-1&&(ct((N=T.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,T=!1,N=jt(e,function(X){M&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",N),Ye(i.wrapper.ownerDocument,"mousemove",H),Ye(i.scroller,"dragstart",z),Ye(i.scroller,"drop",N),T||(J(X),r.addNew||Xi(e.doc,n,null,null,r.extend),M&&!O||B&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(X){T=T||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return T=!0};M&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",N),Se(i.wrapper.ownerDocument,"mousemove",H),Se(i.scroller,"dragstart",z),Se(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ht(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;J(t);var N,H,z=T.sel,X=z.ranges;if(r.addNew&&!r.extend?(H=T.sel.contains(n),H>-1?N=X[H]:N=new wt(n,n)):(N=T.sel.primary(),H=T.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=on(e,t,!0,!0),H=-1;else{var ne=ys(e,n,r.unit);r.extend?N=Ia(N,ne.anchor,ne.head,r.extend):N=ne}r.addNew?H==-1?(H=X.length,Xt(T,Sr(e,X.concat([N]),H),{scroll:!1,origin:"*mouse"})):X.length>1&&X[H].empty()&&r.unit=="char"&&!r.extend?(Xt(T,Sr(e,X.slice(0,H).concat(X.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),z=T.sel):Fa(T,H,N,ge):(H=0,Xt(T,new cr([N],0),ge),z=T.sel);var ue=n;function Te(Xe){if(ct(ue,Xe)==0)return;if(ue=Xe,r.unit=="rectangle"){for(var rt=[],lt=e.options.tabSize,at=K(nt(T,n.line).text,n.ch,lt),pt=K(nt(T,Xe.line).text,Xe.ch,lt),Dt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Xe.line),sr=Math.min(e.lastLine(),Math.max(n.line,Xe.line));Ot<=sr;Ot++){var nr=nt(T,Ot).text,Mt=me(nr,Dt,lt);Dt==Ht?rt.push(new wt(Ne(Ot,Mt),Ne(Ot,Mt))):nr.length>Mt&&rt.push(new wt(Ne(Ot,Mt),Ne(Ot,me(nr,Ht,lt))))}rt.length||rt.push(new wt(n,n)),Xt(T,Sr(e,z.ranges.slice(0,H).concat(rt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Xe)}else{var ir=N,zt=ys(e,Xe,r.unit),Nt=ir.anchor,It;ct(zt.anchor,Nt)>0?(It=zt.head,Nt=Qr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.head));var kt=z.ranges.slice(0);kt[H]=Xl(e,new wt(ht(T,Nt),It)),Xt(T,Sr(e,kt,H),ge)}}var ye=i.wrapper.getBoundingClientRect(),Re=0;function Ie(Xe){var rt=++Re,lt=on(e,Xe,!0,r.unit=="rectangle");if(!lt)return;if(ct(lt,ue)!=0){e.curOp.focus=P(),Te(lt);var at=Wi(i,T);(lt.line>=at.to||lt.line<at.from)&&setTimeout(jt(e,function(){Re==rt&&Ie(Xe)}),150)}else{var pt=Xe.clientY<ye.top?-20:Xe.clientY>ye.bottom?20:0;pt&&setTimeout(jt(e,function(){if(Re!=rt)return;i.scroller.scrollTop+=pt,Ie(Xe)}),50)}}function je(Xe){e.state.selectingText=!1,Re=Infinity,Xe&&(J(Xe),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",Ve),Ye(i.wrapper.ownerDocument,"mouseup",tt),T.history.lastSelOrigin=null}var Ve=jt(e,function(Xe){Xe.buttons===0||!Ae(Xe)?je(Xe):Ie(Xe)}),tt=jt(e,je);e.state.selectingText=tt,Se(i.wrapper.ownerDocument,"mousemove",Ve),Se(i.wrapper.ownerDocument,"mouseup",tt)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var T=He(i);if(!T)return t;var N=Ge(T,n.ch,n.sticky),H=T[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var z=N+(H.from==n.ch==(H.level!=1)?0:1);if(z==0||z==T.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ne=Ge(T,r.ch,r.sticky),ue=ne-N||(r.ch-n.ch)*(H.level==1?-1:1);ne==z-1||ne==z?X=ue<0:X=ue>0}var Te=T[z+(X?-1:0)],ye=X==(Te.level==1),Re=ye?Te.from:Te.to,Ie=ye?"after":"before";return n.ch==Re&&n.sticky==Ie?t:new wt(new Ne(n.line,Re,Ie),r)}function bs(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&J(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(T>H.bottom||!le(e,n))return ee(t);T-=H.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var X=N.gutters.childNodes[z];if(X&&X.getBoundingClientRect().right>=i){var ne=gr(e.doc,T),ue=e.display.gutterSpecs[z];return De(e,n,e,ne,ue.className,t),ee(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,T,N){e.defaults[r]=i,T&&(t[r]=N?function(H,z,X){X!=Nn&&T(H,z,X)}:T)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,ka(r)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],N=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var ne=z.text.indexOf(i,X);if(ne==-1)break;X=ne+i.length,T.push(Ne(N,ne))}N++});for(var H=T.length-1;H>=0;H--)Mn(r.doc,i,T[H],Ne(T[H].line,T[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=Nn&&r.refresh()}),n("specialCharPlaceholder",Lt,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",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,T){var N=Zi(i),H=T!=Nn&&Zi(T);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Dn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,fi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,T=t?Se:Ye;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function _t(e,t){var n=this;if(!(this instanceof _t))return new _t(e,t);this.options=t=t?k(t):{},k(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _t.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),B&&F<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),dn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Dn(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Lo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ka.length;++H)Ka[H](this);cn(this),M&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}_t.defaults=Ts,_t.optionHandlers=ea;function Zl(e){var t=e.display;Se(t.scroller,"mousedown",jt(e,vs)),B&&F<11?Se(t.scroller,"dblclick",jt(e,function(z){if(Fe(e,z))return;var X=on(e,z);if(!X||Ha(e,z)||Nr(e.display,z))return;J(z);var ne=e.findWordAt(X);Xi(e.doc,ne.anchor,ne.head)})):Se(t.scroller,"dblclick",function(z){return Fe(e,z)||J(z)}),Se(t.scroller,"contextmenu",function(z){return Es(e,z)}),Se(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||Es(e,z)});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 T(z){if(z.touches.length!=1)return!1;var X=z.touches[0];return X.radiusX<=1&&X.radiusY<=1}function N(z,X){if(X.left==null)return!0;var ne=X.left-z.left,ue=X.top-z.top;return ne*ne+ue*ue>20*20}Se(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!T(z)&&!Ha(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Nr(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ne=e.coordsChar(t.activeTouch,"page"),ue;!X.prev||N(X,X.prev)?ue=new wt(ne,ne):!X.prev.prev||N(X,X.prev.prev)?ue=e.findWordAt(ne):ue=new wt(Ne(ne.line,0),ht(e.doc,Ne(ne.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),J(z)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(z){return Oo(e,z)}),Se(t.scroller,"DOMMouseScroll",function(z){return Oo(e,z)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||se(z)},over:function(z){Fe(e,z)||(Dl(e,z),se(z))},start:function(z){return Ll(e,z)},drop:jt(e,Al),leave:function(z){Fe(e,z)||is(e)}};var H=t.input.getField();Se(H,"keyup",function(z){return ps.call(e,z)}),Se(H,"keydown",jt(e,ms)),Se(H,"keypress",jt(e,gs)),Se(H,"focus",function(z){return Sa(e,z)}),Se(H,"blur",function(z){return Dn(e,z)})}var Ka=[];_t.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=vr(e,t).state:n="prev");var N=e.options.tabSize,H=nt(i,t),z=K(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var X=H.text.match(/^\s*/)[0],ne;if(!r&&!/\S/.test(H.text))ne=0,n="not";else if(n=="smart"&&(ne=i.mode.indent(T,H.text.slice(X.length),H.text),ne==Ee||ne>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ne=K(nt(i,t-1).text,null,N):ne=0:n=="add"?ne=z+e.options.indentUnit:n=="subtract"?ne=z-e.options.indentUnit:typeof n=="number"&&(ne=z+n),ne=Math.max(0,ne);var ue="",Te=0;if(e.options.indentWithTabs)for(var ye=Math.floor(ne/N);ye;--ye)Te+=N,ue+=" ";if(Te<ne&&(ue+=pe(ne-Te)),ue!=X)return Mn(i,ue,Ne(t,0),Ne(t,X.length),"+input"),H.stateAfter=null,!0;for(var Re=0;Re<i.sel.ranges.length;Re++){var Ie=i.sel.ranges[Re];if(Ie.head.line==t&&Ie.head.ch<X.length){var je=Ne(t,X.length);Fa(i,Re,new wt(je,je));break}}}var wr=null;function ta(e){wr=e}function Ga(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,z=dt(t),X=null;if(H&&r.ranges.length>1)if(wr&&wr.text.join(`
|
|
`)==t){if(r.ranges.length%wr.text.length==0){X=[];for(var ne=0;ne<wr.text.length;ne++)X.push(T.splitLines(wr.text[ne]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ie(z,function(Ve){return[Ve]}));for(var ue=e.curOp.updateInput,Te=r.ranges.length-1;Te>=0;Te--){var ye=r.ranges[Te],Re=ye.from(),Ie=ye.to();ye.empty()&&(n&&n>0?Re=Ne(Re.line,Re.ch-n):e.state.overwrite&&!H?Ie=Ne(Ie.line,Math.min(nt(T,Ie.line).text.length,Ie.ch+$(z).length)):H&&wr&&wr.lineWise&&wr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Re=Ie=Ne(Re.line,0)));var je={from:Re,to:Ie,text:X?X[Te%X.length]:z,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};Pn(e.doc,je),Gt(e,"inputRead",e,je)}t&&!H&&ws(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var T=e.getModeAt(i.head),N=!1;if(T.electricChars){for(var H=0;H<T.electricChars.length;H++)if(t.indexOf(T.electricChars.charAt(H))>-1){N=Ci(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){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 M?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),As(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 T=this.options,N=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),De(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"](Zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:Jt(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var N=i[T].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(T,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Pr(this.doc,r)&&Ci(this,r,i,T)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,T=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>T&&(Ci(this,H.head.line,r,!0),T=H.head.line,N==this.doc.sel.primIndex&&_n(this));else{var z=H.from(),X=H.to(),ne=Math.max(T,z.line);T=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var ue=ne;ue<T;++ue)Ci(this,ue,r);var Te=this.doc.sel.ranges;z.ch==0&&i.length==Te.length&&Te[N].from().ch>0&&Fa(this.doc,N,new wt(z,Te[N].to()),ve)}}}),getTokenAt:function(r,i){return Li(this,r,i)},getLineTokens:function(r,i){return Li(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Zr(this,nt(this.doc,r.line)),T=0,N=(i.length-1)/2,H=r.ch,z;if(H==0)z=i[2];else for(;;){var X=T+N>>1;if((X?i[X*2-1]:0)>=H)N=X;else if(i[X*2+1]<H)T=X+1;else{z=i[X*2+2];break}}var ne=z?z.indexOf("overlay "):-1;return ne<0?z:ne==0?null:z.slice(0,ne-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 T=[];if(!n.hasOwnProperty(i))return T;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&T.push(N[H[i]]);else if(H[i])for(var z=0;z<H[i].length;z++){var X=N[H[i][z]];X&&T.push(X)}else H.helperType&&N[H.helperType]?T.push(N[H.helperType]):N[H.name]&&T.push(N[H.name]);for(var ne=0;ne<N._global.length;ne++){var ue=N._global[ne];ue.pred(H,this)&&q(T,ue.val)==-1&&T.push(ue.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=yn(T,r==null?T.first+T.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var T,N=this.doc.sel.primary();return r==null?T=N.head:typeof r=="object"?T=ht(this.doc,r):T=r?N.from():N.to(),Tr(this,T,i||"page")},charCoords:function(r,i){return pa(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var N=!1,H;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),H=nt(this.doc,r)}else H=r;return Ui(this,H,{top:0,left:0},i||"page",T||N).top+(N?this.doc.height-xr(H):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return Ln(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,N,H){var z=this.display;r=Tr(this,ht(this.doc,r));var X=r.bottom,ne=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var ue=Math.max(z.wrapper.clientHeight,this.doc.height),Te=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(X=r.bottom),ne+i.offsetWidth>Te&&(ne=Te-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",H=="right"?(ne=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ne=0:H=="middle"&&(ne=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ne+"px"),T&&Js(this,{left:ne,top:X,right:ne+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,T,N){var H=1;i<0&&(H=-1,i=-i);for(var z=ht(this.doc,r),X=0;X<i&&!(z=za(this.doc,z,H,T,N),z.hitSide);++X);return z},moveH:Jt(function(r,i){var T=this;this.extendSelectionsBy(function(N){return T.display.shift||T.doc.extend||N.empty()?za(T.doc,N.head,r,i,T.options.rtlMoveVisually):r<0?N.from():N.to()},fe)}),deleteH:Jt(function(r,i){var T=this.doc.sel,N=this.doc;T.somethingSelected()?N.replaceSelection("",null,"+delete"):Un(this,function(H){var z=za(N,H.head,r,i,!1);return r<0?{from:z,to:H.head}:{from:H.head,to:z}})}),findPosV:function(r,i,T,N){var H=1,z=N;i<0&&(H=-1,i=-i);for(var X=ht(this.doc,r),ne=0;ne<i;++ne){var ue=Tr(this,X,"div");if(z==null?z=ue.left:ue.left=z,X=Ds(this,ue,H,T),X.hitSide)break}return X},moveV:Jt(function(r,i){var T=this,N=this.doc,H=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ne){if(z)return r<0?ne.from():ne.to();var ue=Tr(T,ne.head,"div");ne.goalColumn!=null&&(ue.left=ne.goalColumn),H.push(ue.left);var Te=Ds(T,ue,r,i);return i=="page"&&ne==N.sel.primary()&&Ca(T,pa(T,Te,"div").top-ue.top),Te},fe),H.length)for(var X=0;X<N.sel.ranges.length;X++)N.sel.ranges[X].goalColumn=H[X]}),findWordAt:function(r){var i=this.doc,T=nt(i,r.line).text,N=r.ch,H=r.ch;if(T){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||H==T.length)&&N?--N:++H;for(var X=T.charAt(N),ne=_e(X,z)?function(ue){return _e(ue,z)}:/\s/.test(X)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!_e(ue)};N>0&&ne(T.charAt(N-1));)--N;for(;H<T.length&&ne(T.charAt(H));)++H}return new wt(Ne(r.line,N),Ne(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Dr(this)-this.display.barHeight,width:r.scrollWidth-Dr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Jt(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:Ne(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?Qs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var T=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(z){if(z.widgets){for(var X=0;X<z.widgets.length;X++)if(z.widgets[X].noHScroll){Kr(T,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,De(this,"refresh",this)}),operation:function(r){return or(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-An(this.display))>.5||this.options.lineWrapping)&&xa(this),De(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},de(e),e.registerHelper=function(r,i,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,N){e.registerHelper(r,i,N),n[r]._global.push({pred:T,val:N})}}function za(e,t,n,r,i){var T=t,N=n,H=nt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var tt=t.line+z;return tt<e.first||tt>=e.first+e.size?!1:(t=new Ne(tt,t.ch,t.sticky),H=nt(e,tt))}function ne(tt){var Xe;if(r=="codepoint"){var rt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(rt)?Xe=null:Xe=new Ne(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(rt>=55296&&rt<56320?2:1))),-n)}else i?Xe=Ml(e.cm,H,t,n):Xe=Na(H,t,n);if(Xe==null)if(!tt&&X())t=Ba(i,e.cm,H,t.line,z);else return!1;else t=Xe;return!0}if(r=="char"||r=="codepoint")ne();else if(r=="column")ne(!0);else if(r=="word"||r=="group")for(var ue=null,Te=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Re=!0;!(n<0&&!ne(!Re));Re=!1){var Ie=H.text.charAt(t.ch)||`
|
|
`,je=_e(Ie,ye)?"w":Te&&Ie==`
|
|
`?"n":!Te||/\s/.test(Ie)?null:"p";if(Te&&!Re&&!je&&(je="s"),ue&&ue!=je){n<0&&(n=1,ne(),t.sticky="after");break}if(je&&(ue=je),n>0&&!ne(!Re))break}var Ve=$i(e,t,T,N,!0);return Gn(T,Ve)&&(Ve.hitSide=!0),Ve}function Ds(e,t,n,r){var i=e.doc,T=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(H-.5*An(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,T,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var At=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};At.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(H){for(var z=H.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Se(i,"paste",function(H){if(!T(H)||Fe(r,H)||Ss(H,r))return;F<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Se(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Se(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(H){if(!T(H)||Fe(r,H))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Cs(r);ta({lineWise:!0,text:z.text}),H.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var X=wr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",X),H.clipboardData.getData("Text")==X){H.preventDefault();return}}var ne=Ls(),ue=ne.firstChild;r.display.lineSpace.insertBefore(ne,r.display.lineSpace.firstChild),ue.value=wr.text.join(`
|
|
`);var Te=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ne),Te.focus(),Te==i&&n.showPrimarySelection()},50)}Se(i,"copy",N),Se(i,"cut",N)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},At.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},At.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},At.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 T=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&N&&!N.bad&&ct(Qr(T,N),r)==0&&ct(vn(T,N),i)==0)return;var H=t.display.view,z=r.line>=t.display.viewFrom&&_s(t,r)||{node:H[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&_s(t,i);if(!X){var ne=H[H.length-1].measure,ue=ne.maps?ne.maps[ne.maps.length-1]:ne.map;X={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!z||!X){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),ye;try{ye=m(z.node,z.offset,X.offset,X.node)}catch(Re){}ye&&(!L&&t.state.focused?(e.collapse(z.node,z.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),Te&&e.anchorNode==null?e.addRange(Te):L&&this.startGracePeriod()),this.rememberSelection()},At.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)},At.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},At.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},At.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},At.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},At.prototype.blur=function(){this.div.blur()},At.prototype.getField=function(){return this.div},At.prototype.supportsTouch=function(){return!0},At.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():or(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)},At.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},At.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&or(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},At.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=Ne(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,N,H;r.line==t.viewFrom||(T=sn(e,r.line))==0?(N=Tt(t.view[0].line),H=t.view[0].node):(N=Tt(t.view[T].line),H=t.view[T-1].node.nextSibling);var z=sn(e,i.line),X,ne;if(z==t.view.length-1?(X=t.viewTo-1,ne=t.lineDiv.lastChild):(X=Tt(t.view[z+1].line)-1,ne=t.view[z+1].node.previousSibling),!H)return!1;for(var ue=e.doc.splitLines(tu(e,H,ne,N,X)),Te=kr(e.doc,Ne(N,0),Ne(X,nt(e.doc,X).text.length));ue.length>1&&Te.length>1;)if($(ue)==$(Te))ue.pop(),Te.pop(),X--;else if(ue[0]==Te[0])ue.shift(),Te.shift(),N++;else break;for(var ye=0,Re=0,Ie=ue[0],je=Te[0],Ve=Math.min(Ie.length,je.length);ye<Ve&&Ie.charCodeAt(ye)==je.charCodeAt(ye);)++ye;for(var tt=$(ue),Xe=$(Te),rt=Math.min(tt.length-(ue.length==1?ye:0),Xe.length-(Te.length==1?ye:0));Re<rt&&tt.charCodeAt(tt.length-Re-1)==Xe.charCodeAt(Xe.length-Re-1);)++Re;if(ue.length==1&&Te.length==1&&N==r.line)for(;ye&&ye>r.ch&&tt.charCodeAt(tt.length-Re-1)==Xe.charCodeAt(Xe.length-Re-1);)ye--,Re++;ue[ue.length-1]=tt.slice(0,tt.length-Re).replace(/^\u200b+/,""),ue[0]=ue[0].slice(ye).replace(/\u200b+$/,"");var lt=Ne(N,ye),at=Ne(X,Te.length?$(Te).length-Re:0);if(ue.length>1||ue[0]||ct(lt,at))return Mn(e.doc,ue,lt,at,"+input"),!0},At.prototype.ensurePolled=function(){this.forceCompositionEnd()},At.prototype.reset=function(){this.forceCompositionEnd()},At.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},At.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)},At.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&or(this.cm,function(){return tr(e.cm)})},At.prototype.setUneditable=function(e){e.contentEditable="false"},At.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},At.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},At.prototype.onContextMenu=function(){},At.prototype.resetPosition=function(){},At.prototype.needsContentAttribute=!0;function _s(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),T=He(r,e.doc.direction),N="left";if(T){var H=Ge(T,t.ch);N=H%2?"right":"left"}var z=no(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",N=!1,H=e.doc.lineSeparator(),z=!1;function X(ye){return function(Re){return Re.id==ye}}function ne(){N&&(T+=H,z&&(T+=H),N=z=!1)}function ue(ye){ye&&(ne(),T+=ye)}function Te(ye){if(ye.nodeType==1){var Re=ye.getAttribute("cm-text");if(Re){ue(Re);return}var Ie=ye.getAttribute("cm-marker"),je;if(Ie){var Ve=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Ie));Ve.length&&(je=Ve[0].find(0))&&ue(kr(e.doc,je.from,je.to).join(H));return}if(ye.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;tt&&ne();for(var Xe=0;Xe<ye.childNodes.length;Xe++)Te(ye.childNodes[Xe]);/^(pre|p)$/i.test(ye.nodeName)&&(z=!0),tt&&(N=!0)}else ye.nodeType==3&&ue(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==n);)t=t.nextSibling,z=!1;return T}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Ne(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 T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return Bn(Ne(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?$(e.rest):e.line;return Bn(Ne(Tt(T),T.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var z=e.measure,X=z.maps;function ne(je,Ve,tt){for(var Xe=-1;Xe<(X?X.length:0);Xe++)for(var rt=Xe<0?z.map:X[Xe],lt=0;lt<rt.length;lt+=3){var at=rt[lt+2];if(at==je||at==Ve){var pt=Tt(Xe<0?e.line:e.rest[Xe]),Dt=rt[lt]+tt;return(tt<0||at!=je)&&(Dt=rt[lt+(tt?1:0)]),Ne(pt,Dt)}}}var ue=ne(N,H,n);if(ue)return Bn(ue,i);for(var Te=H.nextSibling,ye=N?N.nodeValue.length-n:0;Te;Te=Te.nextSibling){if(ue=ne(Te,Te.firstChild,0),ue)return Bn(Ne(ue.line,ue.ch-ye),i);ye+=Te.textContent.length}for(var Re=H.previousSibling,Ie=n;Re;Re=Re.previousSibling){if(ue=ne(Re,Re.firstChild,-1),ue)return Bn(Ne(ue.line,ue.ch+Ie),i);Ie+=Re.textContent.length}}var Pt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Pt.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"),Se(i,"input",function(){B&&F>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(N){if(Fe(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(N){if(Fe(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Cs(r);ta({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,ve):(n.prevInput="",i.value=H.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",T),Se(i,"copy",T),Se(e.scroller,"paste",function(N){if(Nr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Se(e.lineSpace,"selectstart",function(N){Nr(e,N)||J(N)}),Se(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Pt.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Pt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-T.left))}return r},Pt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Pt.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&&F>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&F>=9&&(this.hasSelection=null))},Pt.prototype.getField=function(){return this.textarea},Pt.prototype.supportsTouch=function(){return!1},Pt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pt.prototype.blur=function(){this.textarea.blur()},Pt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pt.prototype.receivedFocus=function(){this.slowPoll()},Pt.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()})},Pt.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)},Pt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&F>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return or(t,function(){Ga(t,i.slice(N),r.length-N,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},Pt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pt.prototype.onKeyPress=function(){B&&F>=9&&(this.hasSelection=null),this.fastPoll()},Pt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=on(n,e),N=r.scroller.scrollTop;if(!T||S)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(T)==-1&&jt(n,Xt)(n.doc,zr(T),ve);var z=i.style.cssText,X=t.wrapper.style.cssText,ne=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ne.top-5)+"px; left: "+(e.clientX-ne.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;M&&(ue=window.scrollY),r.input.focus(),M&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Te(){if(i.selectionStart!=null){var Ie=n.somethingSelected(),je="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&F<9)&&Te();var Ie=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Ie++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(B&&F>=9&&Te(),A){se(e);var Re=function(){Ye(window,"mouseup",Re),setTimeout(ye,20)};Se(window,"mouseup",Re)}else setTimeout(ye,50)},Pt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pt.prototype.setUneditable=function(){},Pt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?k(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=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var N=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=_t(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return H}function iu(e){e.off=Ye,e.on=Se,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=K,e.findColumn=me,e.isWordChar=Ce,e.Pass=Ee,e.signal=De,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=ct,e.modes=Ft,e.mimeModes=Et,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=Ar,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=Pl,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=J,e.e_stopPropagation=Q,e.e_stop=se,e.addClass=U,e.contains=E,e.rmClass=h,e.keyNames=$r}$l(_t),ql(_t);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&q(au,na)<0&&(_t.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),_t.inputStyles={textarea:Pt,contenteditable:At},_t.defineMode=function(e){!_t.defaults.mode&&e!="null"&&(_t.defaults.mode=e),Cr.apply(this,arguments)},_t.defineMIME=Rr,_t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_t.defineMIME("text/plain","null"),_t.defineExtension=function(e,t){_t.prototype[e]=t},_t.defineDocExtension=function(e,t){rr.prototype[e]=t},_t.fromTextArea=nu,iu(_t),_t.version="5.58.2",_t})},Y1PL:function(ut,qe,te){"use strict";te.r(qe),te.d(qe,"ResizableTextArea",function(){return q});var re=te("wx14"),V=te("1OyB"),L=te("vuIU"),G=te("Ji7U"),I=te("LK+K"),R=te("cDcd"),B=te("VTBJ"),F=te("rePB"),M=te("Zm9Q"),D=te("Kwbf"),y=te("c+Xe"),S=te("m+aA"),O=te("bdgK"),C=new Map;function w(ve){ve.forEach(function(ge){var fe,me=ge.target;(fe=C.get(me))===null||fe===void 0||fe.forEach(function(oe){return oe(me)})})}var v=new O.default(w),d=null,o=null;function u(ve,ge){C.has(ve)||(C.set(ve,new Set),v.observe(ve)),C.get(ve).add(ge)}function s(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(v.unobserve(ve),C.delete(ve)))}var x=function(ve){Object(G.a)(fe,ve);var ge=Object(I.a)(fe);function fe(){return Object(V.a)(this,fe),ge.apply(this,arguments)}return Object(L.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(R.Component),p=R.createContext(null);function f(ve){var ge=ve.children,fe=ve.onBatchResize,me=R.useRef(0),oe=R.useRef([]),pe=R.useContext(p),$=R.useCallback(function(ie,Z,xe){me.current+=1;var Le=me.current;oe.current.push({size:ie,element:Z,data:xe}),Promise.resolve().then(function(){Le===me.current&&(fe==null||fe(oe.current),oe.current=[])}),pe==null||pe(ie,Z,xe)},[fe,pe]);return R.createElement(p.Provider,{value:$},ge)}function A(ve){var ge=ve.children,fe=ve.disabled,me=R.useRef(null),oe=R.useRef(null),pe=R.useContext(p),$=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=R.isValidElement(ge)&&Object(y.c)(ge),Z=ie?ge.ref:null,xe=R.useMemo(function(){return Object(y.a)(Z,me)},[Z,me]),Le=R.useRef(ve);Le.current=ve;var be=R.useCallback(function(Ce){var _e=Le.current,ke=_e.onResize,Ue=_e.data,Pe=Ce.getBoundingClientRect(),Oe=Pe.width,Je=Pe.height,Qe=Ce.offsetWidth,We=Ce.offsetHeight,Ge=Math.floor(Oe),Ze=Math.floor(Je);if($.current.width!==Ge||$.current.height!==Ze||$.current.offsetWidth!==Qe||$.current.offsetHeight!==We){var He={width:Ge,height:Ze,offsetWidth:Qe,offsetHeight:We};$.current=He;var Ke=Qe===Math.round(Oe)?Oe:Qe,Se=We===Math.round(Je)?Je:We,et=Object(B.a)(Object(B.a)({},He),{},{offsetWidth:Ke,offsetHeight:Se});pe==null||pe(et,Ce,Ue),ke&&Promise.resolve().then(function(){ke(et,Ce)})}},[]);return R.useEffect(function(){var Ce=Object(S.a)(me.current)||Object(S.a)(oe.current);return Ce&&!fe&&u(Ce,be),function(){return s(Ce,be)}},[me.current,fe]),R.createElement(x,{ref:oe},ie?R.cloneElement(ge,{ref:xe}):ge)}var b="rc-observer-key";function h(ve){var ge=ve.children,fe=Object(M.a)(ge);return fe.map(function(me,oe){var pe=(me==null?void 0:me.key)||"".concat(b,"-").concat(oe);return R.createElement(A,Object(re.a)({},ve,{key:pe}),me)})}h.Collection=f;var c=h,l=te("bT9E"),a=te("TSYQ"),g=te.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},U;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&P[fe])return P[fe];var me=window.getComputedStyle(ve),oe=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),pe=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),$=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),ie=E.map(function(xe){return"".concat(xe,":").concat(me.getPropertyValue(xe))}).join(";"),Z={sizingStyle:ie,paddingSize:pe,borderSize:$,boxSizing:oe};return ge&&fe&&(P[fe]=Z),Z}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=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)),ve.getAttribute("wrap")?U.setAttribute("wrap",ve.getAttribute("wrap")):U.removeAttribute("wrap");var oe=j(ve,ge),pe=oe.paddingSize,$=oe.borderSize,ie=oe.boxSizing,Z=oe.sizingStyle;U.setAttribute("style","".concat(Z,";").concat(m)),U.value=ve.value||ve.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,Le=Number.MAX_SAFE_INTEGER,be=U.scrollHeight,Ce;if(ie==="border-box"?be+=$:ie==="content-box"&&(be-=pe),fe!==null||me!==null){U.value=" ";var _e=U.scrollHeight-pe;fe!==null&&(xe=_e*fe,ie==="border-box"&&(xe=xe+pe+$),be=Math.max(xe,be)),me!==null&&(Le=_e*me,ie==="border-box"&&(Le=Le+pe+$),Ce=be>Le?"":"hidden",be=Math.min(Le,be))}return{height:be,minHeight:xe,maxHeight:Le,overflowY:Ce,resize:"none"}}var _=te("Gytx"),k=te.n(_),K;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(K||(K={}));var Y=function(ve){Object(G.a)(fe,ve);var ge=Object(I.a)(fe);function fe(me){var oe;return Object(V.a)(this,fe),oe=ge.call(this,me),oe.nextFrameActionId=void 0,oe.resizeFrameId=void 0,oe.textArea=void 0,oe.saveTextArea=function(pe){oe.textArea=pe},oe.handleResize=function(pe){var $=oe.state.resizeStatus,ie=oe.props,Z=ie.autoSize,xe=ie.onResize;if($!==K.NONE)return;typeof xe=="function"&&xe(pe),Z&&oe.resizeOnNextFrame()},oe.resizeOnNextFrame=function(){cancelAnimationFrame(oe.nextFrameActionId),oe.nextFrameActionId=requestAnimationFrame(oe.resizeTextarea)},oe.resizeTextarea=function(){var pe=oe.props.autoSize;if(!pe||!oe.textArea)return;var $=pe.minRows,ie=pe.maxRows,Z=W(oe.textArea,!1,$,ie);oe.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(oe.resizeFrameId),oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:K.RESIZED},function(){oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:K.NONE}),oe.fixFirefoxAutoScroll()})})})})},oe.renderTextArea=function(){var pe=oe.props,$=pe.prefixCls,ie=$===void 0?"rc-textarea":$,Z=pe.autoSize,xe=pe.onResize,Le=pe.className,be=pe.disabled,Ce=oe.state,_e=Ce.textareaStyles,ke=Ce.resizeStatus,Ue=Object(l.a)(oe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Pe=g()(ie,Le,Object(F.a)({},"".concat(ie,"-disabled"),be));"value"in Ue&&(Ue.value=Ue.value||"");var Oe=Object(B.a)(Object(B.a)(Object(B.a)({},oe.props.style),_e),ke===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:oe.handleResize,disabled:!(Z||xe)},R.createElement("textarea",Object(re.a)({},Ue,{className:Pe,style:Oe,ref:oe.saveTextArea})))},oe.state={textareaStyles:{},resizeStatus:K.NONE},oe}return Object(L.a)(fe,[{key:"componentDidUpdate",value:function(oe){(oe.value!==this.props.value||!k()(oe.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 oe=this.textArea.selectionStart,pe=this.textArea.selectionEnd;this.textArea.setSelectionRange(oe,pe)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(R.Component),q=Y,ae=function(ve){Object(G.a)(fe,ve);var ge=Object(I.a)(fe);function fe(me){var oe;Object(V.a)(this,fe),oe=ge.call(this,me),oe.resizableTextArea=void 0,oe.focus=function(){oe.resizableTextArea.textArea.focus()},oe.saveTextArea=function($){oe.resizableTextArea=$},oe.handleChange=function($){var ie=oe.props.onChange;oe.setValue($.target.value,function(){oe.resizableTextArea.resizeTextarea()}),ie&&ie($)},oe.handleKeyDown=function($){var ie=oe.props,Z=ie.onPressEnter,xe=ie.onKeyDown;$.keyCode===13&&Z&&Z($),xe&&xe($)};var pe=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return oe.state={value:pe},oe}return Object(L.a)(fe,[{key:"setValue",value:function(oe,pe){"value"in this.props||this.setState({value:oe},pe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(q,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(oe){return"value"in oe?{value:oe.value}:null}}]),fe}(R.Component),Ee=qe.default=ae},YiJy:function(ut,qe,te){ut.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(ut,qe,te){"use strict";te.d(qe,"a",function(){return p});var re=te("k1fw"),V=te("miYZ"),L=te("tsqr"),G=te("rAM+"),I=te("tJVT"),R=te("PpiC"),B=te("cDcd"),F=te.n(B),M=te("bdgK");function D(f,A,b,h,c){var l=A.getWordUntilPosition(b),a={startLineNumber:b.lineNumber,endLineNumber:b.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},g=h.map(function(m){return{label:m,kind:f.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(m){g.push(Object(re.a)(Object(re.a)({},m),{},{range:a}))}),g}var y=function(f){var A={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},b=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,g){var m=D(f,a,g,b,[A]);return{suggestions:m}}});var h=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,g){var m=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=D(f,a,g,h,m);return{suggestions:E}}});var c=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,g){var m=[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}],E=D(f,a,g,c,m);return{suggestions:E}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=te("LvDl"),C=te("+ua5");function w(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 u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],A=f;if(Array.isArray(f)){for(var b=0;b<f.length;b++){var h=o[f[b]];if(h)return h}return A[0]}return o[A]||A}var s=null,x=qe.b=function(f){var A=f.width,b=A===void 0?"100%":A,h=f.height,c=h===void 0?"100%":h,l=f.value,a=f.language,g=a===void 0?"javascript":a,m=f.style,E=m===void 0?{}:m,P=f.options,U=P===void 0?{}:P,j=f.overrideServices,W=j===void 0?{}:j,_=f.theme,k=_===void 0?"vs-dark":_,K=f.onEditBlur,Y=f.onSave,q=f.autoHeight,ae=q===void 0?!1:q,Ee=f.forbidCopy,ve=Ee===void 0?!1:Ee,ge=f.onChange,fe=ge===void 0?v:ge,me=f.editorDidMount,oe=me===void 0?v:me,pe=f.onFocus,$=pe===void 0?v:pe,ie=f.filename,Z=ie===void 0?"educoder.txt":ie,xe=f.errorLine,Le=f.errorContent,be=Le===void 0?"":Le,Ce=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),_e=Object(B.useRef)(),ke=Object(B.useRef)({}),Ue=Object(B.useRef)(),Pe=Object(B.useRef)(!1),Oe=Object(B.useRef)(),Je=Object(B.useState)(!1),Qe=Object(I.a)(Je,2),We=Qe[0],Ge=Qe[1];function Ze(){var we;return _e.current&&(we=new M.default(function(Me){var $e=Object(G.a)(Me),ze;try{for($e.s();!(ze=$e.n()).done;){var mt=ze.value;(mt.target.offsetHeight>0||mt.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(dt){$e.e(dt)}finally{$e.f()}}),we.observe(_e.current)),we}function He(){L.b.warn(decodeURIComponent(S))}var Ke=function(){var Me=ke.current.instance;if(l!=null&&Me&&We){var $e=Me.getModel();$e&&l!==$e.getValue()&&(d=!0,$e.setValue(l),Me.layout(),d=!1)}};Object(B.useEffect)(function(){Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(function(){Ke()},500)},[l,We,ke.current]),Object(B.useEffect)(function(){if(xe&&ke.current&&ke.current.instance){var we=ke.current.instance;we.changeViewZones(function($e){var ze=document.createElement("div");ze.style.padding="10px 20px",ze.style.width="calc(100% - 20px)",ze.className="my-error-line-wrp",ze.innerHTML=be,$e.addZone({afterLineNumber:xe||11,heightInLines:3,domNode:ze})});var Me={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}};we.addOverlayWidget(Me),we.revealPositionInCenter({lineNumber:20,column:1})}},[xe,ke.current,We]);function Se(){var we=ke.current.instance;if(we){var Me=we.getSelection(),$e=ke.current.pastePos||{},ze=new s.Range($e.startLineNumber||Me.endLineNumber,$e.startColumn||Me.endColumn,$e.endLineNumber||Me.endLineNumber,$e.endColumn||Me.endColumn);setTimeout(function(){we.executeEdits("",[{range:ze,text:""}])},300)}}function et(we){(window.navigator.platform.match("Mac")?we.metaKey:we.ctrlKey)&&we.keyCode==83&&(we.preventDefault(),Y())}var Ye=function(){if(ae&&ke.current.instance){var Me=ke.current.instance.getContentHeight();ce(Me<c?c:Me)}else ce(c)};function De(we){var Me=document.createEvent("MouseEvents");Me.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),we.dispatchEvent(Me)}function Fe(we,Me){var $e=window.URL||window.webkitURL||window,ze=new Blob([Me]),mt=document.createElementNS("http://www.w3.org/1999/xhtml","a");mt.href=$e.createObjectURL(ze),mt.download=we,De(mt)}Object(B.useEffect)(function(){Ye()},[Ye]),Object(B.useEffect)(function(){_e.current&&!We&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(we){try{s=we,ke.current.instance=s.editor.create(_e.current,{value:l,language:u(g),theme:k,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Me=ke.current.instance;if(oe(Me,s),setTimeout(function(){Ye(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Fe(Z||"educoder.txt",Me.getValue())}})},500),ke.current.subscription=Me.onDidChangeModelContent(function(ze){Pe.current?clearTimeout(Oe.current):(Ye(),fe(Me.getValue(),ze)),Oe.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||y(s),ve&&(Me.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return He(),null}),Me.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return He(),null})),window.Monaco=s,K&&Me.onDidBlurEditorWidget(function(){K(Me.getValue())}),$&&Me.onDidFocusEditorText(function(){$(Me.getValue())}),ve){Me.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return He(),null}),Me.onDidPaste(function(ze){ke.current.pastePos=ze});try{window.addEventListener("paste",Se)}catch(ze){}}var $e=Ze();return Ge(!0),function(){var ze=ke.current.instance;ze.dispose();var mt=ze.getModel();mt&&mt.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),ve&&window.removeEventListener("paste",Se),$e.unobserve(_e.current)}}catch(ze){}})},[]),Object(B.useEffect)(function(){var we=ke.current.instance;if(we&&We)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}},[Y,We]),Object(B.useEffect)(function(){var we=ke.current.instance;if(we&&We){var Me=u(g);s.editor.setModelLanguage(we.getModel(),Me),console.log("language:",g,we.getModel(),Me)}},[g,We]),Object(B.useEffect)(function(){var we=ke.current.instance;we&&We&&s.editor.setTheme(k)},[k,We]),Object(B.useEffect)(function(){var we=ke.current.instance;we&&We&&(we.updateOptions(Object(re.a)({},U)),setTimeout(function(){we.getModel().updateOptions(Object(re.a)({},U))},200))},[JSON.stringify(U),We]),Object(B.useEffect)(function(){var we=ke.current.instance;we&&We&&we.layout()},[b,c,We]);var he=Object(B.useState)(w(b)),le=Object(I.a)(he,2),de=le[0],J=le[1],Q=Object(B.useState)(w(c)),ee=Object(I.a)(Q,2),se=ee[0],ce=ee[1],Ae=Object(re.a)(Object(re.a)({},E),{},{width:de,height:se});return F.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:Ae})};function p(f){var A=f.width,b=A===void 0?"100%":A,h=f.height,c=h===void 0?"100%":h,l=f.original,a=f.modified,g=f.language,m=f.options,E=m===void 0?{}:m,P=Object(B.useRef)(),U=Object(B.useState)(null),j=Object(I.a)(U,2),W=j[0],_=j[1];function k(ae){var Ee;return P.current&&(Ee=new M.default(function(ve){var ge=Object(G.a)(ve),fe;try{for(ge.s();!(fe=ge.n()).done;){var me=fe.value;(me.target.offsetHeight>0||me.target.offsetWidth>0)&&ae.layout()}}catch(oe){ge.e(oe)}finally{ge.f()}}),Ee.observe(P.current)),Ee}Object(B.useEffect)(function(){P.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(ae){s=ae;var Ee=s.editor.createDiffEditor(P.current,Object(re.a)(Object(re.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},E),{},{wordWrap:!0}));_(Ee);var ve=k(Ee);return function(){Ee.dispose();var ge=Ee.getModel();ge&&ge.dispose(),ve.unobserve(P.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,g),modified:s.editor.createModel(a,g)})},[l,a,g,W]);var K=w(b),Y=w(c),q={width:K,height:Y};return F.a.createElement("div",{className:"my-diff-editor",ref:P,style:q})}},ZpRC:function(ut,qe,te){"use strict";function re(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function V(y,S){return(!S||y!=="hidden")&&y!=="visible"&&y!=="clip"}function L(y,S){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var O=getComputedStyle(y,null);return V(O.overflowY,S)||V(O.overflowX,S)||function(C){var w=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!w&&(w.clientHeight<C.scrollHeight||w.clientWidth<C.scrollWidth)}(y)}return!1}function G(y,S,O,C,w,v,d,o){return v<y&&d>S||v>y&&d<S?0:v<=y&&o<=O||d>=S&&o>=O?v-y-C:d>S&&o<O||v<y&&o>O?d-S+w:0}var I=function(y,S){var O=window,C=S.scrollMode,w=S.block,v=S.inline,d=S.boundary,o=S.skipOverflowHiddenElements,u=typeof d=="function"?d:function(_e){return _e!==d};if(!re(y))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,x=[],p=y;re(p)&&u(p);){if((p=p.parentElement)===s){x.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&x.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,A=O.visualViewport?O.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),l=c.height,a=c.width,g=c.top,m=c.right,E=c.bottom,P=c.left,U=w==="start"||w==="nearest"?g:w==="end"?E:g+l/2,j=v==="center"?P+a/2:v==="end"?m:P,W=[],_=0;_<x.length;_++){var k=x[_],K=k.getBoundingClientRect(),Y=K.height,q=K.width,ae=K.top,Ee=K.right,ve=K.bottom,ge=K.left;if(C==="if-needed"&&g>=0&&P>=0&&E<=A&&m<=f&&g>=ae&&E<=ve&&P>=ge&&m<=Ee)return W;var fe=getComputedStyle(k),me=parseInt(fe.borderLeftWidth,10),oe=parseInt(fe.borderTopWidth,10),pe=parseInt(fe.borderRightWidth,10),$=parseInt(fe.borderBottomWidth,10),ie=0,Z=0,xe="offsetWidth"in k?k.offsetWidth-k.clientWidth-me-pe:0,Le="offsetHeight"in k?k.offsetHeight-k.clientHeight-oe-$:0;if(s===k)ie=w==="start"?U:w==="end"?U-A:w==="nearest"?G(h,h+A,A,oe,$,h+U,h+U+l,l):U-A/2,Z=v==="start"?j:v==="center"?j-f/2:v==="end"?j-f:G(b,b+f,f,me,pe,b+j,b+j+a,a),ie=Math.max(0,ie+h),Z=Math.max(0,Z+b);else{ie=w==="start"?U-ae-oe:w==="end"?U-ve+$+Le:w==="nearest"?G(ae,ve,Y,oe,$+Le,U,U+l,l):U-(ae+Y/2)+Le/2,Z=v==="start"?j-ge-me:v==="center"?j-(ge+q/2)+xe/2:v==="end"?j-Ee+pe+xe:G(ge,Ee,q,me,pe+xe,j,j+a,a);var be=k.scrollLeft,Ce=k.scrollTop;U+=Ce-(ie=Math.max(0,Math.min(Ce+ie,k.scrollHeight-Y+Le))),j+=be-(Z=Math.max(0,Math.min(be+Z,k.scrollWidth-q+xe)))}W.push({el:k,top:ie,left:Z})}return W};function R(y){return y===Object(y)&&Object.keys(y).length!==0}function B(y,S){S===void 0&&(S="auto");var O="scrollBehavior"in document.body.style;y.forEach(function(C){var w=C.el,v=C.top,d=C.left;w.scroll&&O?w.scroll({top:v,left:d,behavior:S}):(w.scrollTop=v,w.scrollLeft=d)})}function F(y){return y===!1?{block:"end",inline:"nearest"}:R(y)?y:{block:"start",inline:"nearest"}}function M(y,S){var O=!y.ownerDocument.documentElement.contains(y);if(R(S)&&typeof S.behavior=="function")return S.behavior(O?[]:I(y,S));if(O)return;var C=F(S);return B(I(y,C),C.behavior)}var D=qe.a=M},Zss7:function(ut,qe,te){var re;(function(V){var L=/^\s+/,G=/\s+$/,I=0,R=V.round,B=V.min,F=V.max,M=V.random;function D($,ie){if($=$||"",ie=ie||{},$ instanceof D)return $;if(!(this instanceof D))return new D($,ie);var Z=y($);this._originalInput=$,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=R(100*this._a)/100,this._format=ie.format||Z.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Z.ok,this._tc_id=I++}D.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 $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ie,Z,xe,Le,be,Ce;return ie=$.r/255,Z=$.g/255,xe=$.b/255,ie<=.03928?Le=ie/12.92:Le=V.pow((ie+.055)/1.055,2.4),Z<=.03928?be=Z/12.92:be=V.pow((Z+.055)/1.055,2.4),xe<=.03928?Ce=xe/12.92:Ce=V.pow((xe+.055)/1.055,2.4),.2126*Le+.7152*be+.0722*Ce},setAlpha:function($){return this._a=W($),this._roundA=R(100*this._a)/100,this},toHsv:function(){var $=w(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=w(this._r,this._g,this._b),ie=R($.h*360),Z=R($.s*100),xe=R($.v*100);return this._a==1?"hsv("+ie+", "+Z+"%, "+xe+"%)":"hsva("+ie+", "+Z+"%, "+xe+"%, "+this._roundA+")"},toHsl:function(){var $=O(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=O(this._r,this._g,this._b),ie=R($.h*360),Z=R($.s*100),xe=R($.l*100);return this._a==1?"hsl("+ie+", "+Z+"%, "+xe+"%)":"hsla("+ie+", "+Z+"%, "+xe+"%, "+this._roundA+")"},toHex:function($){return d(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(_(this._r,255)*100)+"%",g:R(_(this._g,255)*100)+"%",b:R(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(_(this._r,255)*100)+"%, "+R(_(this._g,255)*100)+"%, "+R(_(this._b,255)*100)+"%)":"rgba("+R(_(this._r,255)*100)+"%, "+R(_(this._g,255)*100)+"%, "+R(_(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($){var ie="#"+u(this._r,this._g,this._b,this._a),Z=ie,xe=this._gradientType?"GradientType = 1, ":"";if($){var Le=D($);Z="#"+u(Le._r,Le._g,Le._b,Le._a)}return"progid:DXImageTransform.Microsoft.gradient("+xe+"startColorstr="+ie+",endColorstr="+Z+")"},toString:function($){var ie=!!$;$=$||this._format;var Z=!1,xe=this._a<1&&this._a>=0,Le=!ie&&xe&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Le?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(Z=this.toRgbString()),$==="prgb"&&(Z=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(Z=this.toHexString()),$==="hex3"&&(Z=this.toHexString(!0)),$==="hex4"&&(Z=this.toHex8String(!0)),$==="hex8"&&(Z=this.toHex8String()),$==="name"&&(Z=this.toName()),$==="hsl"&&(Z=this.toHslString()),$==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function($,ie){var Z=$.apply(null,[this].concat([].slice.call(ie)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(x,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ie){return $.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function($,ie){if(typeof $=="object"){var Z={};for(var xe in $)$.hasOwnProperty(xe)&&(xe==="a"?Z[xe]=$[xe]:Z[xe]=Ee($[xe]));$=Z}return D($,ie)};function y($){var ie={r:0,g:0,b:0},Z=1,xe=null,Le=null,be=null,Ce=!1,_e=!1;return typeof $=="string"&&($=oe($)),typeof $=="object"&&(me($.r)&&me($.g)&&me($.b)?(ie=S($.r,$.g,$.b),Ce=!0,_e=String($.r).substr(-1)==="%"?"prgb":"rgb"):me($.h)&&me($.s)&&me($.v)?(xe=Ee($.s),Le=Ee($.v),ie=v($.h,xe,Le),Ce=!0,_e="hsv"):me($.h)&&me($.s)&&me($.l)&&(xe=Ee($.s),be=Ee($.l),ie=C($.h,xe,be),Ce=!0,_e="hsl"),$.hasOwnProperty("a")&&(Z=$.a)),Z=W(Z),{ok:Ce,format:$.format||_e,r:B(255,F(ie.r,0)),g:B(255,F(ie.g,0)),b:B(255,F(ie.b,0)),a:Z}}function S($,ie,Z){return{r:_($,255)*255,g:_(ie,255)*255,b:_(Z,255)*255}}function O($,ie,Z){$=_($,255),ie=_(ie,255),Z=_(Z,255);var xe=F($,ie,Z),Le=B($,ie,Z),be,Ce,_e=(xe+Le)/2;if(xe==Le)be=Ce=0;else{var ke=xe-Le;Ce=_e>.5?ke/(2-xe-Le):ke/(xe+Le);switch(xe){case $:be=(ie-Z)/ke+(ie<Z?6:0);break;case ie:be=(Z-$)/ke+2;break;case Z:be=($-ie)/ke+4;break}be/=6}return{h:be,s:Ce,l:_e}}function C($,ie,Z){var xe,Le,be;$=_($,360),ie=_(ie,100),Z=_(Z,100);function Ce(Ue,Pe,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Ue+(Pe-Ue)*6*Oe:Oe<1/2?Pe:Oe<2/3?Ue+(Pe-Ue)*(2/3-Oe)*6:Ue}if(ie===0)xe=Le=be=Z;else{var _e=Z<.5?Z*(1+ie):Z+ie-Z*ie,ke=2*Z-_e;xe=Ce(ke,_e,$+1/3),Le=Ce(ke,_e,$),be=Ce(ke,_e,$-1/3)}return{r:xe*255,g:Le*255,b:be*255}}function w($,ie,Z){$=_($,255),ie=_(ie,255),Z=_(Z,255);var xe=F($,ie,Z),Le=B($,ie,Z),be,Ce,_e=xe,ke=xe-Le;if(Ce=xe===0?0:ke/xe,xe==Le)be=0;else{switch(xe){case $:be=(ie-Z)/ke+(ie<Z?6:0);break;case ie:be=(Z-$)/ke+2;break;case Z:be=($-ie)/ke+4;break}be/=6}return{h:be,s:Ce,v:_e}}function v($,ie,Z){$=_($,360)*6,ie=_(ie,100),Z=_(Z,100);var xe=V.floor($),Le=$-xe,be=Z*(1-ie),Ce=Z*(1-Le*ie),_e=Z*(1-(1-Le)*ie),ke=xe%6,Ue=[Z,Ce,be,be,_e,Z][ke],Pe=[_e,Z,Z,Ce,be,be][ke],Oe=[be,be,_e,Z,Z,Ce][ke];return{r:Ue*255,g:Pe*255,b:Oe*255}}function d($,ie,Z,xe){var Le=[ae(R($).toString(16)),ae(R(ie).toString(16)),ae(R(Z).toString(16))];return xe&&Le[0].charAt(0)==Le[0].charAt(1)&&Le[1].charAt(0)==Le[1].charAt(1)&&Le[2].charAt(0)==Le[2].charAt(1)?Le[0].charAt(0)+Le[1].charAt(0)+Le[2].charAt(0):Le.join("")}function o($,ie,Z,xe,Le){var be=[ae(R($).toString(16)),ae(R(ie).toString(16)),ae(R(Z).toString(16)),ae(ve(xe))];return Le&&be[0].charAt(0)==be[0].charAt(1)&&be[1].charAt(0)==be[1].charAt(1)&&be[2].charAt(0)==be[2].charAt(1)&&be[3].charAt(0)==be[3].charAt(1)?be[0].charAt(0)+be[1].charAt(0)+be[2].charAt(0)+be[3].charAt(0):be.join("")}function u($,ie,Z,xe){var Le=[ae(ve(xe)),ae(R($).toString(16)),ae(R(ie).toString(16)),ae(R(Z).toString(16))];return Le.join("")}D.equals=function($,ie){return!$||!ie?!1:D($).toRgbString()==D(ie).toRgbString()},D.random=function(){return D.fromRatio({r:M(),g:M(),b:M()})};function s($,ie){ie=ie===0?0:ie||10;var Z=D($).toHsl();return Z.s-=ie/100,Z.s=k(Z.s),D(Z)}function x($,ie){ie=ie===0?0:ie||10;var Z=D($).toHsl();return Z.s+=ie/100,Z.s=k(Z.s),D(Z)}function p($){return D($).desaturate(100)}function f($,ie){ie=ie===0?0:ie||10;var Z=D($).toHsl();return Z.l+=ie/100,Z.l=k(Z.l),D(Z)}function A($,ie){ie=ie===0?0:ie||10;var Z=D($).toRgb();return Z.r=F(0,B(255,Z.r-R(255*-(ie/100)))),Z.g=F(0,B(255,Z.g-R(255*-(ie/100)))),Z.b=F(0,B(255,Z.b-R(255*-(ie/100)))),D(Z)}function b($,ie){ie=ie===0?0:ie||10;var Z=D($).toHsl();return Z.l-=ie/100,Z.l=k(Z.l),D(Z)}function h($,ie){var Z=D($).toHsl(),xe=(Z.h+ie)%360;return Z.h=xe<0?360+xe:xe,D(Z)}function c($){var ie=D($).toHsl();return ie.h=(ie.h+180)%360,D(ie)}function l($){var ie=D($).toHsl(),Z=ie.h;return[D($),D({h:(Z+120)%360,s:ie.s,l:ie.l}),D({h:(Z+240)%360,s:ie.s,l:ie.l})]}function a($){var ie=D($).toHsl(),Z=ie.h;return[D($),D({h:(Z+90)%360,s:ie.s,l:ie.l}),D({h:(Z+180)%360,s:ie.s,l:ie.l}),D({h:(Z+270)%360,s:ie.s,l:ie.l})]}function g($){var ie=D($).toHsl(),Z=ie.h;return[D($),D({h:(Z+72)%360,s:ie.s,l:ie.l}),D({h:(Z+216)%360,s:ie.s,l:ie.l})]}function m($,ie,Z){ie=ie||6,Z=Z||30;var xe=D($).toHsl(),Le=360/Z,be=[D($)];for(xe.h=(xe.h-(Le*ie>>1)+720)%360;--ie;)xe.h=(xe.h+Le)%360,be.push(D(xe));return be}function E($,ie){ie=ie||6;for(var Z=D($).toHsv(),xe=Z.h,Le=Z.s,be=Z.v,Ce=[],_e=1/ie;ie--;)Ce.push(D({h:xe,s:Le,v:be})),be=(be+_e)%1;return Ce}D.mix=function($,ie,Z){Z=Z===0?0:Z||50;var xe=D($).toRgb(),Le=D(ie).toRgb(),be=Z/100,Ce={r:(Le.r-xe.r)*be+xe.r,g:(Le.g-xe.g)*be+xe.g,b:(Le.b-xe.b)*be+xe.b,a:(Le.a-xe.a)*be+xe.a};return D(Ce)},D.readability=function($,ie){var Z=D($),xe=D(ie);return(V.max(Z.getLuminance(),xe.getLuminance())+.05)/(V.min(Z.getLuminance(),xe.getLuminance())+.05)},D.isReadable=function($,ie,Z){var xe=D.readability($,ie),Le,be;be=!1,Le=pe(Z);switch(Le.level+Le.size){case"AAsmall":case"AAAlarge":be=xe>=4.5;break;case"AAlarge":be=xe>=3;break;case"AAAsmall":be=xe>=7;break}return be},D.mostReadable=function($,ie,Z){var xe=null,Le=0,be,Ce,_e,ke;Z=Z||{},Ce=Z.includeFallbackColors,_e=Z.level,ke=Z.size;for(var Ue=0;Ue<ie.length;Ue++)be=D.readability($,ie[Ue]),be>Le&&(Le=be,xe=D(ie[Ue]));return D.isReadable($,xe,{level:_e,size:ke})||!Ce?xe:(Z.includeFallbackColors=!1,D.mostReadable($,["#fff","#000"],Z))};var P=D.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=D.hexNames=j(P);function j($){var ie={};for(var Z in $)$.hasOwnProperty(Z)&&(ie[$[Z]]=Z);return ie}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function _($,ie){Y($)&&($="100%");var Z=q($);return $=B(ie,F(0,parseFloat($))),Z&&($=parseInt($*ie,10)/100),V.abs($-ie)<1e-6?1:$%ie/parseFloat(ie)}function k($){return B(1,F(0,$))}function K($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function q($){return typeof $=="string"&&$.indexOf("%")!=-1}function ae($){return $.length==1?"0"+$:""+$}function Ee($){return $<=1&&($=$*100+"%"),$}function ve($){return V.round(parseFloat($)*255).toString(16)}function ge($){return K($)/255}var fe=function(){var $="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ie+")|(?:"+$+")",xe="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Le="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+xe),rgba:new RegExp("rgba"+Le),hsl:new RegExp("hsl"+xe),hsla:new RegExp("hsla"+Le),hsv:new RegExp("hsv"+xe),hsva:new RegExp("hsva"+Le),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 me($){return!!fe.CSS_UNIT.exec($)}function oe($){$=$.replace(L,"").replace(G,"").toLowerCase();var ie=!1;if(P[$])$=P[$],ie=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=fe.rgb.exec($))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=fe.rgba.exec($))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=fe.hsl.exec($))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=fe.hsla.exec($))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=fe.hsv.exec($))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=fe.hsva.exec($))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=fe.hex8.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:ie?"name":"hex8"}:(Z=fe.hex6.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:ie?"name":"hex"}:(Z=fe.hex4.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:ie?"name":"hex8"}:(Z=fe.hex3.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:ie?"name":"hex"}:!1}function pe($){var ie,Z;return $=$||{level:"AA",size:"small"},ie=($.level||"AA").toUpperCase(),Z=($.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ie,size:Z}}ut.exports?ut.exports=D:!(re=function(){return D}.call(qe,te,qe,ut),re!==void 0&&(ut.exports=re))})(Math)},bT9E:function(ut,qe,te){"use strict";te.d(qe,"a",function(){return V});var re=te("VTBJ");function V(L,G){var I=Object(re.a)({},L);return Array.isArray(G)&&G.forEach(function(R){delete I[R]}),I}},c5Ni:function(ut,qe,te){},dejd:function(ut,qe,te){},dmUQ:function(ut,qe,te){"use strict";var re=te("Ff2n"),V=te("rePB"),L=te("1OyB"),G=te("vuIU"),I=te("Ji7U"),R=te("md7G"),B=te("foSv"),F=te("cDcd"),M=te.n(F),D=te("TSYQ"),y=te.n(D),S=te("4IlW");function O(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),g.push.apply(g,m)}return g}function C(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?O(Object(g),!0).forEach(function(m){Object(V.a)(l,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):O(Object(g)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(g,m))})}return l}function w(l){var a=v();return function(){var m=Object(B.a)(l),E;if(a){var P=Object(B.a)(this).constructor;E=Reflect.construct(m,arguments,P)}else E=m.apply(this,arguments);return Object(R.a)(this,E)}}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(l){return!1}}function d(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,x=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},A=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},b=function(l){Object(I.a)(g,l);var a=w(g);function g(m){var E;Object(L.a)(this,g),E=a.call(this,m),E.onKeyDown=function(j){var W=E.props,_=W.onKeyDown,k=W.onPressEnter;if(j.keyCode===S.a.UP){var K=E.getRatio(j);E.up(j,K,null),E.stop()}else if(j.keyCode===S.a.DOWN){var Y=E.getRatio(j);E.down(j,Y,null),E.stop()}else j.keyCode===S.a.ENTER&&k&&k(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,_){for(var q=arguments.length,ae=new Array(q>1?q-1:0),Ee=1;Ee<q;Ee++)ae[Ee-1]=arguments[Ee];_.apply(void 0,[j].concat(ae))}},E.onKeyUp=function(j){var W=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),W){for(var _=arguments.length,k=new Array(_>1?_-1:0),K=1;K<_;K++)k[K-1]=arguments[K];W.apply(void 0,[j].concat(k))}},E.onChange=function(j){var W=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),W(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var W=E.getCurrentValidValue(E.state.inputValue),_=E.setValue(W,d);if(j){var k=E.input.value,K=E.getInputDisplayValue({focus:!1,value:_});E.input.value=K&&Number(K),j.apply(void 0,arguments),E.input.value=k}},E.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(f(E.props.precision))return E.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var _=0;return W.indexOf(".")>=0&&(_=W.length-W.indexOf(".")-1),_},E.getInputDisplayValue=function(j){var W=j||E.state,_=W.focused,k=W.inputValue,K=W.value,Y;_?Y=k:Y=E.toPrecisionAsStep(K),Y==null&&(Y="");var q=E.formatWrapper(Y);return f(E.props.decimalSeparator)&&(q=q.toString().replace(".",E.props.decimalSeparator)),q},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,_=W.lastIndexOf(j);if(_===-1)return!1;var k=E.cursorBefore.length;return E.lastKeyCode===S.a.DELETE&&E.cursorBefore.charAt(k-1)===j[0]?(E.fixCaret(k,k),!0):_+j.length===W.length?(E.fixCaret(_,_),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,_){var k=j.substring(_);return E.restoreByAfter(k)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,_){E.pressingUpOrDown=!0,E.step("down",j,W,_)},E.up=function(j,W,_){E.pressingUpOrDown=!0,E.step("up",j,W,_)},E.saveInput=function(j){E.input=j};var P=m.value;P===void 0&&(P=m.defaultValue),E.state={focused:m.autoFocus};var U=E.getValidValue(E.toNumber(P));return E.state=C(C({},E.state),{},{inputValue:E.toPrecisionAsStep(U),value:U}),E}return Object(G.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var P=this.props,U=P.value,j=P.onChange,W=P.max,_=P.min,k=this.state.focused;if(E){if(!A(E.value,U)||!A(E.max,W)||!A(E.min,_)){var K=k?U:this.getValidValue(U),Y;this.pressingUpOrDown?Y=K:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:Y})}var q="value"in this.props?U:this.state.value;"max"in this.props&&E.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&E.min!==_&&typeof q=="number"&&q<_&&j&&j(_)}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===S.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===S.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 S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}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(E){var P=E;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(E){var P=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(E){var P=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,j=parseFloat(E);return isNaN(j)?E:(j<P&&(j=P),j>U&&(j=U),j)}},{key:"setValue",value:function(E,P){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,_=W===void 0?null:W,k=this.state.inputValue,K=k===void 0?null:k,Y=typeof j=="number"?j.toFixed(U):"".concat(j),q=j!==_||Y!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},P)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},P),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,W=U.step;if(f(j))return j;var _=this.getPrecision(P),k=this.getPrecision(W),K=this.getPrecision(E);return E?Math.max(K,_+k):_+k}},{key:"getPrecisionFactor",value:function(E){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(E,P);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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var P=Math.abs(this.getMaxPrecision(E));return isNaN(P)?E.toString():Number(E).toFixed(P)}},{key:"toNumber",value:function(E){var P=this.props.precision,U=this.state.focused,j=E&&E.length>16&&U;return this.isNotCompleteNumber(E)||j?E:f(P)?Math.round(E*Math.pow(10,P))/Math.pow(10,P):Number(E)}},{key:"upStep",value:function(E,P){var U=this.props.step,j=this.getPrecisionFactor(E,P),W=Math.abs(this.getMaxPrecision(E,P)),_=((j*E+j*U*P)/j).toFixed(W);return this.toNumber(_)}},{key:"downStep",value:function(E,P){var U=this.props.step,j=this.getPrecisionFactor(E,P),W=Math.abs(this.getMaxPrecision(E,P)),_=((j*E-j*U*P)/j).toFixed(W);return this.toNumber(_)}},{key:"step",value:function(E,P){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var _=this.props;if(_.disabled)return;var k=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(k))return;var K=this["".concat(E,"Step")](k,j),Y=K>_.max||K<_.min;if(K>_.max?K=_.max:K<_.min&&(K=_.min),this.setValue(K,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){U[E](P,j,!0)},W?s:x)}},{key:"fixCaret",value:function(E,P){if(E===void 0||P===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(E!==U||P!==j)&&this.input.setSelectionRange(E,P)}catch(W){}}},{key:"render",value:function(){var E,P=this.props,U=P.prefixCls,j=P.disabled,W=P.readOnly,_=P.useTouch,k=P.autoComplete,K=P.upHandler,Y=P.downHandler,q=P.className,ae=P.max,Ee=P.min,ve=P.style,ge=P.title,fe=P.onMouseEnter,me=P.onMouseLeave,oe=P.onMouseOver,pe=P.onMouseOut,$=P.required,ie=P.onClick,Z=P.tabIndex,xe=P.type,Le=P.placeholder,be=P.id,Ce=P.inputMode,_e=P.pattern,ke=P.step,Ue=P.maxLength,Pe=P.autoFocus,Oe=P.name,Je=P.onPaste,Qe=P.onInput,We=Object(re.a)(P,["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"]),Ge=this.state,Ze=Ge.value,He=Ge.focused,Ke=y()(U,(E={},Object(V.a)(E,q,!!q),Object(V.a)(E,"".concat(U,"-disabled"),j),Object(V.a)(E,"".concat(U,"-focused"),He),E)),Se={};Object.keys(We).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Se[se]=We[se])});var et=!W&&!j,Ye=this.getInputDisplayValue(null),De=(Ze||Ze===0)&&(isNaN(Ze)||Number(Ze)>=ae),Fe=(Ze||Ze===0)&&(isNaN(Ze)||Number(Ze)<=Ee),he=De||j||W,le=Fe||j||W,de=y()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(V.a)({},"".concat(U,"-handler-up-disabled"),he)),J=y()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(V.a)({},"".concat(U,"-handler-down-disabled"),le)),Q=_?{onTouchStart:he?d:this.up,onTouchEnd:this.stop}:{onMouseDown:he?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=_?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:Ke,style:ve,title:ge,onMouseEnter:fe,onMouseLeave:me,onMouseOver:oe,onMouseOut:pe,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(U,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":he,className:de}),K||M.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),M.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:J}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),M.a.createElement("div",{className:"".concat(U,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":ae,"aria-valuenow":Ze,required:$,type:xe,placeholder:Le,onPaste:Je,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Z,autoComplete:k,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:d,onKeyUp:et?this.onKeyUp:d,autoFocus:Pe,maxLength:Ue,readOnly:W,disabled:j,max:ae,min:Ee,step:ke,name:Oe,title:ge,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:_e,inputMode:Ce,onInput:Qe},Se))))}}]),g}(M.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=b,c=qe.a=h},h78n:function(ut,qe,te){"use strict";te.d(qe,"a",function(){return E});var re=te("cDcd"),V=te.n(re),L=te("TSYQ"),G=te.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),_=Object(re.useRef)();return Object(re.useEffect)(function(){var k=Date.now(),K=!1;Object.keys(W).forEach(function(Y){var q=W[Y].current;if(!q)return;K=!0;var ae=q.style;ae.transitionDuration=".3s, .3s, .3s, .06s",_.current&&k-_.current<100&&(ae.transitionDuration="0s, 0s")}),K&&(_.current=Date.now())}),[W]};function B(){return B=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(U[_]=W[_])}return U},B.apply(this,arguments)}function F(U,j){return O(U)||S(U,j)||D(U,j)||M()}function M(){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 D(U,j){if(!U)return;if(typeof U=="string")return y(U,j);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 y(U,j)}function y(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,_=new Array(j);W<j;W++)_[W]=U[W];return _}function S(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],_=!0,k=!1,K=void 0;try{for(var Y=U[Symbol.iterator](),q;!(_=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);_=!0);}catch(ae){k=!0,K=ae}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(k)throw K}}return W}function O(U){if(Array.isArray(U))return U}function C(U,j){if(U==null)return{};var W=w(U,j),_,k;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(k=0;k<K.length;k++){if(_=K[k],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,_))continue;W[_]=U[_]}}return W}function w(U,j){if(U==null)return{};var W={},_=Object.keys(U),k,K;for(K=0;K<_.length;K++){if(k=_[K],j.indexOf(k)>=0)continue;W[k]=U[k]}return W}var v=function(j){var W=j.className,_=j.percent,k=j.prefixCls,K=j.strokeColor,Y=j.strokeLinecap,q=j.strokeWidth,ae=j.style,Ee=j.trailColor,ve=j.trailWidth,ge=j.transition,fe=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete fe.gapPosition;var me=Array.isArray(_)?_:[_],oe=Array.isArray(K)?K:[K],pe=R(me),$=F(pe,1),ie=$[0],Z=q/2,xe=100-q/2,Le="M ".concat(Y==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(Y==="round"?xe:100,",").concat(Z),be="0 0 100 ".concat(q),Ce=0;return V.a.createElement("svg",B({className:G()("".concat(k,"-line"),W),viewBox:be,preserveAspectRatio:"none",style:ae},fe),V.a.createElement("path",{className:"".concat(k,"-line-trail"),d:Le,strokeLinecap:Y,stroke:Ee,strokeWidth:ve||q,fillOpacity:"0"}),me.map(function(_e,ke){var Ue={strokeDasharray:"".concat(_e,"px, 100px"),strokeDashoffset:"-".concat(Ce,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Pe=oe[ke]||oe[oe.length-1];return Ce+=_e,V.a.createElement("path",{key:ke,className:"".concat(k,"-line-path"),d:Le,strokeLinecap:Y,stroke:Pe,strokeWidth:q,fillOpacity:"0",ref:ie[ke],style:Ue})}))};v.defaultProps=I;var d=v;function o(){return o=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(U[_]=W[_])}return U},o.apply(this,arguments)}function u(U,j){return A(U)||f(U,j)||x(U,j)||s()}function s(){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 x(U,j){if(!U)return;if(typeof U=="string")return p(U,j);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 p(U,j)}function p(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,_=new Array(j);W<j;W++)_[W]=U[W];return _}function f(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],_=!0,k=!1,K=void 0;try{for(var Y=U[Symbol.iterator](),q;!(_=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);_=!0);}catch(ae){k=!0,K=ae}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(k)throw K}}return W}function A(U){if(Array.isArray(U))return U}function b(U,j){if(U==null)return{};var W=h(U,j),_,k;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(U);for(k=0;k<K.length;k++){if(_=K[k],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,_))continue;W[_]=U[_]}}return W}function h(U,j){if(U==null)return{};var W={},_=Object.keys(U),k,K;for(K=0;K<_.length;K++){if(k=_[K],j.indexOf(k)>=0)continue;W[k]=U[k]}return W}var c=0;function l(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function g(U,j,W,_){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,Y=50-_/2,q=0,ae=-Y,Ee=0,ve=-2*Y;switch(K){case"left":q=-Y,ae=0,Ee=2*Y,ve=0;break;case"right":q=Y,ae=0,Ee=-2*Y,ve=0;break;case"bottom":ae=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(q,",").concat(ae,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Ee,",").concat(-ve,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Ee,",").concat(ve),fe=Math.PI*2*Y,me={stroke:W,strokeDasharray:"".concat(j/100*(fe-k),"px ").concat(fe,"px"),strokeDashoffset:"-".concat(k/2+U/100*(fe-k),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:me}}var m=function(j){var W=j.prefixCls,_=j.strokeWidth,k=j.trailWidth,K=j.gapDegree,Y=j.gapPosition,q=j.trailColor,ae=j.strokeLinecap,Ee=j.style,ve=j.className,ge=j.strokeColor,fe=j.percent,me=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),oe=Object(re.useMemo)(function(){return c+=1,c},[]),pe=g(0,100,q,_,K,Y),$=pe.pathString,ie=pe.pathStyle,Z=a(fe),xe=a(ge),Le=xe.find(function(Ue){return Object.prototype.toString.call(Ue)==="[object Object]"}),be=R(Z),Ce=u(be,1),_e=Ce[0],ke=function(){var Pe=0;return Z.map(function(Oe,Je){var Qe=xe[Je]||xe[xe.length-1],We=Object.prototype.toString.call(Qe)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(oe,")"):"",Ge=g(Pe,Oe,Qe,_,K,Y);return Pe+=Oe,V.a.createElement("path",{key:Je,className:"".concat(W,"-circle-path"),d:Ge.pathString,stroke:We,strokeLinecap:ae,strokeWidth:_,opacity:Oe===0?0:1,fillOpacity:"0",style:Ge.pathStyle,ref:_e[Je]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Ee},me),Le&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(oe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Le).sort(function(Ue,Pe){return l(Ue)-l(Pe)}).map(function(Ue,Pe){return V.a.createElement("stop",{key:Pe,offset:Ue,stopColor:Le[Ue]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:q,strokeLinecap:ae,strokeWidth:k||_,fillOpacity:"0",style:ie}),ke().reverse())};m.defaultProps=I;var E=m,P={Line:d,Circle:E}},kSUc:function(ut,qe,te){},lZu9:function(ut,qe,te){(function(re){re(te("VrN/"),te("1eCo"),te("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,L){var G=re.getMode(V,"text/html"),I=G.name=="null";function R(_){if(re.findModeByName){var k=re.findModeByName(_);k&&(_=k.mime||k.mimes[0])}var K=re.getMode(V,_);return K.name=="null"?null:K}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 F in B)B.hasOwnProperty(F)&&L.tokenTypeOverrides[F]&&(B[F]=L.tokenTypeOverrides[F]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,S=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \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 u(_,k,K){return k.f=k.inline=K,K(_,k)}function s(_,k,K){return k.f=k.block=K,K(_,k)}function x(_){return!_||!/\S/.test(_.string)}function p(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==A){var k=I;if(!k){var K=re.innerMode(G,_.htmlState);k=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}k&&(_.f=l,_.block=f,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function f(_,k){var K=_.column()===k.indentation,Y=x(k.prevLine.stream),q=k.indentedCode,ae=k.prevLine.hr,Ee=k.list!==!1,ve=(k.listStack[k.listStack.length-1]||0)+3;k.indentedCode=!1;var ge=k.indentation;if(k.indentationDiff===null&&(k.indentationDiff=k.indentation,Ee)){for(k.list=null;ge<k.listStack[k.listStack.length-1];)k.listStack.pop(),k.listStack.length?k.indentation=k.listStack[k.listStack.length-1]:k.list=!1;k.list!==!1&&(k.indentationDiff=ge-k.listStack[k.listStack.length-1])}var fe=!Y&&!ae&&!k.prevLine.header&&(!Ee||!q)&&!k.prevLine.fencedCodeEnd,me=(k.list===!1||ae||Y)&&k.indentation<=ve&&_.match(M),oe=null;if(k.indentationDiff>=4&&(q||k.prevLine.fencedCodeEnd||k.prevLine.header||Y))return _.skipToEnd(),k.indentedCode=!0,B.code;if(_.eatSpace())return null;if(K&&k.indentation<=ve&&(oe=_.match(S))&&oe[1].length<=6)return k.quote=0,k.header=oe[1].length,k.thisLine.header=!0,L.highlightFormatting&&(k.formatting="header"),k.f=k.inline,h(k);if(k.indentation<=ve&&_.eat(">"))return k.quote=K?1:k.quote+1,L.highlightFormatting&&(k.formatting="quote"),_.eatSpace(),h(k);if(!me&&!k.setext&&K&&k.indentation<=ve&&(oe=_.match(D))){var pe=oe[1]?"ol":"ul";return k.indentation=ge+_.current().length,k.list=!0,k.quote=0,k.listStack.push(k.indentation),k.em=!1,k.strong=!1,k.code=!1,k.strikethrough=!1,L.taskLists&&_.match(y,!1)&&(k.taskList=!0),k.f=k.inline,L.highlightFormatting&&(k.formatting=["list","list-"+pe]),h(k)}else{if(K&&k.indentation<=ve&&(oe=_.match(w,!0)))return k.quote=0,k.fencedEndRE=new RegExp(oe[1]+"+ *$"),k.localMode=L.fencedCodeBlockHighlighting&&R(oe[2]||L.fencedCodeBlockDefaultMode),k.localMode&&(k.localState=re.startState(k.localMode)),k.f=k.block=b,L.highlightFormatting&&(k.formatting="code-block"),k.code=-1,h(k);if(k.setext||(!fe||!Ee)&&!k.quote&&k.list===!1&&!k.code&&!me&&!v.test(_.string)&&(oe=_.lookAhead(1))&&(oe=oe.match(O)))return k.setext?(k.header=k.setext,k.setext=0,_.skipToEnd(),L.highlightFormatting&&(k.formatting="header")):(k.header=oe[0].charAt(0)=="="?1:2,k.setext=k.header),k.thisLine.header=!0,k.f=k.inline,h(k);if(me)return _.skipToEnd(),k.hr=!0,k.thisLine.hr=!0,B.hr;if(_.peek()==="[")return u(_,k,P)}return u(_,k,k.inline)}function A(_,k){var K=G.token(_,k.htmlState);if(!I){var Y=re.innerMode(G,k.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||k.md_inside&&_.current().indexOf(">")>-1)&&(k.f=l,k.block=f,k.htmlState=null)}return K}function b(_,k){var K=k.listStack[k.listStack.length-1]||0,Y=k.indentation<K,q=K+3;if(k.fencedEndRE&&k.indentation<=q&&(Y||_.match(k.fencedEndRE))){L.highlightFormatting&&(k.formatting="code-block");var ae;return Y||(ae=h(k)),k.localMode=k.localState=null,k.block=f,k.f=l,k.fencedEndRE=null,k.code=0,k.thisLine.fencedCodeEnd=!0,Y?s(_,k,k.block):ae}else return k.localMode?k.localMode.token(_,k.localState):(_.skipToEnd(),B.code)}function h(_){var k=[];if(_.formatting){k.push(B.formatting),typeof _.formatting=="string"&&(_.formatting=[_.formatting]);for(var K=0;K<_.formatting.length;K++)k.push(B.formatting+"-"+_.formatting[K]),_.formatting[K]==="header"&&k.push(B.formatting+"-"+_.formatting[K]+"-"+_.header),_.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?k.push(B.formatting+"-"+_.formatting[K]+"-"+_.quote):k.push("error"))}if(_.taskOpen)return k.push("meta"),k.length?k.join(" "):null;if(_.taskClosed)return k.push("property"),k.length?k.join(" "):null;if(_.linkHref?k.push(B.linkHref,"url"):(_.strong&&k.push(B.strong),_.em&&k.push(B.em),_.strikethrough&&k.push(B.strikethrough),_.emoji&&k.push(B.emoji),_.linkText&&k.push(B.linkText),_.code&&k.push(B.code),_.image&&k.push(B.image),_.imageAltText&&k.push(B.imageAltText,"link"),_.imageMarker&&k.push(B.imageMarker)),_.header&&k.push(B.header,B.header+"-"+_.header),_.quote&&(k.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?k.push(B.quote+"-"+_.quote):k.push(B.quote+"-"+L.maxBlockquoteDepth)),_.list!==!1){var Y=(_.listStack.length-1)%3;Y?Y===1?k.push(B.list2):k.push(B.list3):k.push(B.list1)}return _.trailingSpaceNewLine?k.push("trailing-space-new-line"):_.trailingSpace&&k.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),k.length?k.join(" "):null}function c(_,k){return _.match(C,!0)?h(k):void 0}function l(_,k){var K=k.text(_,k);if(typeof K!="undefined")return K;if(k.list)return k.list=null,h(k);if(k.taskList){var Y=_.match(y,!0)[1]===" ";return Y?k.taskOpen=!0:k.taskClosed=!0,L.highlightFormatting&&(k.formatting="task"),k.taskList=!1,h(k)}if(k.taskOpen=!1,k.taskClosed=!1,k.header&&_.match(/^#+$/,!0))return L.highlightFormatting&&(k.formatting="header"),h(k);var q=_.next();if(k.linkTitle){k.linkTitle=!1;var ae=q;q==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(_.match(new RegExp(Ee),!0))return B.linkHref}if(q==="`"){var ve=k.formatting;L.highlightFormatting&&(k.formatting="code"),_.eatWhile("`");var ge=_.current().length;if(k.code==0&&(!k.quote||ge==1))return k.code=ge,h(k);if(ge==k.code){var fe=h(k);return k.code=0,fe}else return k.formatting=ve,h(k)}else if(k.code)return h(k);if(q==="\\"&&(_.next(),L.highlightFormatting)){var me=h(k),oe=B.formatting+"-escape";return me?me+" "+oe:oe}if(q==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return k.imageMarker=!0,k.image=!0,L.highlightFormatting&&(k.formatting="image"),h(k);if(q==="["&&k.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return k.imageMarker=!1,k.imageAltText=!0,L.highlightFormatting&&(k.formatting="image"),h(k);if(q==="]"&&k.imageAltText){L.highlightFormatting&&(k.formatting="image");var me=h(k);return k.imageAltText=!1,k.image=!1,k.inline=k.f=g,me}if(q==="["&&!k.image)return k.linkText&&_.match(/^.*?\]/)||(k.linkText=!0,L.highlightFormatting&&(k.formatting="link")),h(k);if(q==="]"&&k.linkText){L.highlightFormatting&&(k.formatting="link");var me=h(k);return k.linkText=!1,k.inline=k.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?g:l,me}if(q==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var me=h(k);return me?me+=" ":me="",me+B.linkInline}if(q==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var me=h(k);return me?me+=" ":me="",me+B.linkEmail}if(L.xml&&q==="<"&&_.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var pe=_.string.indexOf(">",_.pos);if(pe!=-1){var $=_.string.substring(_.start,pe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(k.md_inside=!0)}return _.backUp(1),k.htmlState=re.startState(G),s(_,k,A)}if(L.xml&&q==="<"&&_.match(/^\/\w*?>/))return k.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ie=1,Z=_.pos==1?" ":_.string.charAt(_.pos-2);ie<3&&_.eat(q);)ie++;var xe=_.peek()||" ",Le=!/\s/.test(xe)&&(!d.test(xe)||/\s/.test(Z)||d.test(Z)),be=!/\s/.test(Z)&&(!d.test(Z)||/\s/.test(xe)||d.test(xe)),Ce=null,_e=null;if(ie%2&&(!k.em&&Le&&(q==="*"||!be||d.test(Z))?Ce=!0:k.em==q&&be&&(q==="*"||!Le||d.test(xe))&&(Ce=!1)),ie>1&&(!k.strong&&Le&&(q==="*"||!be||d.test(Z))?_e=!0:k.strong==q&&be&&(q==="*"||!Le||d.test(xe))&&(_e=!1)),_e!=null||Ce!=null){L.highlightFormatting&&(k.formatting=Ce==null?"strong":_e==null?"em":"strong em"),Ce===!0&&(k.em=q),_e===!0&&(k.strong=q);var fe=h(k);return Ce===!1&&(k.em=!1),_e===!1&&(k.strong=!1),fe}}else if(q===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return h(k);_.backUp(1)}if(L.strikethrough){if(q==="~"&&_.eatWhile(q)){if(k.strikethrough){L.highlightFormatting&&(k.formatting="strikethrough");var fe=h(k);return k.strikethrough=!1,fe}else if(_.match(/^[^\s]/,!1))return k.strikethrough=!0,L.highlightFormatting&&(k.formatting="strikethrough"),h(k)}else if(q===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return h(k);_.backUp(2)}}if(L.emoji&&q===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){k.emoji=!0,L.highlightFormatting&&(k.formatting="emoji");var ke=h(k);return k.emoji=!1,ke}return q===" "&&(_.match(/^ +$/,!1)?k.trailingSpace++:k.trailingSpace&&(k.trailingSpaceNewLine=!0)),h(k)}function a(_,k){var K=_.next();if(K===">"){k.f=k.inline=l,L.highlightFormatting&&(k.formatting="link");var Y=h(k);return Y?Y+=" ":Y="",Y+B.linkInline}return _.match(/^[^>]+/,!0),B.linkInline}function g(_,k){if(_.eatSpace())return null;var K=_.next();return K==="("||K==="["?(k.f=k.inline=E(K==="("?")":"]"),L.highlightFormatting&&(k.formatting="link-string"),k.linkHref=!0,h(k)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(_){return function(k,K){var Y=k.next();if(Y===_){K.f=K.inline=l,L.highlightFormatting&&(K.formatting="link-string");var q=h(K);return K.linkHref=!1,q}return k.match(m[_]),K.linkHref=!0,h(K)}}function P(_,k){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(k.f=U,_.next(),L.highlightFormatting&&(k.formatting="link"),k.linkText=!0,h(k)):u(_,k,l)}function U(_,k){if(_.match(/^\]:/,!0)){k.f=k.inline=j,L.highlightFormatting&&(k.formatting="link");var K=h(k);return k.linkText=!1,K}return _.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(_,k){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?k.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),k.f=k.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(_){return{f:_.f,prevLine:_.prevLine,thisLine:_.thisLine,block:_.block,htmlState:_.htmlState&&re.copyState(G,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?re.copyState(_.localMode,_.localState):null,inline:_.inline,text:_.text,formatting:!1,linkText:_.linkText,linkTitle:_.linkTitle,linkHref:_.linkHref,code:_.code,em:_.em,strong:_.strong,strikethrough:_.strikethrough,emoji:_.emoji,header:_.header,setext:_.setext,hr:_.hr,taskList:_.taskList,list:_.list,listStack:_.listStack.slice(0),quote:_.quote,indentedCode:_.indentedCode,trailingSpace:_.trailingSpace,trailingSpaceNewLine:_.trailingSpaceNewLine,md_inside:_.md_inside,fencedEndRE:_.fencedEndRE}},token:function(_,k){if(k.formatting=!1,_!=k.thisLine.stream){if(k.header=0,k.hr=!1,_.match(/^\s*$/,!0))return p(k),null;if(k.prevLine=k.thisLine,k.thisLine={stream:_},k.taskList=!1,k.trailingSpace=0,k.trailingSpaceNewLine=!1,!k.localState&&(k.f=k.block,k.f!=A)){var K=_.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(k.indentation=K,k.indentationDiff=null,K>0)return null}}return k.f(_,k)},innerMode:function(_){return _.block==A?{state:_.htmlState,mode:G}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:W}},indent:function(_,k,K){return _.block==A&&G.indent?G.indent(_.htmlState,k,K):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,k,K):re.Pass},blankLine:p,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(ut,qe,te){(function(re){re(te("VrN/"))})(function(re){"use strict";var V=re.Pos;function L(d,o){return d.line-o.line||d.ch-o.ch}var G="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function F(d,o){var u=d.cm.getTokenTypeAt(V(d.line,o));return u&&/\btag\b/.test(u)}function M(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function D(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(M(d))continue;return}if(!F(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function S(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(D(d))continue;return}if(!F(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var u=R.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(M(d))continue;return}if(!F(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(D(d))continue;return}if(!F(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function w(d,o){for(var u=[];;){var s=O(d),x,p=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(x=y(d)))return;if(x=="selfClose")continue;if(s[1]){for(var A=u.length-1;A>=0;--A)if(u[A]==s[2]){u.length=A;break}if(A<0&&(!o||o==s[2]))return{tag:s[2],from:V(p,f),to:V(d.line,d.ch)}}else u.push(s[2])}}function v(d,o){for(var u=[];;){var s=C(d);if(!s)return;if(s=="selfClose"){S(d);continue}var x=d.line,p=d.ch,f=S(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var A=u.length-1;A>=0;--A)if(u[A]==f[2]){u.length=A;break}if(A<0&&(!o||o==f[2]))return{tag:f[2],from:V(d.line,d.ch),to:V(x,p)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=O(u);if(!s||u.line!=o.line)return;var x=y(u);if(!x)return;if(!s[1]&&x!="selfClose"){var p=V(u.line,u.ch),f=w(u,s[2]);return f&&L(f.from,p)>0?{from:p,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var x=y(s),p=x&&V(s.line,s.ch),f=x&&S(s);if(!x||!f||L(s,o)>0)return;var A={from:V(s.line,s.ch),to:p,tag:f[2]};return x=="selfClose"?{open:A,close:null,at:"open"}:f[1]?{open:v(s,f[2]),close:A,at:"close"}:(s=new B(d,p.line,p.ch,u),{open:A,close:w(s,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,s){for(var x=new B(d,o.line,o.ch,u);;){var p=v(x,s);if(!p)break;var f=new B(d,o.line,o.ch,u),A=w(f,p.tag);if(A)return{open:p,close:A}}},re.scanForClosingTag=function(d,o,u,s){var x=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return w(x,u)}})},p5ED:function(ut,qe,te){"use strict";var re=te("+L6B"),V=te("2/Rp"),L=te("5Dmo"),G=te("3S7+"),I=te("k1fw"),R=te("tJVT"),B=te("cDcd"),F=te.n(B),M=te("vHTk"),D=te.n(M),y=te("yEEn"),S=te("ZW9T"),O=te("1vsH");qe.a=function(C){var w=C.name,v=C.data,d=C.theme,o=C.type,u=C.filename,s=C.monacoEditor,x=C.className,p=C.style,f=C.close,A=C.onClose,b=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],g=Object(B.useState)(""),m=Object(R.a)(g,2),E=m[0],P=m[1],U,j=1024*1024,W=10*j,_=Object(B.useRef)();o==="office"&&(U=Object(O.V)(v).filesize,U>W&&(o="other")),u&&(s.filename=u),Object(B.useEffect)(function(){var Y,q,ae=(Y=document.cookie)===null||Y===void 0||((q=Y.replace(/\s/g,""))===null||q===void 0)?void 0:q.split(";");ae==null||ae.map(function(Ee){var ve=Ee.split("=");ve[0]==="_educoder_session"&&P(ve[1])})},[]);var k=function(){if(v.startsWith("http")||v.startsWith("/")){K();return}Object(O.z)(u||"educoder",v,u)},K=function(){Object(O.x)(u||w,v)};return console.log("data:",v,"fileanme:",u," name:",w),F.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&D.a.bgBlack," ").concat(o?D.a.wrp:"hide")},f&&F.a.createElement("div",{className:D.a.close,ref:_},F.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return _.current}},F.a.createElement("span",{onClick:K},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return _.current}},F.a.createElement("span",{className:"",onClick:A},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(D.a[x]," ").concat(x," ").concat(D.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&F.a.createElement(S.b,s)),o==="audio"&&F.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"&&F.a.createElement(F.a.Fragment,null,v!=null&&v.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&F.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&F.a.createElement("embed",{className:D.a.embed,src:v}),o==="image"&&F.a.createElement(F.a.Fragment,null,F.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"&&F.a.createElement("div",null,F.a.createElement(V.a,{type:"primary",size:"large",onClick:k},F.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&F.a.createElement(V.a,{type:"primary",size:"large",onClick:k},F.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,qe,te){},"rAM+":function(ut,qe,te){"use strict";te.d(qe,"a",function(){return V});var re=te("Qw5x");function V(L,G){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(re.a)(L))||G&&L&&typeof L.length=="number"){I&&(L=I);var R=0,B=function(){};return{s:B,n:function(){return R>=L.length?{done:!0}:{done:!1,value:L[R++]}},e:function(S){throw S},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 F=!0,M=!1,D;return{s:function(){I=L[Symbol.iterator]()},n:function(){var S=I.next();return F=S.done,S},e:function(S){M=!0,D=S},f:function(){try{!F&&I.return!=null&&I.return()}finally{if(M)throw D}}}}},rUJ1:function(ut,qe){const te=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>G[b];function R(b,h){if(h){if(te.test(b))return b.replace(re,I)}else if(V.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(b){return b.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const M=/(^|[^\[])\^/g;function D(b,h){b=b.source||b,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(M,"$1"),b=b.replace(l,a),c),getRegex:()=>new RegExp(b,h)};return c}const y=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(b,h,c){if(b){let l;try{l=decodeURIComponent(F(c)).replace(y,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!S.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},w=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){C[" "+b]||(w.test(b)?C[" "+b]=b+"/":C[" "+b]=p(b,"/",!0)),b=C[" "+b];const c=b.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:b.replace(v,"$1")+h:h.charAt(0)==="/"?c?h:b.replace(d,"$1")+h:b+h}const u={exec:function(){}};function s(b){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(b[l]=c[l])}return b}function x(b,h){const c=b.replace(/\|/g,(g,m,E)=>{let P=!1,U=m;for(;--U>=0&&E[U]==="\\";)P=!P;return P?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function p(b,h,c){const l=b.length;if(l===0)return"";let a=0;for(;a<l;){const g=b.charAt(l-a-1);if(g===h&&!c)a++;else if(g!==h&&c)a++;else break}return b.substr(0,l-a)}function f(b,h){if(b.indexOf(h[1])===-1)return-1;const c=b.length;let l=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===h[0])l++;else if(b[a]===h[1]&&(l--,l<0))return a;return-1}function A(b){b&&b.sanitize&&!b.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")}ut.exports={escape:R,unescape:F,edit:D,cleanUrl:O,resolveUrl:o,noopTest:u,merge:s,splitCells:x,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:A}},ulZh:function(ut,qe,te){typeof window!="undefined"&&function(V,L){ut.exports=L()}(this,function(){return function(re){var V={};function L(G){if(V[G])return V[G].exports;var I=V[G]={i:G,l:!1,exports:{}};return re[G].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=re,L.c=V,L.d=function(G,I,R){L.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:R})},L.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},L.t=function(G,I){if(I&1&&(G=L(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(L.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)L.d(R,B,function(F){return G[F]}.bind(null,B));return R},L.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return L.d(I,"a",I),I},L.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,V,L){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(y,S,O){this.fn=y,this.context=S,this.once=O||!1}function F(y,S,O,C,w){if(typeof O!="function")throw new TypeError("The listener must be a function");var v=new B(O,C||y,w),d=I?I+S:S;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],v]:y._events[d].push(v):(y._events[d]=v,y._eventsCount++),y}function M(y,S){--y._eventsCount===0?y._events=new R:delete y._events[S]}function D(){this._events=new R,this._eventsCount=0}D.prototype.eventNames=function(){var S=[],O,C;if(this._eventsCount===0)return S;for(C in O=this._events)G.call(O,C)&&S.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(O)):S},D.prototype.listeners=function(S){var O=I?I+S:S,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var w=0,v=C.length,d=new Array(v);w<v;w++)d[w]=C[w].fn;return d},D.prototype.listenerCount=function(S){var O=I?I+S:S,C=this._events[O];return C?C.fn?1:C.length:0},D.prototype.emit=function(S,O,C,w,v,d){var o=I?I+S:S;if(!this._events[o])return!1;var u=this._events[o],s=arguments.length,x,p;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(s){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,O),!0;case 3:return u.fn.call(u.context,O,C),!0;case 4:return u.fn.call(u.context,O,C,w),!0;case 5:return u.fn.call(u.context,O,C,w,v),!0;case 6:return u.fn.call(u.context,O,C,w,v,d),!0}for(p=1,x=new Array(s-1);p<s;p++)x[p-1]=arguments[p];u.fn.apply(u.context,x)}else{var f=u.length,A;for(p=0;p<f;p++){u[p].once&&this.removeListener(S,u[p].fn,void 0,!0);switch(s){case 1:u[p].fn.call(u[p].context);break;case 2:u[p].fn.call(u[p].context,O);break;case 3:u[p].fn.call(u[p].context,O,C);break;case 4:u[p].fn.call(u[p].context,O,C,w);break;default:if(!x)for(A=1,x=new Array(s-1);A<s;A++)x[A-1]=arguments[A];u[p].fn.apply(u[p].context,x)}}}return!0},D.prototype.on=function(S,O,C){return F(this,S,O,C,!1)},D.prototype.once=function(S,O,C){return F(this,S,O,C,!0)},D.prototype.removeListener=function(S,O,C,w){var v=I?I+S:S;if(!this._events[v])return this;if(!O)return M(this,v),this;var d=this._events[v];if(d.fn)d.fn===O&&(!w||d.once)&&(!C||d.context===C)&&M(this,v);else{for(var o=0,u=[],s=d.length;o<s;o++)(d[o].fn!==O||w&&!d[o].once||C&&d[o].context!==C)&&u.push(d[o]);u.length?this._events[v]=u.length===1?u[0]:u:M(this,v)}return this},D.prototype.removeAllListeners=function(S){var O;return S?(O=I?I+S:S,this._events[O]&&M(this,O)):(this._events=new R,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,re.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,V,L){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(D,y,S){if(S=S||{},D=D.trim(),y=y.trim(),!y){if(!S.alwaysNormalize)return D;var O=M.parseURL(D);if(!O)throw new Error("Error trying to parse base URL.");return O.path=M.normalizePath(O.path),M.buildURLFromParts(O)}var C=M.parseURL(y);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return S.alwaysNormalize?(C.path=M.normalizePath(C.path),M.buildURLFromParts(C)):y;var w=M.parseURL(D);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var v=R.exec(w.path);w.netLoc=v[1],w.path=v[2]}w.netLoc&&!w.path&&(w.path="/");var d={scheme:w.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=w.netLoc,C.path[0]!=="/"))if(!C.path)d.path=w.path,C.params||(d.params=w.params,C.query||(d.query=w.query));else{var o=w.path,u=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=M.normalizePath(u)}return d.path===null&&(d.path=S.alwaysNormalize?M.normalizePath(C.path):C.path),M.buildURLFromParts(d)},parseURL:function(D){var y=I.exec(D);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(F,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};re.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(re,V,L){function G(S){var O={};function C(v){if(O[v])return O[v].exports;var d=O[v]={i:v,l:!1,exports:{}};return S[v].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=S,C.c=O,C.i=function(v){return v},C.d=function(v,d,o){C.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},C.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return C.d(d,"a",d),d},C.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},C.p="/",C.oe=function(v){throw console.error(v),v};var w=C(C.s=ENTRY_MODULE);return w.default||w}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(S){return!isNaN(1*S)}function M(S,O,C){var w={};w[C]=[];var v=O.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return w;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),s;s=u.exec(v);){if(s[3]==="dll-reference")continue;w[C].push(s[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");s=u.exec(v);)S[s[2]]||(w[C].push(s[1]),S[s[2]]=L(s[1]).m),w[s[2]]=w[s[2]]||[],w[s[2]].push(s[4]);for(var x=Object.keys(w),p=0;p<x.length;p++)for(var f=0;f<w[x[p]].length;f++)F(w[x[p]][f])&&(w[x[p]][f]=1*w[x[p]][f]);return w}function D(S){var O=Object.keys(S);return O.reduce(function(C,w){return C||S[w].length>0},!1)}function y(S,O){for(var C={main:[O]},w={main:[]},v={main:{}};D(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var u=d[o],s=C[u],x=s.pop();if(v[u]=v[u]||{},v[u][x]||!S[u][x])continue;v[u][x]=!0,w[u]=w[u]||[],w[u].push(x);for(var p=M(S,S[u][x],u),f=Object.keys(p),A=0;A<f.length;A++)C[f[A]]=C[f[A]]||[],C[f[A]]=C[f[A]].concat(p[f[A]])}return w}re.exports=function(S,O){O=O||{};var C={main:L.m},w=O.all?{main:Object.keys(C.main)}:y(C,S),v="";Object.keys(w).filter(function(x){return x!=="main"}).forEach(function(x){for(var p=0;w[x][p];)p++;w[x].push(p),C[x][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+x+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+w[x].map(function(f){return""+JSON.stringify(f)+": "+C[x][f].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+w.main.map(function(x){return""+JSON.stringify(x)+": "+C.main[x].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),s=new window.Worker(u);return s.objectURL=u,s}},"./src/config.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"hlsDefaultConfig",function(){return A}),L.d(V,"mergeConfig",function(){return h}),L.d(V,"enableStreamingMode",function(){return c});var G=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),R=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),F=L("./src/controller/subtitle-track-controller.ts"),M=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),y=L("./src/controller/cap-level-controller.ts"),S=L("./src/controller/fps-controller.ts"),O=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),w=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"),u=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(l[m]=g[m])}return l},s.apply(this,arguments)}function x(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),g.push.apply(g,m)}return g}function p(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?x(Object(g),!0).forEach(function(m){f(l,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):x(Object(g)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(g,m))})}return l}function f(l,a,g){return a in l?Object.defineProperty(l,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):l[a]=g,l}var A=p(p({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:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:M.default,capLevelController:y.default,fpsController:S.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},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:F.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:O.default,cmcdController:C.default});function b(){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 h(l,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 s({},l,a)}function c(l){var a=l.loader;if(a!==v.default&&a!==w.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var g=Object(v.fetchSupported)();g&&(l.loader=v.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),M=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function y(C,w){for(var v=0;v<w.length;v++){var d=w[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function S(C,w,v){return w&&y(C.prototype,w),v&&y(C,v),C}var O=function(){function C(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 I.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var w=C.prototype;return w.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(d,o){var u=o.frag;if(u.type===M.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=u,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.autoLevelEnabled,x=u.config,p=u.media;if(!d||!p)return;var f=o?o.stats:d.stats,A=o?o.duration:d.duration;if(f.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-f.loading.start,h=Math.abs(p.playbackRate);if(b<=500*A/h)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],g=f.total||Math.max(f.loaded,Math.round(A*a.maxBitrate/8)),m=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),E=(g-f.loaded)/m,P=p.currentTime,U=(B.BufferHelper.bufferInfo(p,P,x.maxBufferHole).end-P)/h;if(U>=2*A/h||E<=U)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var _=c[W].maxBitrate;if(j=A*_/(8*.8*m),j<U)break}if(j>=E)return;var k=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(G.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+E.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},w.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===M.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(u.sn)){var x=s?s.stats:u.stats,p=s?s.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],A=(f.loaded?f.loaded.bytes:0)+x.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:A,duration:b},f.realBitrate=Math.round(8*A/b)}if(u.bitrateTest){var h={stats:x,frag:u,part:s,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},w.onFragBuffered=function(d,o){var u=o.frag,s=o.part,x=s?s.stats:u.stats;if(x.aborted)return;if(u.type!==M.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var p=x.parsing.end-x.loading.start;this.bwEstimator.sample(p,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},w.onError=function(d,o){switch(o.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.maxAutoLevel,x=u.config,p=u.minAutoLevel,f=u.media,A=o?o.duration:d?d.duration:0,b=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,b,x.maxBufferHole).end-b)/h,a=this.findBestLevel(c,p,s,l,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=A?Math.min(A,x.maxStarvationDelay):x.maxStarvationDelay,m=x.abrBandWidthFactor,E=x.abrBandWidthUpFactor;if(!l){var P=this.bitrateTestDelay;if(P){var U=A?Math.min(A,x.maxLoadingDelay):x.maxLoadingDelay;g=U-P,D.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=E=1}}return a=this.findBestLevel(c,p,s,l+g,m,E),Math.max(a,0)},w.findBestLevel=function(d,o,u,s,x,p){for(var f,A=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),g=l==null?void 0:l.codecSet,m=b?b.duration:A?A.duration:0,E=u;E>=o;E--){var P=c[E];if(!P||g&&P.codecSet!==g)continue;var U=P.details,j=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||m,W=void 0;E<=h?W=x*d:W=p*d;var _=c[E].maxBitrate,k=_*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+_+"/"+j+"/"+s+"/"+k),W>_&&(!k||a&&!this.bitrateTestDelay||k<s))return E}return-1},S(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=O},"./src/controller/audio-stream-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-tracker.ts"),M=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),y=L("./src/loader/fragment.ts"),S=L("./src/demux/chunk-cache.ts"),O=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),w=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(A[c]=h[c])}return A},u.apply(this,arguments)}function s(A,b){A.prototype=Object.create(b.prototype),A.prototype.constructor=A,x(A,b)}function x(A,b){return x=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},x(A,b)}var p=100,f=function(A){s(b,A);function b(c,l){var a;return a=A.call(this,c,l,"[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 h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var g=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var P=g.cc;this.initPTS[g.cc]=E,this.log("InitPTS for cc: "+P+" found from main: "+E),this.videoTrackCC=P,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,g=this.trackId,m=a==null||((l=a[g])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,P=performance.now(),U=this.retryDate;(!U||P>=U||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,_=j.part,k=j.cache,K=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=k.flush(),q={frag:W,part:_,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(q),K&&A.prototype._handleFragmentLoadComplete.call(this,q)}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(),Ee=B.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),ve=Object(w.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,g=this.hls,m=this.levels,E=this.media,P=this.trackId,U=g.config;if(!m||!m[P])return;if(!E&&(this.startFragRequested||!U.startFragPrefetch))return;var j=m[P],W=j.details;if(!W||W.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(_===null)return;var k=_.len,K=this.getMaxBufferLength(),Y=this.audioSwitch;if(k>=K&&!Y)return;if(!Y&&this._streamEnded(_,W)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var q=W.fragments,ae=q[0].start,Ee=_.end;if(Y){var ve=this.getLoadPosition();Ee=ve,W.PTSKnown&&ve<ae&&((_.end>ae||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=ae+.05))}var ge=this.getNextFragment(Ee,W);if(!ge){this.bufferFlushed=!0;return}((l=ge.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Ee)},h.getMaxBufferLength=function(){var l=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(m){return new M.Level(m)})},h.onAudioTrackSwitching=function(l,a){var g=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(p):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var g,m=this.levels,E=a.details,P=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var U=m[P],j=0;if(E.live||(g=U.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!U.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,U.details)}U.details=E,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(U.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,g=l.frag,m=l.part,E=l.payload,P=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var W=j[U];console.assert(W,"Audio track is defined on fragment load progress");var _=W.details;console.assert(_,"Audio track details are defined on fragment load progress");var k=P.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new O.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[g.cc],q=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ae=!1,Ee=m?m.index:-1,ve=Ee!==-1,ge=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,E.byteLength,Ee,ve);K.push(E,q,k,"",g,m,_.totalduration,ae,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+U);var fe=this.waitingData=this.waitingData||{frag:g,part:m,cache:new S.default,complete:!1},me=fe.cache;me.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var g=a.frag,m=a.part;if(g.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(m?" p: "+m.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,m)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var g=!0,m=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);m&&m.len>.5&&(g=!this.reduceMaxBufferLength(m.len)),g&&(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}},h.onBufferFlushed=function(l,a){var g=a.type;g===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,g="audio",m=this.hls,E=l.remuxResult,P=l.chunkMeta,U=this.getCurrentContext(P);if(!U){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var j=U.frag,W=U.part,_=E.audio,k=E.text,K=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,P),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:Y.tracks})),_){var q=_.startPTS,ae=_.endPTS,Ee=_.startDTS,ve=_.endDTS;W&&(W.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ae,startDTS:Ee,endDTS:ve}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,q,ae,Ee,ve),this.bufferFragmentData(_,j,W,P)}if(K!=null&&(a=K.samples)!==null&&a!==void 0&&a.length){var ge=u({frag:j,id:g},K);m.trigger(R.Events.FRAG_PARSING_METADATA,ge)}if(k){var fe=u({frag:j,id:g},k);m.trigger(R.Events.FRAG_PARSING_USERDATA,fe)}},h._bufferInitSegment=function(l,a,g){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var m=l.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,l);var E=m.initSegment;if(E!=null&&E.byteLength){var P={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,P)}this.tick()},h.loadFragment=function(l,a,g){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,l,a,g)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},b}(I.default);V.default=f},"./src/controller/audio-track-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(O,C){for(var w=0;w<C.length;w++){var v=C[w];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(O,v.key,v)}}function M(O,C,w){return C&&F(O.prototype,C),w&&F(O,w),O}function D(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,y(O,C)}function y(O,C){return y=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},y(O,C)}var S=function(O){D(C,O);function C(v){var d;return d=O.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 w=C.prototype;return w.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(d,o){var u=o.id,s=o.details,x=this.tracksInGroup[u];if(!x){this.warn("Invalid audio track id "+u);return}var p=x.details;x.details=o.details,this.log("audioTrack "+u+" loaded ["+s.startSN+"-"+s.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,p))},w.onLevelLoading=function(d,o){this.switchLevel(o.level)},w.onLevelSwitching=function(d,o){this.switchLevel(o.level)},w.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var s=this.tracks.filter(function(p){return!u||p.groupId===u});this.selectDefaultTrack&&!s.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var x={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},w.onError=function(d,o){if(O.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)},w.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 u=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],x=s.id,p=s.groupId,f=p===void 0?"":p,A=s.name,b=s.type,h=s.url;if(this.trackId=d,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:f,name:A,type:b,url:h}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,u==null?void 0:u.details);this.loadPlaylist(c)},w.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var s=o[u];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},w.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,s=o.groupId,x=o.url;if(d)try{x=d.addDirectives(x)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:x,id:u,groupId:s,deliveryDirectives:d||null})}},M(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=S},"./src/controller/base-playlist-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return M});var G=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),R=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),M=function(){function D(S,O){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,O+":"),this.warn=B.logger.warn.bind(B.logger,O+":"),this.hls=S}var y=D.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(O,C){C.fatal&&C.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(O,C){var w=C==null?void 0:C.renditionReports;if(w)for(var v=0;v<w.length;v++){var d=w[v],o=""+d.URI;if(o===O.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var x=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&x>C.partTarget&&(s+=1)}if(Object(G.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(G.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,C,w){var v=this,d=C.details,o=C.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||w!=null&&w.live){if(d.reloaded(w),w&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),w&&d.fragments.length>0&&Object(R.mergeDetails)(w,d),!this.canLoad||!d.live)return;var s,x=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,A=d.lastPartSn,b=d.endSN,h=d.lastPartIndex,c=h!==-1,l=A===b,a=f?0:h;c?(x=l?b+1:A,p=l?a:h+1):x=b+1;var g=d.age,m=g+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(w&&E>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var P=Math.floor(E/d.targetduration);if(x+=P,p!==void 0){var U=Math.round(E%d.targetduration/d.partTarget);p+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+E+" skip sn "+P+" to part "+p)}d.tuneInGoal=E}if(s=this.getDeliveryDirectives(d,C.deliveryDirectives,x,p),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,C.deliveryDirectives,x,p);var j=Object(R.computeReloadInterval)(d,o);x!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},j)}else this.clearTimer()},y.getDeliveryDirectives=function(O,C,w,v){var d=Object(I.getSkipValue)(O,w);return C!=null&&C.skip&&O.deltaUpdateFailed&&(w=C.msn,v=C.part,d=I.HlsSkip.No),new I.HlsUrlParameters(w,v,d)},y.retryLoadingOrFail=function(O){var C=this,w=this.hls.config,v=this.retryCount<w.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return v},D}()},"./src/controller/base-stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"State",function(){return b}),L.d(V,"default",function(){return h});var G=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),R=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts"),M=L("./src/events.ts"),D=L("./src/errors.ts"),y=L("./src/types/transmuxer.ts"),S=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),w=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"),u=L("./src/types/loader.ts");function s(c,l){for(var a=0;a<l.length;a++){var g=l[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function x(c,l,a){return l&&s(c.prototype,l),a&&s(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,A(c,l)}function A(c,l){return A=Object.setPrototypeOf||function(g,m){return g.__proto__=m,g},A(c,l)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){f(l,c);function l(g,m,E){var P;return P=c.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=b.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=E,P.log=F.logger.log.bind(F.logger,E+":"),P.warn=F.logger.warn.bind(F.logger,E+":"),P.hls=g,P.fragmentLoader=new v.default(g.config),P.fragmentTracker=m,P.config=g.config,P.decrypter=new d.default(g,g.config),g.on(M.Events.KEY_LOADED,P.onKeyLoaded,p(P)),P}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,E){var P=this.fragCurrent,U=this.fragmentTracker;if(!E.live&&P&&P.sn===E.endSN&&!m.nextStart){var j=U.getState(P);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var P=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,P=this.media,U=this.mediaBuffer,j=this.state,W=P?P.currentTime:0,_=B.BufferHelper.bufferInfo(U||P,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(E&&!_.len){var k=m.maxFragLookUpTolerance,K=E.start-k,Y=E.start+E.duration+k,q=W>Y;(W<K||q)&&(q&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=W),!this.loadedmetadata&&!_.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,E){if(this.state!==b.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var P=this.levels[E.frag.level].details;P&&this.loadFragment(E.frag,P,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(M.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(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(M.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,P){this._loadFragForPlayback(m,E,P)},a._loadFragForPlayback=function(m,E,P){var U=this,j=function(_){if(U.fragContextChanged(m)){U.warn("Fragment "+m.sn+(_.part?" p: "+_.part.index:"")+" of level "+m.level+" was dropped during download."),U.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,U._handleFragmentLoadProgress(_)};this._doFragLoad(m,E,P,j).then(function(W){if(!W)return;U.fragLoadError=0;var _=U.state;if(U.fragContextChanged(m)){(_===b.FRAG_LOADING||_===b.BACKTRACKING||!U.fragCurrent&&_===b.PARSING)&&(U.fragmentTracker.removeFragment(m),U.state=b.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+m.sn+" of level "+m.level),U.hls.trigger(M.Events.FRAG_LOADED,W),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(m,W),U.resetFragmentLoading(m);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,P){if(P===void 0&&(P=null),!(m-E))return;var U={startOffset:m,endOffset:E,type:P};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(P){if(!P||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return P}).then(function(P){var U=E.hls,j=P.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var _=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(k){var K=self.performance.now();return U.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:k,stats:{tstart:_,tdecrypt:K}}),P.payload=k,P})}return P}).then(function(P){var U=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var _=W[m.level].details;console.assert(_,"Level details are defined when init segment is loaded");var k=m.stats;E.state=b.IDLE,E.fragLoadError=0,m.data=new Uint8Array(P.payload),k.parsing.start=k.buffering.start=self.performance.now(),k.parsing.end=k.buffering.end=self.performance.now(),P.frag===U&&j.trigger(M.Events.FRAG_BUFFERED,{stats:k,frag:U,part:null,id:m.type}),E.tick()}).catch(function(P){E.warn(P),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(P))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var P=m.frag,U=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(k){return!k}),_=new y.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,U?U.index:-1,!W);E.flush(_)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,P,U){var j=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(m.start,P||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&U){P>m.end&&E.fragmentHint&&(m=E.fragmentHint);var _=this.getNextPart(W,m,P);if(_>-1){var k=W[_];return this.log("Loading part sn: "+m.sn+" p: "+k.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+_+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=k.start+k.duration,this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:W[_],targetBufferTime:P}),this.doFragPartsLoad(m,W,_,U).catch(function(K){return j.handleFragLoadError(K)})}else if(!m.url||this.loadedEndOfParts(W,P))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(P.toFixed(3))),Object(G.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:P}),this.fragmentLoader.load(m,U).catch(function(K){return j.handleFragLoadError(K)})},a.doFragPartsLoad=function(m,E,P,U){var j=this;return new Promise(function(W,_){var k=[],K=function Y(q){var ae=E[q];j.fragmentLoader.loadPart(m,ae,U).then(function(Ee){k[ae.index]=Ee;var ve=Ee.part;j.hls.trigger(M.Events.FRAG_LOADED,Ee);var ge=E[q+1];if(ge&&ge.fragment===m)Y(q+1);else return W({frag:m,part:ve,partsLoaded:k})}).catch(_)};K(P)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(M.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var P=E.frag,U=E.part,j=E.level,W=self.performance.now();P.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(P,U,j,m.partial)},a.getCurrentContext=function(m){var E=this.levels,P=m.level,U=m.sn,j=m.part;if(!E||!E[P])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+P+". The current chunk will not be buffered."),null;var W=E[P],_=j>-1?Object(w.getPartWith)(W,U,j):null,k=_?_.fragment:Object(w.getFragmentWithSN)(W,U,this.fragCurrent);return k?{frag:k,part:_,level:W}:null},a.bufferFragmentData=function(m,E,P,U){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,_=j;if(j&&W&&(_=Object(S.appendUint8Array)(j,W)),!_||!_.length)return;var k={type:m.type,frag:E,part:P,chunkMeta:U,parent:E.type,data:_};this.hls.trigger(M.Events.BUFFER_APPENDING,k),m.dropped&&m.independent&&!P&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var P=E.currentTime,U=B.BufferHelper.bufferInfo(E,P,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),_=Math.max(Math.min(m.start-W,U.end-W),P+W);m.start-_>W&&this.flushMainBuffer(_,m.start)},a.getFwdBufferInfo=function(m,E){var P=this.config,U=this.getLoadPosition();if(!Object(G.isFiniteNumber)(U))return null;var j=B.BufferHelper.bufferInfo(m,U,P.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,E);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,U,Math.max(j.nextStart,P.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var E=this.config,P;return m?P=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):P=E.maxBufferLength,Math.min(P,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,P=m||E.maxBufferLength;return E.maxMaxBufferLength>=P?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var P,U,j=E.fragments,W=j.length;if(!W)return null;var _=this.config,k=j[0].start,K;if(E.live){var Y=_.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(E,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:m)}else m<=k&&(K=j[0]);if(!K){var q=_.lowLatencyMode?E.partEnd:E.fragmentEnd;K=this.getFragmentAtPosition(m,q,E)}return(P=K)!==null&&P!==void 0&&P.initSegment&&!((U=K)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},a.getNextPart=function(m,E,P){for(var U=-1,j=!1,W=!0,_=0,k=m.length;_<k;_++){var K=m[_];if(W=W&&!K.independent,U>-1&&P<K.start)break;var Y=K.loaded;!Y&&(j||K.independent||W)&&K.fragment===E&&(U=_),j=Y}return U},a.loadedEndOfParts=function(m,E){var P=m[m.length-1];return P&&E>P.start&&P.loaded},a.getInitialLiveFragment=function(m,E){var P=this.fragPrevious,U=null;if(P){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),U=Object(C.findFragmentByPDT)(E,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=P.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=E[j-m.startSN];P.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(C.findFragWithCC)(E,P.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var _=this.hls.liveSyncPosition;_!==null&&(U=this.getFragmentAtPosition(_,this.bitrateTest?m.fragmentEnd:m.edge,m))}return U},a.getFragmentAtPosition=function(m,E,P){var U=this.config,j=this.fragPrevious,W=P.fragments,_=P.endSN,k=P.fragmentHint,K=U.maxFragLookUpTolerance,Y=!!(U.lowLatencyMode&&P.partList&&k);Y&&k&&!this.bitrateTest&&(W=W.concat(k),_=k.sn);var q;if(m<E){var ae=m>E-K?0:K;q=Object(C.findFragmentByPTS)(j,W,m,ae)}else q=W[W.length-1];if(q){var Ee=q.sn-P.startSN,ve=j&&q.level===j.level,ge=W[Ee+1],fe=this.fragmentTracker.getState(q);if(fe===R.FragmentState.BACKTRACKED){q=null;for(var me=Ee;W[me]&&this.fragmentTracker.getState(W[me])===R.FragmentState.BACKTRACKED;)j?q=W[me--]:q=W[--me];q||(q=ge)}else j&&q.sn===j.sn&&!Y&&(ve&&(q.sn<_&&this.fragmentTracker.getState(ge)!==R.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+ge.sn),q=ge):q=null))}return q},a.synchronizeToLiveEdge=function(m){var E=this.config,P=this.media;if(!P)return;var U=this.hls.liveSyncPosition,j=P.currentTime,W=m.fragments[0].start,_=m.edge,k=j>=W-E.maxFragLookUpTolerance&&j<=_;if(U!==null&&P.duration>U&&(j<U||!k)){var K=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!k&&P.readyState<4||j<_-K)&&(this.loadedmetadata||(this.nextLoadPosition=U),P.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+_+", reset currentTime to : "+U.toFixed(3)),P.currentTime=U))}},a.alignPlaylists=function(m,E){var P=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,W=U!==null?P[U]:null,_=m.fragments.length;if(!_)return this.warn("No fragments in live playlist"),0;var k=m.fragments[0].start,K=!E,Y=m.alignedSliding&&Object(G.isFiniteNumber)(k);if(K||!Y&&!k){Object(O.alignStream)(j,W,m);var q=m.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+_),q}return k},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var P=this.startPosition;if(P<E&&(P=-1),P===-1||this.lastCurrentTime===-1){var U=m.startTimeOffset;Object(G.isFiniteNumber)(U)?(P=E+U,U<0&&(P+=m.totalduration),P=Math.min(Math.max(E,P),E+m.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+P),this.startPosition=P):m.live?P=this.hls.liveSyncPosition||E:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},a.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var P=E.frag;if(!P||P.type!==m)return;var U=this.fragCurrent;console.assert(U&&P.sn===U.sn&&P.level===U.level&&P.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+m+" "+P.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(F.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,E,P){if(!m)return;var U=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,U,P),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,E,P,U){var j=this,W=P.details;console.assert(!!W,"level.details must be defined");var _=Object.keys(m.elementaryStreams).reduce(function(k,K){var Y=m.elementaryStreams[K];if(Y){var q=Y.endPTS-Y.startPTS;if(q<=0)return j.warn("Could not parse fragment "+m.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),k||!1;var ae=U?0:Object(w.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:W,level:P,drift:ae,type:K,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return k},!1);_?(this.state=b.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(l,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),y=L("./src/controller/buffer-operation-queue.ts"),S=Object(M.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function w(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,s=o.media,x=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:s})),x&&x.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=w.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(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&S){var x=this.mediaSource=new S;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(x),this._objectUrl=s.src}},v.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(x){R.logger.warn("[buffer-controller]: onMediaDetaching: "+x.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(x){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",x)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,u){var s=this,x=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(p){if(x){var f=s.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var A=u[p],b=A.codec,h=A.levelCodec,c=A.container,l=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||b).replace(O,"$1");if(l!==a){var g=c+";codecs="+(h||b);s.appendChangeType(p,g)}}}else s.pendingTracks[p]=u[p]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,u){var s=this,x=this.operationQueue,p={execute:function(){var A=s.sourceBuffer[o];A&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),A.changeType(u)),x.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};x.append(p,o)},v.onBufferAppending=function(o,u){var s=this,x=this.hls,p=this.operationQueue,f=this.tracks,A=u.data,b=u.type,h=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[b],g=self.performance.now();a.start=g;var m=h.stats.buffering,E=c?c.stats.buffering:null;m.start===0&&(m.start=g),E&&E.start===0&&(E.start=g);var P=f.audio,U=b==="audio"&&l.id===1&&(P==null?void 0:P.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),U){var _=s.sourceBuffer[b];if(_){var k=h.start-_.timestampOffset;Math.abs(k)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+k+") sn: "+h.sn+")"),_.timestampOffset=h.start)}}s.appendExecutor(A,b)},onStart:function(){},onComplete:function(){var _=self.performance.now();a.executeEnd=a.end=_,m.first===0&&(m.first=_),E&&E.first===0&&(E.first=_);var k=s.sourceBuffer,K={};for(var Y in k)K[Y]=F.BufferHelper.getBuffered(k[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:K})},onError:function(_){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",_);var k={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?k.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,k.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>x.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),k.fatal=!0)),x.trigger(I.Events.ERROR,k)}};p.append(j,b)},v.onBufferFlushing=function(o,u){var s=this,x=this.operationQueue,p=function(A){return{execute:s.removeExecutor.bind(s,A,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:A})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",h)}}};u.type?x.append(p(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){x.append(p(f),f)})},v.onFragParsed=function(o,u){var s=this,x=u.frag,p=u.part,f=[],A=p?p.elementaryStreams:x.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&f.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();x.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var l=p?p.stats:x.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:x,part:p,stats:l,id:x.type})};f.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(b,f)},v.onFragChanged=function(o,u){this.flushBackBuffer()},v.onBufferEos=function(o,u){var s=this,x=this.getSourceBufferTypes().reduce(function(p,f){var A=s.sourceBuffer[f];return(!u.type||u.type===f)&&(A&&!A.ended&&(A.ended=!0,R.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!A||A.ended)},!0);x&&this.blockBuffers(function(){var p=s.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},v.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,x=this.sourceBuffer;if(!s||u===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(f)||f<0)return;var A=s.currentTime,b=u.levelTargetDuration,h=Math.max(f,b),c=Math.floor(A/b)*b-h;p.forEach(function(l){var a=x[l];if(a){var g=F.BufferHelper.getBuffered(a);g.length>0&&c>g.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,x=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=s.duration,A=Object(G.isFiniteNumber)(x.duration)?x.duration:0;o.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(o)):(p>A&&p>f||!Object(G.isFiniteNumber)(f))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),x.duration=p)},v.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,x=s.length;if(x&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var p=Math.max(0,s[0].start),f=Math.max(p,p+o.totalduration);u.setLiveSeekableRange(p,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,x=Object.keys(s).length;if(x&&!o||x===2){this.createSourceBuffers(s),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){u.executeNext(f)})}},v.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var p in o)if(!u[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var A=f.levelCodec||f.codec,b=f.container+";codecs="+A;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=u[p]=s.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:h,codec:A,container:f.container,levelCodec:f.levelCodec,id:f.id},x++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}x&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},v._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,u){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(u)},v.removeExecutor=function(o,u,s){var x=this.media,p=this.mediaSource,f=this.operationQueue,A=this.sourceBuffer,b=A[o];if(!x||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(x.duration)?x.duration:Infinity,c=Object(G.isFiniteNumber)(p.duration)?p.duration:Infinity,l=Math.max(0,u),a=Math.min(s,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,u){var s=this.operationQueue,x=this.sourceBuffer,p=x[u];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}p.ended=!1,console.assert(!p.updating,u+" sourceBuffer must not be updating"),p.appendBuffer(o)},v.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var x=this.operationQueue,p=u.map(function(f){return x.appendBlocker(f)});Promise.all(p).then(function(){o(),u.forEach(function(f){var A=s.sourceBuffer[f];(!A||!A.updating)&&x.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,u,s){var x=this.sourceBuffer[o];if(!x)return;var p=s.bind(this,o);this.listeners[o].push({event:u,listener:p}),x.addEventListener(u,p)},v.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return I});var G=L("./src/utils/logger.ts"),I=function(){function R(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var B=R.prototype;return B.append=function(M,D){var y=this.queues[D];y.push(M),y.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(M,D){var y=this.queues[D];y.unshift(M),this.executeNext(D)},B.appendBlocker=function(M){var D,y=new Promise(function(O){D=O}),S={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,M),y},B.executeNext=function(M){var D=this.buffers,y=this.queues,S=D[M],O=y[M];if(O.length){var C=O[0];try{C.execute()}catch(w){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(w),(!S||!S.updating)&&(O.shift(),this.executeNext(M))}}},B.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},B.current=function(M){return this.queues[M][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts");function I(F,M){for(var D=0;D<M.length;D++){var y=M[D];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(F,y.key,y)}}function R(F,M,D){return M&&I(F.prototype,M),D&&I(F,D),F}var B=function(){function F(D){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=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=F.prototype;return M.setStreamController=function(y){this.streamController=y},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var y=this.hls;y.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var y=this.hls;y.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(y,S){F.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},M.onMediaAttaching=function(y,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},M.onManifestParsed=function(y,S){var O=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},M.onBufferCodecs=function(y,S){var O=this.hls;O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(y.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},M.getMaxLevel=function(y){var S=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(w,v){return F.isLevelAllowed(v,S.restrictedLevels)&&v<=y});return this.clientRect=null,F.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,S={width:0,height:0};if(y){var O=y.getBoundingClientRect();S.width=O.width,S.height=O.height,!S.width&&!S.height&&(S.width=O.right-O.left||y.width||0,S.height=O.bottom-O.top||y.height||0)}return this.clientRect=S,S},F.isLevelAllowed=function(y,S){return S===void 0&&(S=[]),S.indexOf(y)===-1},F.getMaxLevelByMediaSize=function(y,S,O){if(!y||!y.length)return-1;for(var C=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},w=y.length-1,v=0;v<y.length;v+=1){var d=y[v];if((d.width>=S||d.height>=O)&&C(d,y[v+1])){w=v;break}}return w},R(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(S){}return y}}]),F}();V.default=B},"./src/controller/cmcd-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function F(w,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(w,o.key,o)}}function M(w,v,d){return v&&F(w.prototype,v),d&&F(w,d),w}function D(w,v){var d=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(d)return(d=d.call(w)).next.bind(d);if(Array.isArray(w)||(d=y(w))||v&&w&&typeof w.length=="number"){d&&(w=d);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(w,v){if(!w)return;if(typeof w=="string")return S(w,v);var d=Object.prototype.toString.call(w).slice(8,-1);if(d==="Object"&&w.constructor&&(d=w.constructor.name),d==="Map"||d==="Set")return Array.from(w);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return S(w,v)}function S(w,v){(v==null||v>w.length)&&(v=w.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=w[d];return o}function O(){return O=Object.assign||function(w){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(w[o]=d[o])}return w},O.apply(this,arguments)}var C=function(){function w(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(x){try{o.apply(x,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(x){try{var p=x.frag,f=o.hls.levels[p.level],A=o.getObjectType(p),b={d:p.duration*1e3,ot:A};(A===I.CMCDObjectType.VIDEO||A===I.CMCDObjectType.AUDIO||A==I.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(A),b.bl=o.getBufferLength(A)),o.apply(x,b)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var u=this.config=d.config,s=u.cmcd;s!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||w.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=w.prototype;return v.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.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,u){this.media=u.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,u){var s,x;this.audioBuffer=(s=u.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(x=u.tracks.video)===null||x===void 0?void 0:x.buffer},v.createData=function(){var o;return{v:I.CMCDVersion,sf:I.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,u){u===void 0&&(u={}),O(u,this.createData());var s=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&s&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var x=w.toHeaders(u);if(!Object.keys(x).length)return;o.headers||(o.headers={}),O(o.headers,x)}else{var p=w.toQuery(u);if(!p)return;o.url=w.appendQueryToUri(o.url,p)}},v.getObjectType=function(o){var u=o.type;return u==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:u==="audio"?I.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var u=0,s=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=D(s),p;!(p=x()).done;){var f=p.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},v.getBufferLength=function(o){var u=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var x=R.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return x.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function x(f){this.loader=void 0,this.loader=new s(f)}var p=x.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,h){u(A),this.loader.load(A,b,h)},M(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},v.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function x(f){this.loader=void 0,this.loader=new s(f)}var p=x.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,b,h){u(A),this.loader.load(A,b,h)},M(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},w.serialize=function(o){for(var u=[],s=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},x=function(U){return Math.round(U)},p=function(U){return x(U/100)*100},f=function(U){return encodeURIComponent(U)},A={br:x,d:x,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:x},b=Object.keys(o||{}).sort(),h=D(b),c;!(c=h()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var g=A[l];g&&(a=g(a));var m=typeof a,E=void 0;l==="ot"||l==="sf"||l==="st"?E=l+"="+a:m==="boolean"?E=l:m==="number"?E=l+"="+a:E=l+"="+JSON.stringify(a),u.push(E)}return u.join(",")},w.toHeaders=function(o){for(var u=Object.keys(o),s={},x=["Object","Request","Session","Status"],p=[{},{},{},{}],f={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,b=u;A<b.length;A++){var h=b[A],c=f[h]!=null?f[h]:1;p[c][h]=o[h]}for(var l=0;l<p.length;l++){var a=w.serialize(p[l]);a&&(s["CMCD-"+x[l]]=a)}return s},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,u){if(!u)return o;var s=o.includes("?")?"&":"?";return""+o+s+u},w}()},"./src/controller/eme-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function F(C,w){for(var v=0;v<w.length;v++){var d=w[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function M(C,w,v){return w&&F(C.prototype,w),v&&F(C,v),C}var D=3,y=function(w,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),v.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},S=function(w,v,d,o){switch(w){case B.KeySystems.WIDEVINE:return y(v,d,o);default:throw new Error("Unknown key-system: "+w)}},O=function(){function C(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 w=C.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.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+'"')},w._attemptKeySystemAccess=function(d,o,u){var s=this,x=S(d,o,u,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(d,x);this.mediaKeysPromise=p.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),p.catch(function(f){R.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},w._onMediaKeySystemAccessObtained=function(d,o){var u=this;R.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var x=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return s.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),p});return x.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),x},w._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},w._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){R.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},w.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(x){if(!o._media)return;o._attemptSetMediaKeys(x),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},w._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){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(d,o){var u=this,s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var x=s.mediaKeysSession;if(!x){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,x.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),u.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(d,o,u){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,u);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,s,d),x=void 0}catch(p){R.logger.error(p)}try{s.readyState||s.open("POST",d,!0),x&&x.call(this.hls,s,d)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return s},w._onLicenseRequestReadyStageChange=function(d,o,u,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var x=d.response,p=this._licenseResponseCallback;if(p)try{x=p.call(this.hls,d,o)}catch(A){R.logger.error(A)}s(x)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=D-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}break}},w._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},w._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),x=this._createLicenseXhr(s,d,o);R.logger.log("Sending license request to URL: "+s);var p=this._generateLicenseRequestChallenge(u,d);x.send(p)}catch(f){R.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),s=o.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},M(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=O},"./src/controller/fps-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=function(){function B(M){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=M,this.registerListeners()}var F=B.prototype;return F.setStreamController=function(D){this.streamController=D},F.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(D,y){var S=this.hls.config;if(S.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(D,y,S){var O=performance.now();if(y){if(this.lastTime){var C=O-this.lastTime,w=S-this.lastDroppedFrames,v=y-this.lastDecodedFrames,d=1e3*w/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:w,currentDecoded:v,totalDroppedFrames:S}),d>0&&w>o.config.fpsDroppedMonitoringThreshold*v){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=S,this.lastDecodedFrames=y}},F.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var y=D.getVideoPlaybackQuality();this.checkFPS(D,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"findFragmentByPDT",function(){return R}),L.d(V,"findFragmentByPTS",function(){return B}),L.d(V,"fragmentWithinToleranceTest",function(){return F}),L.d(V,"pdtWithinToleranceTest",function(){return M}),L.d(V,"findFragWithCC",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function R(y,S,O){if(S===null||!Array.isArray(y)||!y.length||!Object(G.isFiniteNumber)(S))return null;var C=y[0].programDateTime;if(S<(C||0))return null;var w=y[y.length-1].endProgramDateTime;if(S>=(w||0))return null;O=O||0;for(var v=0;v<y.length;++v){var d=y[v];if(M(S,O,d))return d}return null}function B(y,S,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var w=null;if(y?w=S[y.sn-S[0].sn+1]||null:O===0&&S[0].start===0&&(w=S[0]),w&&F(O,C,w)===0)return w;var v=I.default.search(S,F.bind(null,O,C));return v||w}function F(y,S,O){y===void 0&&(y=0),S===void 0&&(S=0);var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=y?1:O.start-C>y&&O.start?-1:0}function M(y,S,O){var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,w=O.endProgramDateTime||0;return w-C>y}function D(y,S){return I.default.search(y,function(O){return O.cc<S?1:O.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"FragmentState",function(){return R}),L.d(V,"FragmentTracker",function(){return B});var G=L("./src/events.ts"),I=L("./src/types/loader.ts"),R;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(R||(R={}));var B=function(){function D(S){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=S,this._registerListeners()}var y=D.prototype;return y._registerListeners=function(){var O=this.hls;O.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,C){if(C===I.PlaylistLevelType.MAIN){var w=this.activeFragment,v=this.activeParts;if(!w)return null;if(v)for(var d=v.length;d--;){var o=v[d],u=o?o.end:w.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(w.start<=O&&w.appendedPTS!==void 0&&O<=w.appendedPTS)return w}return this.getBufferedFrag(O,C)},y.getBufferedFrag=function(O,C){for(var w=this.fragments,v=Object.keys(w),d=v.length;d--;){var o=w[v[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var u=o.body;if(u.start<=O&&O<=u.end)return u}}return null},y.detectEvictedFragments=function(O,C,w){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===w&&v.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(s){var x=!v.isTimeBuffered(s.startPTS,s.endPTS,C);return x&&v.removeFragment(o.body),x})})},y.detectPartialFragments=function(O){var C=this,w=this.timeRanges,v=O.frag,d=O.part;if(!w||v.sn==="initSegment")return;var o=M(v),u=this.fragments[o];if(!u)return;Object.keys(w).forEach(function(s){var x=v.elementaryStreams[s];if(!x)return;var p=w[s],f=d!==null||x.partial===!0;u.range[s]=C.getBufferedTimes(v,d,f,p)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(O){var C=M(O),w=this.fragments[C];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},y.getBufferedTimes=function(O,C,w,v){for(var d={time:[],partial:w},o=C?C.start:O.start,u=C?C.end:O.end,s=O.minEndPTS||u,x=O.maxStartPTS||o,p=0;p<v.length;p++){var f=v.start(p)-this.bufferPadding,A=v.end(p)+this.bufferPadding;if(x>=f&&s<=A){d.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(u,v.end(p))});break}else if(o<A&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(p)),endPTS:Math.min(u,v.end(p))});else if(u<=f)break}return d},y.getPartialFragment=function(O){var C=null,w,v,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(x){var p=s[x];if(!p)return;F(p)&&(v=p.body.start-u,d=p.body.end+u,O>=v&&O<=d&&(w=Math.min(O-v,d-O),o<=w&&(C=p.body,o=w)))}),C},y.getState=function(O){var C=M(O),w=this.fragments[C];return w?w.buffered?F(w)?R.PARTIAL:R.OK:w.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},y.backtrack=function(O,C){var w=M(O),v=this.fragments[w];if(!v||v.backtrack)return null;var d=v.backtrack=C||v.loaded;return v.loaded=null,d},y.getBacktrackData=function(O){var C=M(O),w=this.fragments[C];if(w){var v,d=w.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,C,w){for(var v,d,o=0;o<w.length;o++){if(v=w.start(o)-this.bufferPadding,d=w.end(o)+this.bufferPadding,O>=v&&C<=d)return!0;if(C<=v)return!1}return!1},y.onFragLoaded=function(O,C){var w=C.frag,v=C.part;if(w.sn==="initSegment"||w.bitrateTest||v)return;var d=M(w);this.fragments[d]={body:w,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,C){var w=this,v=C.frag,d=C.part,o=C.timeRanges;if(v.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var x=o[s];if(w.detectEvictedFragments(s,x),!d)for(var p=0;p<x.length;p++)v.appendedPTS=Math.max(x.end(p),v.appendedPTS||0)})},y.onFragBuffered=function(O,C){this.detectPartialFragments(C)},y.hasFragment=function(O){var C=M(O);return!!this.fragments[C]},y.removeFragmentsInRange=function(O,C,w){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===w&&u.start<C&&u.end>O&&v.removeFragment(u)}})},y.removeFragment=function(O){var C=M(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function F(D){var y,S;return D.buffered&&(((y=D.range.video)===null||y===void 0?void 0:y.partial)||((S=D.range.audio)===null||S===void 0?void 0:S.partial))}function M(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"STALL_MINIMUM_DURATION_MS",function(){return F}),L.d(V,"MAX_START_GAP_JUMP",function(){return M}),L.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(V,"SKIP_BUFFER_RANGE_START",function(){return y}),L.d(V,"default",function(){return S});var G=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts"),B=L("./src/utils/logger.ts"),F=250,M=2,D=.1,y=.05,S=function(){function O(w,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=w,this.media=v,this.fragmentTracker=d,this.hls=o}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(v){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,x=o.seeking,p=this.seeking&&!x,f=!this.seeking&&x;if(this.seeking=x,s!==v){if(this.moved=!0,u!==null){if(this.stallReported){var A=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var b=G.BufferHelper.bufferInfo(o,s,0),h=b.len>0,c=b.nextStart||0;if(!h&&!c)return;if(x){var l=b.len>M,a=!c||c-s>M&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,m=Math.max(c,b.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=E==null||((g=E.details)===null||g===void 0)?void 0:g.live,U=P?E.details.targetduration*2:M;if(m>0&&m<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var W=j-u;!x&&W>=F&&this._reportStall(b.len);var _=G.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(_,W)},C._tryFixBufferStall=function(v,d){var o=this.config,u=this.fragmentTracker,s=this.media,x=s.currentTime,p=u.getPartialFragment(x);if(p){var f=this._trySkipBufferHole(p);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())},C._reportStall=function(v){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},C._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,x=0,p=G.BufferHelper.getBuffered(u),f=0;f<p.length;f++){var A=p.start(f);if(s+d.maxBufferHole>=x&&s<A){var b=Math.max(A+y,u.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,v&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+b,frag:v}),b}x=p.end(f)}return 0},C._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var x=u+s*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+x),o.currentTime=x,d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/demux/id3.ts"),B=.25,F=function(){function M(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var D=M.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var S=this.hls;S.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var S=this.hls;S.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(S,O){this.media=O.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(S){if(!this.media)return;for(var O=0;O<S.length;O++){var C=S[O];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(S,O){if(!this.media)return;var C=O.frag,w=O.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<w.length;d++){var o=R.getID3Frames(w[d].data);if(o){var u=w[d].pts,s=d<w.length-1?w[d+1].pts:C.end,x=s-u;x<=0&&(s=u+B);for(var p=0;p<o.length;p++){var f=o[p];if(!R.isTimeStampFrame(f)){var A=new v(u,s,"");A.value=f,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(S,O){var C=O.startOffset,w=O.endOffset,v=O.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,C,w)}},M}();V.default=F},"./src/controller/latency-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return M});var G=L("./src/errors.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts");function B(D,y){for(var S=0;S<y.length;S++){var O=y[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function F(D,y,S){return y&&B(D.prototype,y),S&&B(D,S),D}var M=function(){function D(S){var O=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 O.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var y=D.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},y.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(O,C){var w=C.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(O,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var s=w-u,x=Math.min(this.maxLatency,u+C.targetduration),p=s<x;if(C.live&&p&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,A))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},F(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,w=O.partHoldBack,v=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,x=this.hls.userConfig,p=s&&w||C;(x.liveSyncDuration||x.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:u*v);var f=v,A=1;return p+Math.min(this.stallCount*A,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,w=this.levelDetails;if(O===null||C===null||w===null)return null;var v=w.edge,d=O-C-this.edgeStalled,o=v-w.totalduration,u=v-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var w=O.buffered.length;return w?O.buffered.end(w-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return d});var G=L("./src/types/level.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),F=L("./src/controller/level-helper.ts"),M=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var x in s)Object.prototype.hasOwnProperty.call(s,x)&&(o[x]=s[x])}return o},y.apply(this,arguments)}function S(o,u){for(var s=0;s<u.length;s++){var x=u[s];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),o}function C(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,w(o,u)}function w(o,u){return w=Object.setPrototypeOf||function(x,p){return x.__proto__=p,x},w(o,u)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(u,o);function u(x){var p;return p=o.call(this,x,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var s=u.prototype;return s._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(p,f){var A=[],b=[],h=[],c,l={},a,g=!1,m=!1,E=!1;if(f.levels.forEach(function(W){var _=W.attrs;g=g||!!(W.width&&W.height),m=m||!!W.videoCodec,E=E||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var k=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[k],a?a.url.push(W.url):(a=new G.Level(W),l[k]=a,A.push(a)),_&&(_.AUDIO&&Object(F.addGroupId)(a,"audio",_.AUDIO),_.SUBTITLES&&Object(F.addGroupId)(a,"text",_.SUBTITLES))}),(g||m)&&E&&(A=A.filter(function(W){var _=W.videoCodec,k=W.width,K=W.height;return!!_||!!(k&&K)})),A=A.filter(function(W){var _=W.audioCodec,k=W.videoCodec;return(!_||Object(B.isCodecSupportedInMp4)(_,"audio"))&&(!k||Object(B.isCodecSupportedInMp4)(k,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(b)),f.subtitles&&(h=f.subtitles,Object(F.assignTrackIdsByGroup)(h)),A.length>0){c=A[0].bitrate,A.sort(function(W,_){return W.bitrate-_.bitrate}),this._levels=A;for(var P=0;P<A.length;P++)if(A[P].bitrate===c){this._firstLevel=P,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+c);break}var U=E&&!m,j={levels:A,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:m,altAudio:!U&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var A=f.context,b=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&A.groupId===b.audioGroupIds[b.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&A.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(f.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(c=!1),l=A.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,h=!0;break}l!==void 0&&this.recoverLevel(f,l,h,c)},s.recoverLevel=function(p,f,A,b){var h=p.details,c=this._levels[f];if(c.loadError++,A){var l=this.retryLoadingOrFail(p);if(l)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var g=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),p.levelRetry=!0,this.hls.nextAutoLevel=g)}}},s.redundantFailover=function(p){var f=this._levels[p],A=f.url.length;if(A>1){var b=(f.urlId+1)%A;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=p}},s.onFragLoaded=function(p,f){var A=f.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var b=this._levels[A.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},s.onLevelLoaded=function(p,f){var A,b=f.level,h=f.details,c=this._levels[b];if(!c){var l;this.warn("Invalid level index "+b),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(A=f.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(h.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(p,f){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<A.audioGroupIds.length;c++)if(A.audioGroupIds[c]===h){b=c;break}b!==A.urlId&&(A.urlId=b,this.startLoad())}},s.loadPlaylist=function(p){var f=this.currentLevelIndex,A=this._levels[f];if(this.canLoad&&A&&A.url.length>0){var b=A.urlId,h=A.url[b];if(p)try{h=p.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:b,deliveryDirectives:p||null})}},s.removeLevel=function(p,f){var A=function(c,l){return l!==f},b=this._levels.filter(function(h,c){return c!==p?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(A),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(A)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(A)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===p&&(f=A[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=A.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,A.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=A[h],l=A[p];this.log("switching to level "+p+" from "+h),this.currentLevelIndex=p;var a=y({},l,{level:p,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var g=l.details;if(!g||g.live){var m=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),u}(M.default)},"./src/controller/level-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"addGroupId",function(){return R}),L.d(V,"assignTrackIdsByGroup",function(){return B}),L.d(V,"updatePTS",function(){return F}),L.d(V,"updateFragPTSDTS",function(){return D}),L.d(V,"mergeDetails",function(){return y}),L.d(V,"mapPartIntersection",function(){return S}),L.d(V,"mapFragmentIntersection",function(){return O}),L.d(V,"adjustSliding",function(){return C}),L.d(V,"addSliding",function(){return w}),L.d(V,"computeReloadInterval",function(){return v}),L.d(V,"getFragmentWithSN",function(){return d}),L.d(V,"getPartWith",function(){return o});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function R(u,s,x){switch(s){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(x);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(x);break}}function B(u){var s={};u.forEach(function(x){var p=x.groupId||"";x.id=s[p]=s[p]||0,s[p]++})}function F(u,s,x){var p=u[s],f=u[x];M(p,f)}function M(u,s){var x=s.startPTS;if(Object(G.isFiniteNumber)(x)){var p=0,f;s.sn>u.sn?(p=x-u.start,f=u):(p=u.start-x,f=s),f.duration!==p&&(f.duration=p)}else if(s.sn>u.sn){var A=u.cc===s.cc;A&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function D(u,s,x,p,f,A){var b=p-x;b<=0&&(I.logger.warn("Fragment should have a positive duration",s),p=x+s.duration,A=f+s.duration);var h=x,c=p,l=s.startPTS,a=s.endPTS;if(Object(G.isFiniteNumber)(l)){var g=Math.abs(l-x);Object(G.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(g,s.deltaPTS):s.deltaPTS=g,h=Math.max(x,l),x=Math.min(x,l),f=Math.min(f,s.startDTS),c=Math.min(p,a),p=Math.max(p,a),A=Math.max(A,s.endDTS)}s.duration=p-x;var m=x-s.start;s.appendedPTS=p,s.start=s.startPTS=x,s.maxStartPTS=h,s.startDTS=f,s.endPTS=p,s.minEndPTS=c,s.endDTS=A;var E=s.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var P,U=E-u.startSN,j=u.fragments;for(j[U]=s,P=U;P>0;P--)M(j[P],j[P-1]);for(P=U;P<j.length-1;P++)M(j[P],j[P+1]);return u.fragmentHint&&M(j[j.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function y(u,s){for(var x=null,p=u.fragments,f=p.length-1;f>=0;f--){var A=p[f].initSegment;if(A){x=A;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,h;if(O(u,s,function(P,U){P.relurl&&(b=P.cc-U.cc),Object(G.isFiniteNumber)(P.startPTS)&&Object(G.isFiniteNumber)(P.endPTS)&&(U.start=U.startPTS=P.startPTS,U.startDTS=P.startDTS,U.appendedPTS=P.appendedPTS,U.maxStartPTS=P.maxStartPTS,U.endPTS=P.endPTS,U.endDTS=P.endDTS,U.minEndPTS=P.minEndPTS,U.duration=P.endPTS-P.startPTS,U.duration&&(h=U),s.PTSKnown=s.alignedSliding=!0),U.elementaryStreams=P.elementaryStreams,U.loader=P.loader,U.stats=P.stats,U.urlId=P.urlId,P.initSegment&&(U.initSegment=P.initSegment,x=P.initSegment)}),x){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(P){var U;(!P.initSegment||P.initSegment.relurl===((U=x)===null||U===void 0?void 0:U.relurl))&&(P.initSegment=x)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(P){return!P}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=b}s.skippedSegments&&(s.startCC=s.fragments[0].cc),S(u.partList,s.partList,function(P,U){U.elementaryStreams=P.elementaryStreams,U.stats=P.stats}),h?D(s,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(u,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var m=s.advancedDateTime;if(s.advanced&&m){var E=s.edge;s.driftStart||(s.driftStartTime=m,s.driftStart=E),s.driftEndTime=m,s.driftEnd=E}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function S(u,s,x){if(u&&s)for(var p=0,f=0,A=u.length;f<=A;f++){var b=u[f],h=s[f+p];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?x(b,h):p--}}function O(u,s,x){for(var p=s.skippedSegments,f=Math.max(u.startSN,s.startSN)-s.startSN,A=(u.fragmentHint?1:0)+(p?s.endSN:Math.min(u.endSN,s.endSN))-s.startSN,b=s.startSN-u.startSN,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=f;l<=A;l++){var a=c[b+l],g=h[l];p&&!g&&l<p&&(g=s.fragments[l]=a),a&&g&&x(a,g)}}function C(u,s){var x=s.startSN+s.skippedSegments-u.startSN,p=u.fragments;if(x<0||x>=p.length)return;w(s,p[x].start)}function w(u,s){if(s){for(var x=u.fragments,p=u.skippedSegments;p<x.length;p++)x[p].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function v(u,s){var x=1e3*u.levelTargetDuration,p=x/2,f=u.age,A=f>0&&f<x*3,b=s.loading.end-s.loading.start,h,c=u.availabilityDelay;if(u.updated===!1)if(A){var l=333*u.misses;h=Math.max(Math.min(p,b*2),l),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=p;else A?(c=Math.min(c||x/2,f),u.availabilityDelay=c,h=c+x-f):h=x-b;return Math.round(h)}function d(u,s,x){if(!u||!u.details)return null;var p=u.details,f=p.fragments[s-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===s?f:s<p.startSN&&x&&x.sn===s?x:null)}function o(u,s,x){if(!u||!u.details)return null;var p=u.details.partList;if(p)for(var f=p.length;f--;){var A=p[f];if(A.index===x&&A.fragment.sn===s)return A}return null}},"./src/controller/stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return p});var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/is-supported.ts"),B=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),M=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),y=L("./src/loader/fragment.ts"),S=L("./src/demux/transmuxer-interface.ts"),O=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),w=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function d(f,A){for(var b=0;b<A.length;b++){var h=A[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,A,b){return A&&d(f.prototype,A),b&&d(f,b),f}function u(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,s(f,A)}function s(f,A){return s=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},s(f,A)}var x=100,p=function(f){u(A,f);function A(h,c){var l;return l=f.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var b=A.prototype;return b._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)},b._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)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,g=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),P=this.retryDate;(!P||E>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,l,a=this.hls,g=this.levelLastLoaded,m=this.levels,E=this.media,P=a.config,U=a.nextLoadLevel;if(g===null||!E&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[U])return;var j=m[U];this.level=a.nextLoadLevel=U;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=I.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,D.PlaylistLevelType.MAIN);if(_===null)return;var k=_.len,K=this.getMaxBufferLength(j.maxBitrate);if(k>=K)return;if(this._streamEnded(_,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var q=_.end,ae=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var Ee=ae.sn-W.startSN;Ee>1&&(ae=W.fragments[Ee-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===M.FragmentState.OK&&this.nextLoadPosition>q){var ve=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,D.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"&&!((l=ae.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ae,W):this.loadFragment(ae,W,q)},b.loadFragment=function(c,l,a){var g,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===M.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,l,a)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,D.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,D.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,g=this.getAppendedFrag(l.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!l.paused&&c){var m=this.hls.nextLoadLevel,E=c[m],P=this.fragLastKbps;P&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*P)+1:a=0}else a=0;var U=this.getBufferedFrag(l.currentTime+a);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,_=j.duration,k=Math.max(U.end,W+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},b.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,l){var a=!1,g=!1,m;l.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var g=a[l.level];(!g.details||g.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(g.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,l){var a,g=this.levels,m=l.level,E=l.details,P=E.totalduration;if(!g){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+P);var U=this.fragCurrent;U&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==l.level&&U.loader&&(this.state=I.State.IDLE,U.loader.abort()));var j=g[m],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},b._handleFragmentLoadProgress=function(c){var l,a=c.frag,g=c.part,m=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var P=E[a.level],U=P.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=P.videoCodec,W=U.PTSKnown||!U.live,_=(l=a.initSegment)===null||l===void 0?void 0:l.data,k=this._getAudioCodec(P),K=this.transmuxer=this.transmuxer||new S.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=g?g.index:-1,q=Y!==-1,ae=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,q),Ee=this.initPTS[a.cc];K.push(m,_,k,j,a,g,U.totalduration,W,ae,Ee)},b.onAudioTrackSwitching=function(c,l){var a=this.altAudio,g=!!l.url,m=l.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;a&&P.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(c,l){var a=l.id,g=!!this.hls.audioTracks[a].url;if(g){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=g,this.tick()},b.onBufferCreated=function(c,l){var a=l.tracks,g,m,E=!1;for(var P in a){var U=a[P];if(U.id==="main"){if(m=P,g=U,P==="video"){var j=a[P];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&g?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,l){var a=l.frag,g=l.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},b.onError=function(c,l){switch(l.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,l);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=F.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,l){var a=l.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,D.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+l);return}var g=F.BufferHelper.getBuffered(c),m=g.length?g.start(0):0,E=m-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},b._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},b._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var g=l.hls;if(!a||g.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var l,a="main",g=this.hls,m=c.remuxResult,E=c.chunkMeta,P=this.getCurrentContext(E);if(!P){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var U=P.frag,j=P.part,W=P.level,_=m.video,k=m.text,K=m.id3,Y=m.initSegment,q=this.altAudio?void 0:m.audio;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,U,E),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:Y.tracks}));var ae=Y.initPTS,Ee=Y.timescale;Object(G.isFiniteNumber)(ae)&&(this.initPTS[U.cc]=ae,g.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ae,timescale:Ee}))}if(_&&m.independent!==!1){if(W.details){var ve=_.startPTS,ge=_.endPTS,fe=_.startDTS,me=_.endDTS;if(j)j.elementaryStreams[_.type]={startPTS:ve,endPTS:ge,startDTS:fe,endDTS:me};else if(_.firstKeyFrame&&_.independent&&(this.couldBacktrack=!0),_.dropped&&_.independent){var oe=this.getLoadPosition()+this.config.maxBufferHole;if(oe<ve){this.backtrack(U);return}U.setElementaryStreamInfo(_.type,U.start,ge,U.start,me,!0)}U.setElementaryStreamInfo(_.type,ve,ge,fe,me),this.bufferFragmentData(_,U,j,E)}}else if(m.independent===!1){this.backtrack(U);return}if(q){var pe=q.startPTS,$=q.endPTS,ie=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:$,startDTS:ie,endDTS:Z}),U.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,pe,$,ie,Z),this.bufferFragmentData(q,U,j,E)}if(K!=null&&(l=K.samples)!==null&&l!==void 0&&l.length){var xe={frag:U,id:a,samples:K.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,xe)}if(k){var Le={frag:U,id:a,samples:k.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,Le)}},b._bufferInitSegment=function(c,l,a,g){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var E=l.audio,P=l.video,U=l.audiovideo;if(E){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}P&&(P.levelCodec=c.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+P.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,l),Object.keys(l).forEach(function(_){var k=l[_],K=k.initSegment;K!=null&&K.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:_,data:K,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(F.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):F.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var g=this.fragPlaying,m=l.level;(!g||l.sn!==g.sn||g.level!==m||l.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!g||g.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},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 l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"SubtitleStreamController",function(){return u});var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),F=L("./src/utils/discontinuities.ts"),M=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),y=L("./src/controller/base-stream-controller.ts"),S=L("./src/types/loader.ts"),O=L("./src/types/level.ts");function C(s,x){for(var p=0;p<x.length;p++){var f=x[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function w(s,x,p){return x&&C(s.prototype,x),p&&C(s,p),s}function v(s,x){s.prototype=Object.create(x.prototype),s.prototype.constructor=s,d(s,x)}function d(s,x){return d=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},d(s,x)}var o=500,u=function(s){v(x,s);function x(f,A){var b;return b=s.call(this,f,A,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=x.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var A=this.hls;A.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(G.Events.ERROR,this.onError,this),A.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var A=this.hls;A.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(G.Events.ERROR,this.onError,this),A.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(A,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(A,b){var h=b.frag,c=b.success;if(this.fragPrevious=h,this.state=y.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,g=h.start,m=0;m<l.length;m++)if(g>=l[m].start&&g<=l[m].end){a=l[m];break}var E=h.start+h.duration;a?a.end=E:(a={start:g,end:E},l.push(a)),this.fragmentTracker.fragBuffered(h)},p.onBufferFlushing=function(A,b){var h=b.startOffset,c=b.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var g=a[l].details,m=g.targetduration,E=c-m;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(P){for(var U=0;U<P.length;){if(P[U].end<=E){P.shift();continue}else if(P[U].start<E)P[U].start=E;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(h,E,S.PlaylistLevelType.SUBTITLE)}},p.onError=function(A,b){var h,c=b.frag;if(!c||c.type!==S.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},p.onSubtitleTracksUpdated=function(A,b){var h=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new O.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(A,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(A,b){var h,c=b.details,l=b.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var m=g[a];if(l>=g.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=m.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var P=E.fragments[0];if(!m.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(c,E):P&&Object(M.addSliding)(c,P.start);else{var U=this.alignPlaylists(c,m.details);U===0&&P&&Object(M.addSliding)(c,P.start)}}if(m.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(A){var b=A.frag,h=A.payload,c=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(g){var m=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:b,payload:g,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var A,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var c=h[b].details,l=c.targetduration,a=this.config,g=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-l,a.maxBufferHole),E=m.end,P=m.len,U=this.getMaxBufferLength()+l;if(P>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,_=c.edge,k,K=this.fragPrevious;if(E<_){var Y=a.maxFragLookUpTolerance;K&&c.hasProgramDateTime&&(k=Object(B.findFragmentByPDT)(j,K.endProgramDateTime,Y)),k||(k=Object(B.findFragmentByPTS)(K,j,E,Y),!k&&K&&K.start<j[0].start&&(k=j[0]))}else k=j[W-1];(A=k)!==null&&A!==void 0&&A.encrypted?(I.logger.log("Loading key for "+k.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:k})):k&&this.fragmentTracker.getState(k)===D.FragmentState.NOT_LOADED&&this.loadFragment(k,c,E)}},p.loadFragment=function(A,b,h){this.fragCurrent=A,s.prototype.loadFragment.call(this,A,b,h)},w(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(y.default)},"./src/controller/subtitle-track-controller.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(C,w){for(var v=0;v<w.length;v++){var d=w[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function M(C,w,v){return w&&F(C.prototype,w),v&&F(C,v),C}function D(C,w){C.prototype=Object.create(w.prototype),C.prototype.constructor=C,y(C,w)}function y(C,w){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(C,w)}var S=function(C){D(w,C);function w(d){var o;return o=C.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=w.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,u){if(this.media=u.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=O(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),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,u){this.tracks=u.subtitleTracks},v.onSubtitleTrackLoaded=function(o,u){var s=u.id,x=u.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+s);return}var A=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+x.startSN+"-"+x.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,A))},v.onLevelLoading=function(o,u){this.switchLevel(u.level)},v.onLevelSwitching=function(o,u){this.switchLevel(u.level)},v.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!s||b.groupId===s});this.tracksInGroup=p;var f=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=s;var A={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,A),f!==-1&&this.setSubtitleTrack(f,x)}},v.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s<u.length;s++){var x=u[s];if((!this.selectDefaultTrack||x.default)&&(!o||o===x.name))return x.id}return-1},v.onError=function(o,u){if(C.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},v.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var s=u.id,x=u.groupId,p=u.url;if(o)try{p=o.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:p,id:s,groupId:x,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var u=this,s=this.media,x=this.subtitleDisplay,p=this.trackId;if(!s)return;var f=O(s.textTracks),A=f.filter(function(c){return c.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var b=A[p];b&&(b.mode="disabled")}var h=A[o];h&&(h.mode=x?"showing":"hidden")},v.setSubtitleTrack=function(o,u){var s,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=x[o])!==null&&s!==void 0&&s.details)||o<-1||o>=x.length)return;this.clearTimer();var p=x[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,A=p.groupId,b=A===void 0?"":A,h=p.name,c=p.type,l=p.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:h,type:c,url:l});var a=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=O(this.media.textTracks),s=0;s<u.length;s++)if(u[s].mode==="hidden")o=s;else if(u[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},M(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),w}(R.default);function O(C){for(var w=[],v=0;v<C.length;v++){var d=C[v];d.kind==="subtitles"&&d.label&&w.push(C[v])}return w}V.default=S},"./src/controller/timeline-controller.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"TimelineController",function(){return O});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),F=L("./src/utils/webvtt-parser.ts"),M=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),y=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts"),O=function(){function d(u){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=u,this.config=u.config,this.Cues=u.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 s=new B.default(this,"textTrack1"),x=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,s,x),this.cea608Parser2=new R.default(3,p,f)}u.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(I.Events.FRAG_LOADING,this.onFragLoading,this),u.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,x,p,f,A){for(var b=!1,h=A.length;h--;){var c=A[h],l=w(c[0],c[1],x,p);if(l>=0&&(c[0]=Math.min(c[0],x),c[1]=Math.max(c[1],p),b=!0,l/(p-x)>.5))return}if(b||A.push([x,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,x,p,f)}else{var g=this.Cues.newCue(null,x,p,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:g,track:s})}},o.onInitPtsFound=function(s,x){var p=this,f=x.frag,A=x.id,b=x.initPTS,h=x.timescale,c=this.unparsedVttFrags;A==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){p.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var x=this.media;if(x)for(var p=0;p<x.textTracks.length;p++){var f=x.textTracks[p];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var x=this.captionsProperties,p=this.captionsTracks,f=this.media,A=x[s],b=A.label,h=A.languageCode,c=this.getExistingTrack(s);if(c)p[s]=c,Object(M.clearCurrentCues)(p[s]),Object(M.sendAddTrackEvent)(p[s],f);else{var l=this.createTextTrack("captions",b,h);l&&(l[s]=!0,p[s]=l)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var x=this.captionsProperties[s];if(!x)return;var p=x.label,f={_id:s,label:p,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,x,p){var f=this.media;return f?f.addTextTrack(s,x,p):void 0},o.onMediaAttaching=function(s,x){this.media=x.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(x){Object(M.clearCurrentCues)(s[x]),delete s[x]}),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 s=this.media;if(!s)return;var x=s.textTracks;if(x)for(var p=0;p<x.length;p++)Object(M.clearCurrentCues)(x[p])},o.onSubtitleTracksUpdated=function(s,x){var p=this;this.textTracks=[];var f=x.subtitleTracks||[],A=f.some(function(l){return l.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var g;if(a<h.length){for(var m=null,E=0;E<h.length;E++)if(C(h[E],l)){m=h[E];break}m&&(g=m)}g?Object(M.clearCurrentCues)(g):(g=p.createTextTrack("subtitles",l.name,l.lang),g&&(g.mode="disabled")),g&&(g.groupId=l.groupId,p.textTracks.push(g))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,x){var p=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(f){var A=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!A)return;var b="textTrack"+A[1],h=p.captionsProperties[b];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(s,x){var p=this.cea608Parser1,f=this.cea608Parser2,A=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(x.frag.type===y.PlaylistLevelType.MAIN){var h,c,l=x.frag.sn,a=(h=x==null||((c=x.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===A+1||l===A&&a===b+1||(p.reset(),f.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(s,x){var p=x.frag,f=x.payload,A=this.initPTS,b=this.unparsedVttFrags;if(p.type===y.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(G.isFiniteNumber)(A[p.cc])){b.push(x),A.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var h=p.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[p.level],l=this.vttCCs;l[p.cc]||(l[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===D.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,x){var p=this,f=this.hls;Object(D.parseIMSC1)(x,this.initPTS[s.cc],this.timescale[s.cc],function(A){p._appendCues(A,s.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(A){S.logger.log("Failed to parse IMSC1: "+A),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:A})})},o._parseVTTs=function(s,x,p){var f=this,A=this.hls;Object(F.parseWebVTT)(x,this.initPTS[s.cc],this.timescale[s.cc],p,s.cc,s.start,function(b){f._appendCues(b,s.level),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(b){f._fallbackToIMSC1(s,x),S.logger.log("Failed to parse VTT cue: "+b),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:b})})},o._fallbackToIMSC1=function(s,x){var p=this,f=this.tracks[s.level];f.textCodec||Object(D.parseIMSC1)(x,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=D.IMSC1_CODEC,p._parseIMSC1(s,x)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,x){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[x];if(f.mode==="disabled")return;s.forEach(function(h){return Object(M.addCueToTrack)(f,h)})}else{var A=this.tracks[x],b=A.default?"default":"subtitles"+x;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:s,track:b})}},o.onFragDecrypted=function(s,x){var p=x.frag;if(p.type===y.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(I.Events.FRAG_LOADED,x)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,x){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var A=0;A<x.samples.length;A++){var b=x.samples[A].bytes;if(b){var h=this.extractCea608Data(b);p.addData(x.samples[A].pts,h[0]),f.addData(x.samples[A].pts,h[1])}}},o.onBufferFlushing=function(s,x){var p=x.startOffset,f=x.endOffset,A=x.endOffsetSubtitles,b=x.type,h=this.media;if(!h||h.currentTime<f)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(M.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&A!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(M.removeCuesInRange)(l[a],p,A)})}},o.extractCea608Data=function(s){for(var x=s[0]&31,p=2,f=[[],[]],A=0;A<x;A++){var b=s[p++],h=127&s[p++],c=127&s[p++],l=(4&b)!==0,a=3&b;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(f[a].push(h),f[a].push(c)))}return f},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function w(d,o,u,s){return Math.min(o,s)-Math.max(d,u)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=F}var R=I.prototype;return R.decrypt=function(F,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,F)},I}()},"./src/crypt/aes-decryptor.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"removePadding",function(){return I}),L.d(V,"default",function(){return R});var G=L("./src/utils/typed-array.ts");function I(B){var F=B.byteLength,M=F&&new DataView(B.buffer).getUint8(F-1);return M?Object(G.sliceUint8)(B,0,F-M):B}var R=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 F=B.prototype;return F.uint8ArrayToUint32Array_=function(D){for(var y=new DataView(D),S=new Uint32Array(4),O=0;O<4;O++)S[O]=y.getUint32(O*4);return S},F.initTable=function(){var D=this.sBox,y=this.invSBox,S=this.subMix,O=S[0],C=S[1],w=S[2],v=S[3],d=this.invSubMix,o=d[0],u=d[1],s=d[2],x=d[3],p=new Uint32Array(256),f=0,A=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var h=A^A<<1^A<<2^A<<3^A<<4;h=h>>>8^h&255^99,D[f]=h,y[h]=f;var c=p[f],l=p[c],a=p[l],g=p[h]*257^h*16843008;O[f]=g<<24|g>>>8,C[f]=g<<16|g>>>16,w[f]=g<<8|g>>>24,v[f]=g,g=a*16843009^l*65537^c*257^f*16843008,o[h]=g<<24|g>>>8,u[h]=g<<16|g>>>16,s[h]=g<<8|g>>>24,x[h]=g,f?(f=c^p[p[p[a^c]]],A^=p[p[A]]):f=A=1}},F.expandKey=function(D){for(var y=this.uint8ArrayToUint32Array_(D),S=!0,O=0;O<y.length&&S;)S=y[O]===this.key[O],O++;if(S)return;this.key=y;var C=this.keySize=y.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var w=this.ksRows=(C+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(w),u=this.invKeySchedule=new Uint32Array(w),s=this.sBox,x=this.rcon,p=this.invSubMix,f=p[0],A=p[1],b=p[2],h=p[3],c,l;for(v=0;v<w;v++){if(v<C){c=o[v]=y[v];continue}l=c,v%C===0?(l=l<<8|l>>>24,l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255],l^=x[v/C|0]<<24):C>6&&v%C===4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255]),o[v]=c=(o[v-C]^l)>>>0}for(d=0;d<w;d++)v=w-d,d&3?l=o[v]:l=o[v-4],d<4||v<=4?u[d]=l:u[d]=f[s[l>>>24]]^A[s[l>>>16&255]]^b[s[l>>>8&255]]^h[s[l&255]],u[d]=u[d]>>>0},F.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},F.decrypt=function(D,y,S){for(var O=this.keySize+6,C=this.invKeySchedule,w=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],u=v[2],s=v[3],x=this.uint8ArrayToUint32Array_(S),p=x[0],f=x[1],A=x[2],b=x[3],h=new Int32Array(D),c=new Int32Array(h.length),l,a,g,m,E,P,U,j,W,_,k,K,Y,q,ae=this.networkToHostOrderSwap;y<h.length;){for(W=ae(h[y]),_=ae(h[y+1]),k=ae(h[y+2]),K=ae(h[y+3]),E=W^C[0],P=K^C[1],U=k^C[2],j=_^C[3],Y=4,q=1;q<O;q++)l=d[E>>>24]^o[P>>16&255]^u[U>>8&255]^s[j&255]^C[Y],a=d[P>>>24]^o[U>>16&255]^u[j>>8&255]^s[E&255]^C[Y+1],g=d[U>>>24]^o[j>>16&255]^u[E>>8&255]^s[P&255]^C[Y+2],m=d[j>>>24]^o[E>>16&255]^u[P>>8&255]^s[U&255]^C[Y+3],E=l,P=a,U=g,j=m,Y=Y+4;l=w[E>>>24]<<24^w[P>>16&255]<<16^w[U>>8&255]<<8^w[j&255]^C[Y],a=w[P>>>24]<<24^w[U>>16&255]<<16^w[j>>8&255]<<8^w[E&255]^C[Y+1],g=w[U>>>24]<<24^w[j>>16&255]<<16^w[E>>8&255]<<8^w[P&255]^C[Y+2],m=w[j>>>24]<<24^w[E>>16&255]<<16^w[P>>8&255]<<8^w[U&255]^C[Y+3],c[y]=ae(l^p),c[y+1]=ae(m^f),c[y+2]=ae(g^A),c[y+3]=ae(a^b),p=W,f=_,A=k,b=K,y=y+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return y});var G=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),R=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),M=L("./src/utils/typed-array.ts"),D=16,y=function(){function S(C,w,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,u=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=C,this.config=w,this.removePKCS7Padding=u,u)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=S.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var v=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(v):v},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(w,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),v,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),v,d).then(o)},O.softwareDecrypt=function(w,v,d){var o=this.currentIV,u=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(w=Object(F.appendUint8Array)(s,w),this.remainderData=null);var x=this.getValidChunk(w);if(!x.length)return null;o&&(d=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(v);var f=u;return this.currentResult=p.decrypt(x.buffer,0,d),this.currentIV=Object(M.sliceUint8)(x,-16).buffer,f||null},O.webCryptoDecrypt=function(w,v,d){var o=this,u=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new I.default(u,v)),this.fastAesKey.expandKey().then(function(s){if(!u)return Promise.reject(new Error("web crypto not initialized"));var x=new G.default(u,d);return x.decrypt(w.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,w,v,d)})},O.onWebCryptoError=function(w,v,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},O.getValidChunk=function(w){var v=w,d=w.length-w.length%D;return d!==w.length&&(v=Object(M.sliceUint8)(w,0,d),this.remainderData=Object(M.sliceUint8)(w,d)),v},O.logOnce=function(w){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=F}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function F(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,M(y,S)}function M(y,S){return M=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},M(y,S)}var D=function(y){F(S,y);function S(C,w){var v;return v=y.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=C,v.config=w,v}var O=S.prototype;return O.resetInitSegment=function(w,v,d){y.prototype.resetInitSegment.call(this,w,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(w){if(!w)return!1;for(var v=B.getID3Data(w,0)||[],d=v.length,o=w.length;d<o;d++)if(I.probe(w,d))return R.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(w,v){return I.canParse(w,v)},O.appendFrame=function(w,v,d){I.initTrackConfig(w,this.observer,v,d,w.manifestCodec);var o=I.appendFrame(w,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}(G.default);D.minProbeByteLength=9,V.default=D},"./src/demux/adts.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"getAudioConfig",function(){return B}),L.d(V,"isHeaderPattern",function(){return F}),L.d(V,"getHeaderLength",function(){return M}),L.d(V,"getFullFrameLength",function(){return D}),L.d(V,"canGetFrameLength",function(){return y}),L.d(V,"isHeader",function(){return S}),L.d(V,"canParse",function(){return O}),L.d(V,"probe",function(){return C}),L.d(V,"initTrackConfig",function(){return w}),L.d(V,"getFrameDuration",function(){return v}),L.d(V,"parseFrameHeader",function(){return d}),L.d(V,"appendFrame",function(){return o});var G=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts");function B(u,s,x,p){var f,A,b,h,c=navigator.userAgent.toLowerCase(),l=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[x+2]&192)>>>6)+1;var g=(s[x+2]&60)>>>2;if(g>a.length-1){u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return b=(s[x+2]&1)<<2,b|=(s[x+3]&192)>>>6,G.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(f=5,h=new Array(4),A=g-3):(f=2,h=new Array(2),A=g):c.indexOf("android")!==-1?(f=2,h=new Array(2),A=g):(f=5,h=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&g>=6?A=g-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(g>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,h=new Array(2)),A=g)),h[0]=f<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=b<<3,f===5&&(h[1]|=(A&14)>>1,h[2]=(A&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:b,codec:"mp4a.40."+f,manifestCodec:l}}function F(u,s){return u[s]===255&&(u[s+1]&246)===240}function M(u,s){return u[s+1]&1?7:9}function D(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function y(u,s){return s+5<u.length}function S(u,s){return s+1<u.length&&F(u,s)}function O(u,s){return y(u,s)&&F(u,s)&&D(u,s)<=u.length-s}function C(u,s){if(S(u,s)){var x=M(u,s);if(s+x>=u.length)return!1;var p=D(u,s);if(p<=x)return!1;var f=s+p;return f===u.length||S(u,f)}return!1}function w(u,s,x,p,f){if(!u.samplerate){var A=B(s,x,p,f);if(!A)return;u.config=A.config,u.samplerate=A.samplerate,u.channelCount=A.channelCount,u.codec=A.codec,u.manifestCodec=A.manifestCodec,G.logger.log("parsed codec:"+u.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function v(u){return 1024*9e4/u}function d(u,s,x,p,f){var A=M(u,s),b=D(u,s);if(b-=A,b>0){var h=x+p*f;return{headerLength:A,frameLength:b,stamp:h}}}function o(u,s,x,p,f){var A=v(u.samplerate),b=d(s,x,p,f,A);if(b){var h=b.frameLength,c=b.headerLength,l=b.stamp,a=c+h,g=Math.max(0,x+a-s.length),m;g?(m=new Uint8Array(a-c),m.set(s.subarray(x+c,s.length),0)):m=s.subarray(x+c,x+a);var E={unit:m,pts:l};return g||u.samples.push(E),{sample:E,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"initPTSFn",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),R=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/typed-array.ts"),M=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=y.prototype;return S.resetInitSegment=function(C,w,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(C,w){return!1},S.appendFrame=function(C,w,v){},S.demux=function(C,w){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var v=I.getID3Data(C,0),d=v?v.length:0,o,u,s=this._audioTrack,x=this._id3Track,p=v?I.getTimeStamp(v):void 0,f=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(p,w)),v&&v.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),u=this.initPTS;d<f;){if(this.canParse(C,d)){var A=this.appendFrame(s,C,d);A?(this.frameIndex++,u=A.sample.pts,d+=A.length,o=d):d=f}else I.canParse(C,d)?(v=I.getID3Data(C,d),x.samples.push({pts:u,dts:u,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var b=Object(F.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:s,avcTrack:Object(R.dummyTrack)(),id3Track:x,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(C,w,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(C){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},y}(),D=function(S,O){return Object(G.isFiniteNumber)(S)?S*90:O*9e4};V.default=M},"./src/demux/chunk-cache.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(M){this.chunks.push(M),this.dataLength+=M.length},B.flush=function(){var M=this.chunks,D=this.dataLength,y;if(M.length)M.length===1?y=M[0]:y=I(M,D);else return new Uint8Array(0);return this.reset(),y},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var F=new Uint8Array(B),M=0,D=0;D<R.length;D++){var y=R[D];F.set(y,M),M+=y.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/utils/logger.ts"),I=function(){function R(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var M=this.data,D=this.bytesAvailable,y=M.byteLength-D,S=new Uint8Array(4),O=Math.min(4,D);if(O===0)throw new Error("no bytes available");S.set(M.subarray(y,y+O)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},B.skipBits=function(M){var D;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,D=M>>3,M-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},B.readBits=function(M){var D=Math.min(this.bitsAvailable,M),y=this.word>>>32-D;return M>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=M-D,D>0&&this.bitsAvailable?y<<D|this.readBits(D):y},B.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},B.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>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(M){for(var D=8,y=8,S,O=0;O<M;O++)y!==0&&(S=this.readEG(),y=(D+S+256)%256),D=y===0?D:y},B.readSPS=function(){var M=0,D=0,y=0,S=0,O,C,w,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),s=this.skipBits.bind(this),x=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var A=v();if(d(5),s(3),v(),p(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var b=o();if(b===3&&s(1),p(),p(),s(1),u())for(C=b!==3?8:12,w=0;w<C;w++)u()&&(w<6?f(16):f(64))}p();var h=o();if(h===0)o();else if(h===1)for(s(1),x(),x(),O=o(),w=0;w<O;w++)x();p(),s(1);var c=o(),l=o(),a=d(1);a===0&&s(1),s(1),u()&&(M=o(),D=o(),y=o(),S=o());var g=[1,1];if(u()&&u()){var m=v();switch(m){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-M*2-D*2),height:(2-a)*(l+1)*16-(a?2:4)*(y+S),pixelRatio:g}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=I},"./src/demux/id3.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isHeader",function(){return G}),L.d(V,"isFooter",function(){return I}),L.d(V,"getID3Data",function(){return R}),L.d(V,"canParse",function(){return F}),L.d(V,"getTimeStamp",function(){return M}),L.d(V,"isTimeStampFrame",function(){return D}),L.d(V,"getID3Frames",function(){return S}),L.d(V,"decodeFrame",function(){return O}),L.d(V,"utf8ArrayToStr",function(){return o}),L.d(V,"testables",function(){return u});var G=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)))},I=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)))},R=function(f,A){for(var b=A,h=0;G(f,A);){h+=10;var c=B(f,A+6);h+=c,I(f,A+10)&&(h+=10),A+=h}return h>0?f.subarray(b,b+h):void 0},B=function(f,A){var b=0;return b=(f[A]&127)<<21,b|=(f[A+1]&127)<<14,b|=(f[A+2]&127)<<7,b|=f[A+3]&127,b},F=function(f,A){return G(f,A)&&B(f,A+6)+10<=f.length-A},M=function(f){for(var A=S(f),b=0;b<A.length;b++){var h=A[b];if(D(h))return d(h)}return},D=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},y=function(f){var A=String.fromCharCode(f[0],f[1],f[2],f[3]),b=B(f,4),h=10;return{type:A,size:b,data:f.subarray(h,h+b)}},S=function(f){for(var A=0,b=[];G(f,A);){var h=B(f,A+6);A+=10;for(var c=A+h;A+8<c;){var l=y(f.subarray(A)),a=O(l);a&&b.push(a),A+=l.size+10}I(f,A)&&(A+=10)}return b},O=function(f){return f.type==="PRIV"?C(f):f.type[0]==="W"?v(f):w(f)},C=function(f){if(f.size<2)return;var A=o(f.data,!0),b=new Uint8Array(f.data.subarray(A.length+1));return{key:f.type,info:A,data:b.buffer}},w=function(f){if(f.size<2)return;if(f.type==="TXXX"){var A=1,b=o(f.data.subarray(A),!0);A+=b.length+1;var h=o(f.data.subarray(A));return{key:f.type,info:b,data:h}}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,b=o(f.data.subarray(A),!0);A+=b.length+1;var h=o(f.data.subarray(A));return{key:f.type,info:b,data:h}}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),b=A[3]&1,h=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,A){A===void 0&&(A=!1);var b=x();if(b){var h=b.decode(f);if(A){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=f.length,a,g,m,E="",P=0;P<l;){if(a=f[P++],a===0&&A)return E;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:E+=String.fromCharCode(a);break;case 12:case 13:g=f[P++],E+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=f[P++],m=f[P++],E+=String.fromCharCode((a&15)<<12|(g&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:w},s;function x(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function F(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,M(y,S)}function M(y,S){return M=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},M(y,S)}var D=function(y){F(S,y);function S(){return y.apply(this,arguments)||this}var O=S.prototype;return O.resetInitSegment=function(w,v,d){y.prototype.resetInitSegment.call(this,w,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:d,inputTimeScale:9e4,dropped:0}},S.probe=function(w){if(!w)return!1;for(var v=I.getID3Data(w,0)||[],d=v.length,o=w.length;d<o;d++)if(B.probe(w,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(w,v){return B.canParse(w,v)},O.appendFrame=function(w,v,d){return this.initPTS===null?void 0:B.appendFrame(w,v,d,this.initPTS,this.frameIndex)},S}(G.default);D.minProbeByteLength=4,V.default=D},"./src/demux/mp4demuxer.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(M,D){this.remainderData=null,this.config=void 0,this.config=D}var F=B.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},B.probe=function(D){return Object(G.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},F.demux=function(D){var y=D,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(G.appendUint8Array)(this.remainderData,D));var O=Object(G.segmentValidRange)(y);this.remainderData=O.remainder,S.samples=O.valid||new Uint8Array}else S.samples=y;return{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.demuxSampleAes=function(D,y,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"appendFrame",function(){return M}),L.d(V,"parseHeader",function(){return D}),L.d(V,"isHeaderPattern",function(){return y}),L.d(V,"isHeader",function(){return S}),L.d(V,"canParse",function(){return O}),L.d(V,"probe",function(){return C});var G=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function M(w,v,d,o,u){if(d+24>v.length)return;var s=D(v,d);if(s&&d+s.frameLength<=v.length){var x=s.samplesPerFrame*9e4/s.sampleRate,p=o+u*x,f={unit:v.subarray(d,d+s.frameLength),pts:p,dts:p};return w.config=[],w.channelCount=s.channelCount,w.samplerate=s.sampleRate,w.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function D(w,v){var d=w[v+1]>>3&3,o=w[v+1]>>1&3,u=w[v+2]>>4&15,s=w[v+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var x=w[v+2]>>1&1,p=w[v+3]>>6,f=d===3?3-o:o===3?3:4,A=I[f*14+u-1]*1e3,b=d===3?0:d===2?1:2,h=R[b*3+s],c=p===3?1:2,l=B[d][o],a=F[o],g=l*8*a,m=Math.floor(l*A/h+x)*a;if(G===null){var E=navigator.userAgent||"",P=E.match(/Chrome\/(\d+)/i);G=P?parseInt(P[1]):0}var U=!!G&&G<=87;return U&&o===2&&A>=224e3&&p===0&&(w[v+3]=w[v+3]|128),{sampleRate:h,channelCount:c,frameLength:m,samplesPerFrame:g}}}function y(w,v){return w[v]===255&&(w[v+1]&224)===224&&(w[v+1]&6)!==0}function S(w,v){return v+1<w.length&&y(w,v)}function O(w,v){var d=4;return y(w,v)&&d<=w.length-v}function C(w,v){if(v+1<w.length&&y(w,v)){var d=4,o=D(w,v),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var s=v+u;return s===w.length||S(w,s)}return!1}},"./src/demux/sample-aes.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),R=function(){function B(M,D,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new G.default(M,D,{removePKCS7Padding:!1})}var F=B.prototype;return F.decryptBuffer=function(D,y){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,y)},F.decryptAacSample=function(D,y,S,O){var C=D[y].unit,w=C.subarray(16,C.length-C.length%16),v=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),d=this;this.decryptBuffer(v,function(o){var u=new Uint8Array(o);C.set(u,16),O||d.decryptAacSamples(D,y+1,S)})},F.decryptAacSamples=function(D,y,S){for(;;y++){if(y>=D.length){S();return}if(D[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(D,y,S,O),!O)return}},F.getAvcEncryptedData=function(D){for(var y=Math.floor((D.length-48)/160)*16+16,S=new Int8Array(y),O=0,C=32;C<=D.length-16;C+=160,O+=16)S.set(D.subarray(C,C+16),O);return S},F.getAvcDecryptedUnit=function(D,y){for(var S=new Uint8Array(y),O=0,C=32;C<=D.length-16;C+=160,O+=16)D.set(S.subarray(O,O+16),C);return D},F.decryptAvcSample=function(D,y,S,O,C,w){var v=Object(I.discardEPB)(C.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(u){C.data=o.getAvcDecryptedUnit(v,u),w||o.decryptAvcSamples(D,y,S+1,O)})},F.decryptAvcSamples=function(D,y,S,O){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,S=0){if(y>=D.length){O();return}for(var C=D[y].units;!(S>=C.length);S++){var w=C[S];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(D,y,S,O,w,v),!v)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./node_modules/webworkify-webpack/index.js"),I=L.n(G),R=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),F=L("./src/utils/logger.ts"),M=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),y=L("./node_modules/eventemitter3/index.js"),S=L.n(y),O=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function w(d,o,u,s){var x=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=s;var p=d.config,f=function(l,a){a=a||{},a.frag=x.frag,a.id=x.id,d.trigger(l,a)};this.observer=new y.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,f),this.observer.on(R.Events.ERROR,f);var A={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:A,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){F.logger.warn("Error in worker:",c),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,A,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,p,b,o)}var v=w.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(o,u,s,x,p,f,A,b,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,m=f?f.start:p.start,E=p.decryptdata,P=this.frag,U=!(P&&p.cc===P.cc),j=!(P&&h.level===P.level),W=P?h.sn-P.sn:-1,_=this.part?h.part-this.part.index:1,k=!j&&(W===1||W===0&&_===1),K=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),f&&(_||!k)&&(f.stats.parsing.start=K);var Y=new B.TransmuxState(U,k,b,j,m);if(!k||U){F.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+k+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var q=new B.TransmuxConfig(s,x,u,A,c);this.configureTransmuxer(q)}if(this.frag=p,this.part=f,g)g.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var ae=a.push(o,E,h,Y);Object(B.isPromise)(ae)?ae.then(function(Ee){l.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(ae)}},v.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:o});else if(s){var p=s.flush(o);Object(B.isPromise)(p)?p.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},v.handleFlushResult=function(o,u){var s=this;o.forEach(function(x){s.handleTransmuxComplete(x)}),this.onFlush(u)},v.onWorkerMessage=function(o){var u=o.data,s=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,s.trigger(u.event,u.data);break}}},v.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return M});var G=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),F=L.n(B);function M(C){var w=new B.EventEmitter,v=function(o,u){C.postMessage({event:o,data:u})};w.on(I.Events.FRAG_DECRYPTED,v),w.on(I.Events.ERROR,v),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);C.transmuxer=new G.default(w,o.typeSupported,u,o.vendor,o.id),Object(R.enableLogs)(u.debug),v("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var s=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(s)?s.then(function(f){D(C,f)}):D(C,s);break}case"flush":{var x=o.chunkMeta,p=C.transmuxer.flush(x);Object(G.isPromise)(p)?p.then(function(f){S(C,f,x)}):S(C,p,x);break}default:break}})}function D(C,w){if(O(w.remuxResult))return;var v=[],d=w.remuxResult,o=d.audio,u=d.video;o&&y(v,o),u&&y(v,u),C.postMessage({event:"transmuxComplete",data:w},v)}function y(C,w){w.data1&&C.push(w.data1.buffer),w.data2&&C.push(w.data2.buffer)}function S(C,w,v){w.forEach(function(d){D(C,d)}),C.postMessage({event:"flush",data:v})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u}),L.d(V,"isPromise",function(){return p}),L.d(V,"TransmuxConfig",function(){return f}),L.d(V,"TransmuxState",function(){return A});var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),F=L("./src/demux/mp4demuxer.ts"),M=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),y=L("./src/remux/mp4-remuxer.ts"),S=L("./src/remux/passthrough-remuxer.ts"),O=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),w=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(b){w.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:M.default,remux:y.default},{demux:F.default,remux:S.default},{demux:B.default,remux:y.default},{demux:D.default,remux:y.default}],o=1024;d.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function b(c,l,a,g,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=g,this.id=m}var h=b.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,g,m){var E=this,P=g.transmuxing;P.executeStart=v();var U=new Uint8Array(l),j=this.cache,W=this.config,_=this.currentTransmuxState,k=this.transmuxConfig;m&&(this.currentTransmuxState=m);var K=s(U,a);if(K&&K.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var q=Y.softwareDecrypt(U,K.key.buffer,K.iv.buffer);if(!q)return P.executeEnd=v(),x(g);U=new Uint8Array(q)}else return this.decryptionPromise=Y.webCryptoDecrypt(U,K.key.buffer,K.iv.buffer).then(function(Ce){var _e=E.push(Ce,null,g);return E.decryptionPromise=null,_e}),this.decryptionPromise}var ae=m||_,Ee=ae.contiguous,ve=ae.discontinuity,ge=ae.trackSwitch,fe=ae.accurateTimeOffset,me=ae.timeOffset,oe=k.audioCodec,pe=k.videoCodec,$=k.defaultInitPts,ie=k.duration,Z=k.initSegmentData;if((ve||ge)&&this.resetInitSegment(Z,oe,pe,ie),ve&&this.resetInitialTimestamp($),Ee||this.resetContiguity(),this.needsProbing(U,ve,ge)){if(j.dataLength){var xe=j.flush();U=Object(C.appendUint8Array)(xe,U)}this.configureTransmuxer(U,k)}var Le=this.transmux(U,K,me,fe,g),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,P.executeEnd=v(),Le},h.flush=function(l){var a=this,g=l.transmuxing;g.executeStart=v();var m=this.decrypter,E=this.cache,P=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(l)});var j=[],W=P.timeOffset;if(m){var _=m.flush();_&&j.push(this.push(_,null,l))}var k=E.dataLength;E.reset();var K=this.demuxer,Y=this.remuxer;if(!K||!Y)return k>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=v(),[x(l)];var q=K.flush(W);return p(q)?q.then(function(ae){return a.flushRemux(j,ae,l),j}):(this.flushRemux(j,q,l),j)},h.flushRemux=function(l,a,g){var m=a.audioTrack,E=a.avcTrack,P=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,_=j.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var k=this.remuxer.remux(m,E,P,U,_,W,!0,this.id);l.push({remuxResult:k,chunkMeta:g}),g.transmuxing.executeEnd=v()},h.resetInitialTimestamp=function(l){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(l),g.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,g,m){var E=this.demuxer,P=this.remuxer;if(!E||!P)return;E.resetInitSegment(a,g,m),P.resetInitSegment(l,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,g,m,E){var P;return a&&a.method==="SAMPLE-AES"?P=this.transmuxSampleAes(l,a,g,m,E):P=this.transmuxUnencrypted(l,g,m,E),P},h.transmuxUnencrypted=function(l,a,g,m){var E=this.demuxer.demux(l,a,!1,!this.config.progressive),P=E.audioTrack,U=E.avcTrack,j=E.id3Track,W=E.textTrack,_=this.remuxer.remux(P,U,j,W,a,g,!1,this.id);return{remuxResult:_,chunkMeta:m}},h.transmuxSampleAes=function(l,a,g,m,E){var P=this;return this.demuxer.demuxSampleAes(l,a,g).then(function(U){var j=P.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,g,m,!1,P.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(l,a){for(var g=this.config,m=this.observer,E=this.typeSupported,P=this.vendor,U=a.audioCodec,j=a.defaultInitPts,W=a.duration,_=a.initSegmentData,k=a.videoCodec,K,Y=0,q=d.length;Y<q;Y++)if(d[Y].demux.probe(l)){K=d[Y];break}K||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:F.default,remux:S.default});var ae=this.demuxer,Ee=this.remuxer,ve=K.remux,ge=K.demux;(!Ee||!(Ee instanceof ve))&&(this.remuxer=new ve(m,g,E,P)),(!ae||!(ae instanceof ge))&&(this.demuxer=new ge(m,g,E),this.probe=ge.probe),this.resetInitSegment(_,U,k,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},b}();function s(b,h){var c=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var x=function(h){return{remuxResult:{},chunkMeta:h}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(h,c,l,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=g},A=function(h,c,l,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"discardEPB",function(){return x});var G=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),R=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),F=L("./src/demux/sample-aes.ts"),M=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),y=L("./src/utils/logger.ts"),S=L("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function p(A,b,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=b,this.typeSupported=h}p.probe=function(b){var h=p.syncOffset(b);return h<0?!1:(h&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),c=0;c<h;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:O[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var f=p.prototype;return f.resetInitSegment=function(b,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,m=this._audioTrack,E=this._id3Track,P=g.pid,U=g.pesData,j=m.pid,W=E.pid,_=m.pesData,k=E.pesData,K=!1,Y=this.pmtParsed,q=this._pmtId,ae=b.length;if(this.remainderData&&(b=Object(D.appendUint8Array)(this.remainderData,b),ae=b.length,this.remainderData=null),ae<188&&!l)return this.remainderData=b,{audioTrack:m,avcTrack:g,id3Track:E,textTrack:this._txtTrack};var Ee=Math.max(0,p.syncOffset(b));ae-=(ae+Ee)%188,ae<b.byteLength&&!l&&(this.remainderData=new Uint8Array(b.buffer,ae,b.buffer.byteLength-ae));for(var ve=Ee;ve<ae;ve+=188)if(b[ve]===71){var ge=!!(b[ve+1]&64),fe=((b[ve+1]&31)<<8)+b[ve+2],me=(b[ve+3]&48)>>4,oe=void 0;if(me>1){if(oe=ve+5+b[ve+4],oe===ve+188)continue}else oe=ve+4;switch(fe){case P:ge&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(oe,ve+188)),U.size+=ve+188-oe);break;case j:ge&&(_&&(a=o(_))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(b.subarray(oe,ve+188)),_.size+=ve+188-oe);break;case W:ge&&(k&&(a=o(k))&&this.parseID3PES(a),k={data:[],size:0}),k&&(k.data.push(b.subarray(oe,ve+188)),k.size+=ve+188-oe);break;case 0:ge&&(oe+=b[oe]+1),q=this._pmtId=v(b,oe);break;case q:{ge&&(oe+=b[oe]+1);var pe=d(b,oe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);P=pe.avc,P>0&&(g.pid=P),j=pe.audio,j>0&&(m.pid=j,m.isAAC=pe.isAAC),W=pe.id3,W>0&&(E.pid=W),K&&!Y&&(y.logger.log("reparse from beginning"),K=!1,ve=Ee-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=U,m.pesData=_,E.pesData=k;var $={audioTrack:m,avcTrack:g,id3Track:E,textTrack:this._txtTrack};return l&&this.extractRemainingSamples($),$},f.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},f.extractRemainingSamples=function(b){var h=b.audioTrack,c=b.avcTrack,l=b.id3Track,a=c.pesData,g=h.pesData,m=l.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,g&&(E=o(g))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(g!=null&&g.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),m&&(E=o(m))?(this.parseID3PES(E),l.pesData=null):l.pesData=m},f.demuxSampleAes=function(b,h,c){var l=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new F.default(this.observer,this.config,h);return this.decrypt(l,a)},f.decrypt=function(b,h){return new Promise(function(c){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),g=!1,m=this.avcSample,E,P=!1;b.data=null,m&&a.length&&!l.audFound&&(u(m,l),m=this.avcSample=w(!1,b.pts,b.dts,"")),a.forEach(function(U){switch(U.type){case 1:{E=!0,m||(m=c.avcSample=w(!0,b.pts,b.dts,"")),g&&(m.debug+="NDR "),m.frame=!0;var j=U.data;if(P&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=c.avcSample=w(!0,b.pts,b.dts,"")),g&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,g&&m&&(m.debug+="SEI ");var _=new R.default(x(U.data));_.readUByte();for(var k=0,K=0,Y=!1,q=0;!Y&&_.bytesAvailable>1;){k=0;do q=_.readUByte(),k+=q;while(q===255);K=0;do q=_.readUByte(),K+=q;while(q===255);if(k===4&&_.bytesAvailable!==0){Y=!0;var ae=_.readUByte();if(ae===181){var Ee=_.readUShort();if(Ee===49){var ve=_.readUInt();if(ve===1195456820){var ge=_.readUByte();if(ge===3){for(var fe=_.readUByte(),me=_.readUByte(),oe=31&fe,pe=[fe,me],$=0;$<oe;$++)pe.push(_.readUByte()),pe.push(_.readUByte()),pe.push(_.readUByte());s(c._txtTrack.samples,{type:3,pts:b.pts,bytes:pe})}}}}}else if(k===5&&_.bytesAvailable!==0){if(Y=!0,K>16){for(var ie=[],Z=0;Z<16;Z++)ie.push(_.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ie.push("-");for(var xe=K-16,Le=new Uint8Array(xe),be=0;be<xe;be++)Le[be]=_.readUByte();s(c._txtTrack.samples,{pts:b.pts,payloadType:k,uuid:ie.join(""),userData:Object(B.utf8ArrayToStr)(Le),userDataBytes:Le})}}else if(K<_.bytesAvailable)for(var Ce=0;Ce<K;Ce++)_.readUByte()}break}case 7:if(E=!0,P=!0,g&&m&&(m.debug+="SPS "),!l.sps){var _e=new R.default(U.data),ke=_e.readSPS();l.width=ke.width,l.height=ke.height,l.pixelRatio=ke.pixelRatio,l.sps=[U.data],l.duration=c._duration;for(var Ue=U.data.subarray(1,4),Pe="avc1.",Oe=0;Oe<3;Oe++){var Je=Ue[Oe].toString(16);Je.length<2&&(Je="0"+Je),Pe+=Je}l.codec=Pe}break;case 8:E=!0,g&&m&&(m.debug+="PPS "),l.pps||(l.pps=[U.data]);break;case 9:E=!1,l.audFound=!0,m&&u(m,l),m=c.avcSample=w(!1,b.pts,b.dts,g?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+U.type+" ");break}if(m&&E){var Qe=m.units;Qe.push(U)}}),h&&m&&(u(m,l),this.avcSample=null)},f.getLastNalUnit=function(){var b,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var a=h.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(b){var h=b.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,g=[],m=0,E,P,U,j=-1,W=0;for(l===-1&&(j=0,W=b[0]&31,l=0,m=1);m<h;){if(E=b[m++],!l){l=E?0:1;continue}if(l===1){l=E?0:2;continue}if(!E)l=3;else if(E===1){if(j>=0){var _={data:b.subarray(j,m-l-1),type:W};g.push(_)}else{var k=this.getLastNalUnit();if(k&&(a&&m<=4-a&&(k.state&&(k.data=k.data.subarray(0,k.data.byteLength-a))),P=m-l-1,P>0)){var K=new Uint8Array(k.data.byteLength+P);K.set(k.data,0),K.set(b.subarray(0,P),k.data.byteLength),k.data=K,k.state=0}}m<h?(U=b[m]&31,j=m,W=U,l=0):l=-1}else l=0}if(j>=0&&l>=0){var Y={data:b.subarray(j,h),type:W,state:l};g.push(Y)}if(g.length===0){var q=this.getLastNalUnit();if(q){var ae=new Uint8Array(q.data.byteLength+b.byteLength);ae.set(q.data,0),ae.set(b,q.data.byteLength),q.data=ae}}return c.naluState=l,g},f.parseAACPES=function(b){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var g=l.sample.unit.byteLength,m=Math.min(l.missing,g),E=g-m;l.sample.unit.set(a.subarray(0,m),E),c.samples.push(l.sample),h=l.missing}var P,U;for(P=h,U=a.length;P<U-1&&!G.isHeader(a,P);P++);if(P!==h){var j,W;if(P<U-1?(j="AAC PES did not start with ADTS header,offset:"+P,W=!1):(j="no ADTS header found in AAC PES",W=!0),y.logger.warn("parsing error:"+j),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,P,this.audioCodec);var _;if(b.pts!==void 0)_=b.pts;else if(l){var k=G.getFrameDuration(c.samplerate);_=l.sample.pts+k}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;P<U;)if(G.isHeader(a,P)){if(P+5<U){var Y=G.appendFrame(c,a,P,_,K);if(Y)if(Y.missing)this.aacOverFlow=Y;else{P+=Y.length,K++;continue}}break}else P++},f.parseMPEGPES=function(b){var h=b.data,c=h.length,l=0,a=0,g=b.pts;if(g===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var m=I.appendFrame(this._audioTrack,h,a,g,l);if(m)a+=m.length,l++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();C.minProbeByteLength=188;function w(p,f,A,b){return{key:p,frame:!1,pts:f,dts:A,units:[],debug:b,length:0}}function v(p,f){return(p[f+10]&31)<<8|p[f+11]}function d(p,f,A,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],l=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<l;){var g=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:A?h.audio===-1&&(h.audio=g,h.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return h}function o(p){var f=0,A,b,h,c,l,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}A=a[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(b=(A[4]<<8)+A[5],b&&b>p.size-6)return null;var E=A[7];E&192&&(c=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,E&64?(l=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,c-l>60*9e4&&(y.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=A[8];var P=h+9;if(p.size<=P)return null;p.size-=P;for(var U=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){A=a[j];var _=A.byteLength;if(P)if(P>_){P-=_;continue}else A=A.subarray(P),_-=P,P=0;U.set(A,f),f+=_}return b&&(b-=h+3),{data:U,pts:c,dts:l,len:b}}return null}function u(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var A=f.samples,b=A.length;if(b){var h=A[b-1];p.pts=h.pts,p.dts=h.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function s(p,f){var A=p.length;if(A>0){if(f.pts>=p[A-1].pts)p.push(f);else for(var b=A-1;b>=0;b--)if(f.pts<p[b].pts){p.splice(b,0,f);break}}else p.push(f)}function x(p){for(var f=p.byteLength,A=[],b=1;b<f-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(A.push(b+2),b+=2):b++;if(A.length===0)return p;var h=f-A.length,c=new Uint8Array(h),l=0;for(b=0;b<h;l++,b++)l===A[0]&&(l++,A.shift()),c[b]=p[l];return c}V.default=C},"./src/errors.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ErrorTypes",function(){return G}),L.d(V,"ErrorDetails",function(){return I});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"Events",function(){return G});var G;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return p});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G),R=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),F=L("./src/controller/id3-track-controller.ts"),M=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),y=L("./src/controller/fragment-tracker.ts"),S=L("./src/controller/stream-controller.ts"),O=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),w=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),d=L.n(v),o=L("./src/events.ts"),u=L("./src/errors.ts");function s(f,A){for(var b=0;b<A.length;b++){var h=A[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function x(f,A,b){return A&&s(f.prototype,A),b&&s(f,b),f}var p=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(b){b===void 0&&(b={}),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 h=this.config=Object(w.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(w.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,g=h.fpsController,m=this.abrController=new c(this),E=this.bufferController=new l(this),P=this.capLevelController=new a(this),U=new g(this),j=new R.default(this),W=new B.default(this),_=new F.default(this),k=this.levelController=new D.default(this),K=new y.FragmentTracker(this),Y=this.streamController=new S.default(this,K);P.setStreamController(Y),U.setStreamController(Y);var q=[k,Y];this.networkControllers=q;var ae=[j,W,m,E,P,U,_,K];this.audioTrackController=this.createController(h.audioTrackController,null,q),this.createController(h.audioStreamController,K,q),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,q),this.createController(h.subtitleStreamController,K,q),this.createController(h.timelineController,null,ae),this.emeController=this.createController(h.emeController,null,ae),this.cmcdController=this.createController(h.cmcdController,null,ae),this.latencyController=this.createController(M.default,null,ae),this.coreComponents=ae}var A=f.prototype;return A.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},A.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},A.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},A.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},A.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},A.listeners=function(h){return this._emitter.listeners(h)},A.emit=function(h,c,l){return this._emitter.emit(h,c,l)},A.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},A.listenerCount=function(h){return this._emitter.listenerCount(h)},A.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},A.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},A.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},A.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},A.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},A.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},A.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},x(f,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;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(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:w.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isSupported",function(){return R}),L.d(V,"changeTypeSupported",function(){return B});var G=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var F=Object(G.getMediaSource)();if(!F)return!1;var M=I(),D=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!D&&!!y}function B(){var F,M=I();return typeof(M==null||((F=M.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C}),L.d(V,"LoadError",function(){return v});var G=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!D(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,x)}function x(){return F(s,arguments,S(this).constructor)}return x.prototype=Object.create(s.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),y(x,s)},B(d)}function F(d,o,u){return M()?F=Reflect.construct:F=function(x,p,f){var A=[null];A.push.apply(A,p);var b=Function.bind.apply(x,A),h=new b;return f&&y(h,f.prototype),h},F.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function D(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(s,x){return s.__proto__=x,s},y(d,o)}function S(d){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},S(d)}var O=Math.pow(2,17),C=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,x){var p=this,f=s.url;if(!f)return Promise.reject(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var A=this.config,b=A.fLoader,h=A.loader;return new Promise(function(c,l){p.loader&&p.loader.destroy();var a=p.loader=s.loader=b?new b(A):new h(A),g=w(s),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=a.stats,a.load(g,m,{onSuccess:function(P,U,j,W){p.resetLoader(s,a),c({frag:s,part:null,payload:P.data,networkDetails:W})},onError:function(P,U,j){p.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:P,networkDetails:j}))},onAbort:function(P,U,j){p.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(P,U,j){p.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(P,U,j,W){x&&x({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,x,p){var f=this;this.abort();var A=this.config,b=A.fLoader,h=A.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=b?new b(A):new h(A),g=w(s,x),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:O};x.stats=a.stats,a.load(g,m,{onSuccess:function(P,U,j,W){f.resetLoader(s,a),f.updateStatsFromPart(s,x);var _={frag:s,part:x,payload:P.data,networkDetails:W};p(_),c(_)},onError:function(P,U,j){f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:x,response:P,networkDetails:j}))},onAbort:function(P,U,j){s.stats.aborted=x.stats.aborted,f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:x,networkDetails:j}))},onTimeout:function(P,U,j){f.resetLoader(s,a),l(new v({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:x,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,x){var p=s.stats,f=x.stats,A=f.total;if(p.loaded+=f.loaded,A){var b=Math.round(s.duration/x.duration),h=Math.min(Math.round(p.loaded/A),b),c=b-h,l=c*Math.round(p.loaded/h);p.total=p.loaded+l}else p.total=Math.max(p.loaded,p.total);var a=p.loading,g=f.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(s,x){s.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},d}();function w(d,o){o===void 0&&(o=null);var u=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},x=u.byteRangeStartOffset,p=u.byteRangeEndOffset;return Object(G.isFiniteNumber)(x)&&Object(G.isFiniteNumber)(p)&&(s.rangeStart=x,s.rangeEnd=p),s}var v=function(d){R(o,d);function o(u){for(var s,x=arguments.length,p=new Array(x>1?x-1:0),f=1;f<x;f++)p[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(p))||this,s.data=void 0,s.data=u,s}return o}(B(Error))},"./src/loader/fragment.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ElementaryStreamTypes",function(){return C}),L.d(V,"BaseSegment",function(){return w}),L.d(V,"Fragment",function(){return v}),L.d(V,"Part",function(){return d});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/utils/logger.ts"),F=L("./src/loader/level-key.ts"),M=L("./src/loader/load-stats.ts");function D(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,y(o,u)}function y(o,u){return y=Object.setPrototypeOf||function(x,p){return x.__proto__=p,x},y(o,u)}function S(o,u){for(var s=0;s<u.length;s++){var x=u[s];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function O(o,u,s){return u&&S(o.prototype,u),s&&S(o,s),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var w=function(){function o(s){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[C.AUDIO]=null,x[C.VIDEO]=null,x[C.AUDIOVIDEO]=null,x),this.baseurl=s}var u=o.prototype;return u.setByteRange=function(x,p){var f=x.split("@",2),A=[];f.length===1?A[0]=p?p.byteRangeEndOffset:0:A[0]=parseInt(f[1]),A[1]=parseInt(f[0])+A[0],this._byteRange=A},O(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(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),o}(),v=function(o){D(u,o);function u(x,p){var f;return f=o.call(this,p)||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 M.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=x,f}var s=u.prototype;return s.createInitializationVector=function(p){for(var f=new Uint8Array(16),A=12;A<16;A++)f[A]=p>>8*(15-A)&255;return f},s.setDecryptDataFromLevelKey=function(p,f){var A=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(A=F.LevelKey.fromURI(p.uri),A.method=p.method,A.iv=this.createInitializationVector(f),A.keyFormat="identity"),A},s.setElementaryStreamInfo=function(p,f,A,b,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[p];if(!a){l[p]={startPTS:f,endPTS:A,startDTS:b,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},s.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var p=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),u}(w),d=function(o){D(u,o);function u(s,x,p,f,A){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new M.LoadStats,b.duration=s.decimalFloatingPoint("DURATION"),b.gap=s.bool("GAP"),b.independent=s.bool("INDEPENDENT"),b.relurl=s.enumeratedString("URI"),b.fragment=x,b.index=f;var h=s.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,A),A&&(b.fragOffset=A.fragOffset+A.duration),b}return O(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),u}(w)},"./src/loader/key-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return B});var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=function(){function F(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var M=F.prototype;return M._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var S=this.loaders[y];S&&S.destroy()}this.loaders={}},M.onKeyLoading=function(y,S){var O=S.frag,C=O.type,w=this.loaders[C];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=O.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(w&&(R.logger.warn("abort previous key loader for type:"+C),w.abort()),!v){R.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[C]=new o(d);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:O,responseType:"arraybuffer"},x={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,x,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:O}))},M.loadsuccess=function(y,S,O){var C=O.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(y.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},M.loaderror=function(y,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},M.loadtimeout=function(y,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},F}()},"./src/loader/level-details.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LevelDetails",function(){return F});var G=L("./src/polyfills/number.ts");function I(M,D){for(var y=0;y<D.length;y++){var S=D[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(M,S.key,S)}}function R(M,D,y){return D&&I(M.prototype,D),y&&I(M,y),M}var B=10,F=function(){function M(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var D=M.prototype;return D.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-S.lastPartSn,C=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!C||!!O,this.advanced=this.endSN>S.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var O=this.driftEnd-this.driftStart;return O*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LevelKey",function(){return F});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G);function R(M,D){for(var y=0;y<D.length;y++){var S=D[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(M,S.key,S)}}function B(M,D,y){return D&&R(M.prototype,D),y&&R(M,y),M}var F=function(){M.fromURL=function(y,S){return new M(y,S)},M.fromURI=function(y){return new M(y)};function M(D,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(G.buildAbsoluteURL)(D,y,{alwaysNormalize:!0}):this._uri=D}return B(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"LoadStats",function(){return G});var G=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(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/loader/fragment.ts"),F=L("./src/loader/level-details.ts"),M=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),y=L("./src/utils/logger.ts"),S=L("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,w=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 b,h;return d.test((b=(h=I.parseURL(A))===null||h===void 0?void 0:h.path)!=null?b:"")}var u=function(){function A(){}return A.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},A.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},A.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(h,c){var l=[],a={},g=!1;O.lastIndex=0;for(var m;(m=O.exec(h))!=null;)if(m[1]){var E=new D.AttrList(m[1]),P={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:A.resolve(m[2],c)},U=E.decimalResolution("RESOLUTION");U&&(P.width=U.width,P.height=U.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=A.convertAVC1ToAVCOTI(P.videoCodec)),l.push(P)}else if(m[3]){var j=new D.AttrList(m[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:g?a:null}},A.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var g,m=[],E=0;for(C.lastIndex=0;(g=C.exec(h))!==null;){var P=new D.AttrList(g[1]);if(P.TYPE===l){var U={attrs:P,bitrate:0,id:E++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:l,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?A.resolve(P.URI,c):""};if(a.length){var j=A.findGroup(a,U.groupId)||a[0];x(U,j,"audioCodec"),x(U,j,"textCodec")}m.push(U)}}return m},A.parseLevelPlaylist=function(h,c,l,a,g){var m=new F.LevelDetails(c),E=m.fragments,P=null,U=0,j=0,W=0,_=0,k=null,K=new B.Fragment(a,c),Y,q,ae,Ee=-1,ve=!1;for(w.lastIndex=0,m.m3u8=h;(Y=w.exec(h))!==null;){ve&&(ve=!1,K=new B.Fragment(a,c),K.start=W,K.sn=U,K.cc=_,K.level=l,P&&(K.initSegment=P,K.rawProgramDateTime=P.rawProgramDateTime));var ge=Y[1];if(ge){K.duration=parseFloat(ge);var fe=(" "+Y[2]).slice(1);K.title=fe||null,K.tagList.push(fe?["INF",ge,fe]:["INF",ge])}else if(Y[3])Object(G.isFiniteNumber)(K.duration)&&(K.start=W,ae&&(K.levelkey=ae),K.sn=U,K.level=l,K.cc=_,K.urlId=g,E.push(K),K.relurl=(" "+Y[3]).slice(1),f(K,k),k=K,W+=K.duration,U++,j=0,ve=!0);else if(Y[4]){var me=(" "+Y[4]).slice(1);k?K.setByteRange(me,k):K.setByteRange(me)}else if(Y[5])K.rawProgramDateTime=(" "+Y[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),Ee===-1&&(Ee=E.length);else{if(Y=Y[0].match(v),!Y){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<Y.length&&!(typeof Y[q]!="undefined");q++);var oe=(" "+Y[q]).slice(1),pe=(" "+Y[q+1]).slice(1),$=Y[q+2]?(" "+Y[q+2]).slice(1):"";switch(oe){case"PLAYLIST-TYPE":m.type=pe.toUpperCase();break;case"MEDIA-SEQUENCE":U=m.startSN=parseInt(pe);break;case"SKIP":{var ie=new D.AttrList(pe),Z=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(Z)){m.skippedSegments=Z;for(var xe=Z;xe--;)E.unshift(null);U+=Z}var Le=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(m.recentlyRemovedDateranges=Le.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(pe);break;case"VERSION":m.version=parseInt(pe);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(pe||$)&&K.tagList.push($?[pe,$]:[pe]);break;case"DIS":_++;case"GAP":K.tagList.push([oe]);break;case"BITRATE":K.tagList.push([oe,pe]);break;case"DISCONTINUITY-SEQ":_=parseInt(pe);break;case"KEY":{var be,Ce=new D.AttrList(pe),_e=Ce.enumeratedString("METHOD"),ke=Ce.URI,Ue=Ce.hexadecimalInteger("IV"),Pe=Ce.enumeratedString("KEYFORMATVERSIONS"),Oe=Ce.enumeratedString("KEYID"),Je=(be=Ce.enumeratedString("KEYFORMAT"))!=null?be:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(Je)>-1){y.logger.warn("Keyformat "+Je+" is not supported from the manifest");continue}else if(Je!=="identity")continue;_e&&(ae=M.LevelKey.fromURL(c,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(ae.method=_e,ae.keyFormat=Je,Oe&&(ae.keyID=Oe),Pe&&(ae.keyFormatVersions=Pe),ae.iv=Ue));break}case"START":{var We=new D.AttrList(pe),Ge=We.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(Ge)&&(m.startTimeOffset=Ge);break}case"MAP":{var Ze=new D.AttrList(pe);K.relurl=Ze.URI,Ze.BYTERANGE&&K.setByteRange(Ze.BYTERANGE),K.level=l,K.sn="initSegment",ae&&(K.levelkey=ae),K.initSegment=null,P=K,ve=!0;break}case"SERVER-CONTROL":{var He=new D.AttrList(pe);m.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),m.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ke=new D.AttrList(pe);m.partTarget=Ke.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=m.partList;Se||(Se=m.partList=[]);var et=j>0?Se[Se.length-1]:void 0,Ye=j++,De=new B.Part(new D.AttrList(pe),K,c,Ye,et);Se.push(De),K.duration+=De.duration;break}case"PRELOAD-HINT":{var Fe=new D.AttrList(pe);m.preloadHint=Fe;break}case"RENDITION-REPORT":{var he=new D.AttrList(pe);m.renditionReports=m.renditionReports||[],m.renditionReports.push(he);break}default:y.logger.warn("line parsed but not handled: "+Y);break}}}k&&!k.relurl?(E.pop(),W-=k.duration,m.partList&&(m.fragmentHint=k)):m.partList&&(f(K,k),K.cc=_,m.fragmentHint=K);var le=E.length,de=E[0],J=E[le-1];if(W+=m.skippedSegments*m.targetduration,W>0&&le&&J){m.averagetargetduration=W/le;var Q=J.sn;m.endSN=Q!=="initSegment"?Q:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(a,c),K.relurl=J.relurl,K.level=l,K.sn="initSegment",de.initSegment=K,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=_,Ee>0&&p(E,Ee),m},A}();function s(A,b){["video","audio","text"].forEach(function(h){var c=A.filter(function(a){return Object(S.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=l.length>0?l[0]:c[0],A=A.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=A}function x(A,b,h){var c=b[h];c&&(A[h]=c)}function p(A,b){for(var h=A[b],c=b;c--;){var l=A[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function f(A,b){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):b!=null&&b.programDateTime&&(A.programDateTime=b.endProgramDateTime),Object(G.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),M=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),y=L("./src/utils/attr-list.ts");function S(w){var v=w.type;switch(v){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function O(w,v){var d=w.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var C=function(){function w(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=w.prototype;return v.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,x=u.loader,p=s||x,f=new p(u);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 u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(o,u){var s=u.id,x=u.level,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:x,responseType:"text",type:D.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,u){var s=u.id,x=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:x,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,u){var s=u.id,x=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:x,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},v.load=function(o){var u,s=this.hls.config,x=this.getInternalLoader(o);if(x){var p=x.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),x.abort()}var f,A,b,h;switch(o.type){case D.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,A=s.manifestLoadingTimeOut,b=s.manifestLoadingRetryDelay,h=s.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:f=0,A=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,A=s.levelLoadingTimeOut,b=s.levelLoadingRetryDelay,h=s.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(A=Math.min(Math.max(l*3,a*.8)*1e3,A))}}var g={timeout:A,maxRetry:f,retryDelay:b,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(o,g,m)},v.loadsuccess=function(o,u,s,x){if(x===void 0&&(x=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,x);return}this.resetInternalLoader(s.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",x);return}u.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,x):this.handleMasterPlaylist(o,u,s,x)},v.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},v.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},v.handleMasterPlaylist=function(o,u,s,x){var p=this.hls,f=o.data,A=O(o,s),b=M.default.parseMasterPlaylist(f,A),h=b.levels,c=b.sessionData;if(!h.length){this.handleManifestParsingError(o,s,"no level found in manifest",x);return}var l=h.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=h.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),g=M.default.parseMasterPlaylistMedia(f,A,"AUDIO",l),m=M.default.parseMasterPlaylistMedia(f,A,"SUBTITLES",a),E=M.default.parseMasterPlaylistMedia(f,A,"CLOSED-CAPTIONS");if(g.length){var P=g.some(function(U){return!U.url});!P&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:m,captions:E,url:A,stats:u,networkDetails:x,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,u,s,x){var p=this.hls,f=s.id,A=s.level,b=s.type,h=O(o,s),c=Object(G.isFiniteNumber)(f)?f:0,l=Object(G.isFiniteNumber)(A)?A:c,a=S(s),g=M.default.parseLevelPlaylist(o.data,h,l,a,c);if(!g.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(b===D.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:g,name:"",url:h};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:x,sessionData:null})}if(u.parsing.end=performance.now(),g.needSidxRanges){var E,P=(E=g.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:P,isSidxRequest:!0,type:b,level:A,levelDetails:g,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=g,this.handlePlaylistLoaded(o,u,s,x)},v.handleSidxRequest=function(o,u){var s=Object(F.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var x=s.references,p=u.levelDetails;x.forEach(function(f,A){var b=f.info,h=p.fragments[A];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,u,s,x){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:x})},v.handleNetworkError=function(o,u,s,x){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=R.ErrorDetails.UNKNOWN,f=!1,A=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:p=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case D.PlaylistContextType.LEVEL:p=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case D.PlaylistContextType.AUDIO_TRACK:p=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:p=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}A&&this.resetInternalLoader(o.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:A,context:o,networkDetails:u};x&&(b.response=x),this.hls.trigger(I.Events.ERROR,b)},v.handlePlaylistLoaded=function(o,u,s,x){var p=s.type,f=s.level,A=s.id,b=s.groupId,h=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",x);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:f||0,id:A||0,stats:u,networkDetails:x,deliveryDirectives:l});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:A||0,groupId:b||"",stats:u,networkDetails:x,deliveryDirectives:l});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:A||0,groupId:b||"",stats:u,networkDetails:x,deliveryDirectives:l});break}},w}();V.default=C},"./src/polyfills/number.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isFiniteNumber",function(){return G}),L.d(V,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,L){"use strict";L.r(V);var G=function(){function I(){}return I.getSilentFrame=function(B,F){switch(B){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();V.default=G},"./src/remux/mp4-generator.ts":function(re,V,L){"use strict";L.r(V);var G=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in R.types)R.types.hasOwnProperty(F)&&(R.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var M=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]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:M,audio:D};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,w,O,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,y))},R.box=function(F){for(var M=8,D=arguments.length,y=new Array(D>1?D-1:0),S=1;S<D;S++)y[S-1]=arguments[S];for(var O=y.length,C=O;O--;)M+=y[O].byteLength;var w=new Uint8Array(M);for(w[0]=M>>24&255,w[1]=M>>16&255,w[2]=M>>8&255,w[3]=M&255,w.set(F,4),O=0,M=8;O<C;O++)w.set(y[O],M),M+=y[O].byteLength;return w},R.hdlr=function(F){return R.box(R.types.hdlr,R.HDLR_TYPES[F])},R.mdat=function(F){return R.box(R.types.mdat,F)},R.mdhd=function(F,M){M*=F;var D=Math.floor(M/(G+1)),y=Math.floor(M%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},R.mdia=function(F){return R.box(R.types.mdia,R.mdhd(F.timescale,F.duration),R.hdlr(F.type),R.minf(F))},R.mfhd=function(F){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},R.minf=function(F){return F.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(F)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(F))},R.moof=function(F,M,D){return R.box(R.types.moof,R.mfhd(F),R.traf(D,M))},R.moov=function(F){for(var M=F.length,D=[];M--;)D[M]=R.trak(F[M]);return R.box.apply(null,[R.types.moov,R.mvhd(F[0].timescale,F[0].duration)].concat(D).concat(R.mvex(F)))},R.mvex=function(F){for(var M=F.length,D=[];M--;)D[M]=R.trex(F[M]);return R.box.apply(null,[R.types.mvex].concat(D))},R.mvhd=function(F,M){M*=F;var D=Math.floor(M/(G+1)),y=Math.floor(M%(G+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(F){var M=F.samples||[],D=new Uint8Array(4+M.length),y,S;for(y=0;y<M.length;y++)S=M[y].flags,D[y+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,D)},R.stbl=function(F){return R.box(R.types.stbl,R.stsd(F),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(F){var M=[],D=[],y,S,O;for(y=0;y<F.sps.length;y++)S=F.sps[y],O=S.byteLength,M.push(O>>>8&255),M.push(O&255),M=M.concat(Array.prototype.slice.call(S));for(y=0;y<F.pps.length;y++)S=F.pps[y],O=S.byteLength,D.push(O>>>8&255),D.push(O&255),D=D.concat(Array.prototype.slice.call(S));var C=R.box(R.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|F.sps.length].concat(M).concat([F.pps.length]).concat(D))),w=F.width,v=F.height,d=F.pixelRatio[0],o=F.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&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]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(F){var M=F.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(F.config).concat([6,1,2]))},R.mp4a=function(F){var M=F.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),R.box(R.types.esds,R.esds(F)))},R.mp3=function(F){var M=F.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},R.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(F)):R.box(R.types.stsd,R.STSD,R.mp4a(F)):R.box(R.types.stsd,R.STSD,R.avc1(F))},R.tkhd=function(F){var M=F.id,D=F.duration*F.timescale,y=F.width,S=F.height,O=Math.floor(D/(G+1)),C=Math.floor(D%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(F,M){var D=R.sdtp(F),y=F.id,S=Math.floor(M/(G+1)),O=Math.floor(M%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(F,D.length+16+20+8+16+8+8),D)},R.trak=function(F){return F.duration=F.duration||4294967295,R.box(R.types.trak,R.tkhd(F),R.mdia(F))},R.trex=function(F){var M=F.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(F,M){var D=F.samples||[],y=D.length,S=12+16*y,O=new Uint8Array(S),C,w,v,d,o,u;for(M+=8+S,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),C=0;C<y;C++)w=D[C],v=w.duration,d=w.size,o=w.flags,u=w.cts,O.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,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*C);return R.box(R.types.trun,O)},R.initSegment=function(F){R.types||R.init();var M=R.moov(F),D=new Uint8Array(R.FTYP.byteLength+M.byteLength);return D.set(R.FTYP),D.set(M,R.FTYP.byteLength),D},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,V.default=I},"./src/remux/mp4-remuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u}),L.d(V,"normalizePts",function(){return s});var G=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),R=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),F=L("./src/errors.ts"),M=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),y=L("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(A){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(A[c]=h[c])}return A},S.apply(this,arguments)}var O=10*1e3,C=1024,w=1152,v=null,d=null,o=!1,u=function(){function A(h,c,l,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=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,v===null){var g=navigator.userAgent||"",m=g.match(/Chrome\/(\d+)/i);v=m?parseInt(m[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!v&&v<75||!!d&&d<600}var b=A.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(g,m){var E=m.pts-g;return E<-4294967296?(l=!0,s(g,m.pts)):E>0?g:m.pts},c[0].pts);return l&&M.logger.debug("PTS rollover detected"),a},b.remux=function(c,l,a,g,m,E,P,U){var j,W,_,k,K,Y,q=m,ae=m,Ee=c.pid>-1,ve=l.pid>-1,ge=l.samples.length,fe=c.samples.length>0,me=ge>1,oe=(!Ee||fe)&&(!ve||me)||this.ISGenerated||P;if(oe){this.ISGenerated||(_=this.generateIS(c,l,m));var pe=this.isVideoContiguous,$=-1;if(me&&($=x(l.samples),!pe&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){M.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+ge+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(l.samples);l.samples=l.samples.slice($),l.dropped+=$,ae+=(l.samples[0].pts-ie)/(l.timescale||9e4)}else $===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(fe&&me){var Z=this.getVideoStartPts(l.samples),xe=s(c.samples[0].pts,Z)-Z,Le=xe/l.inputTimeScale;q+=Math.max(0,Le),ae+=Math.max(0,-Le)}if(fe){if(c.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(c,l,m)),W=this.remuxAudio(c,q,this.isAudioContiguous,E,ve||me||U===D.PlaylistLevelType.AUDIO?ae:void 0),me){var be=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(c,l,m)),j=this.remuxVideo(l,ae,pe,be)}}else me&&(j=this.remuxVideo(l,ae,pe,0));j&&(j.firstKeyFrame=$,j.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(K=this.remuxID3(a,m)),g.samples.length&&(k=this.remuxText(g,m))),{audio:W,video:j,initSegment:_,independent:Y,text:k,id3:K}},b.generateIS=function(c,l,a){var g=c.samples,m=l.samples,E=this.typeSupported,P={},U=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,_,k;if(U&&(W=_=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(j="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),P.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(k=c.inputTimeScale,W=_=g[0].pts-Math.round(k*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},U)){k=l.inputTimeScale;var K=this.getVideoStartPts(m),Y=Math.round(k*a);_=Math.min(_,s(m[0].dts,K)-Y),W=Math.min(W,K-Y)}if(Object.keys(P).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=_),{tracks:P,initPTS:W,timescale:k}},b.remuxVideo=function(c,l,a,g){var m=c.inputTimeScale,E=c.samples,P=[],U=E.length,j=this._initPTS,W=this.nextAvcDts,_=8,k,K,Y,q=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,Ee=0,ve=!1;if(!a||W===null){var ge=l*m,fe=E[0].pts-s(E[0].dts,E[0].pts);W=ge-fe}for(var me=0;me<U;me++){var oe=E[me];if(oe.pts=s(oe.pts-j,W),oe.dts=s(oe.dts-j,W),oe.dts>oe.pts){var pe=9e4*.2;Ee=Math.max(Math.min(Ee,oe.pts-oe.dts),-1*pe)}oe.dts<E[me>0?me-1:me].dts&&(ve=!0)}ve&&E.sort(function(mt,dt){var ot=mt.dts-dt.dts,Ct=mt.pts-dt.pts;return ot||Ct}),K=E[0].dts,Y=E[E.length-1].dts;var $=Math.round((Y-K)/(U-1));if(Ee<0){if(Ee<$*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ie=Ee,Z=0;Z<U;Z++)E[Z].dts=ie=Math.max(ie,E[Z].pts-$),E[Z].pts=Math.max(ie,E[Z].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var xe=0;xe<U;xe++)E[xe].dts=E[xe].dts+Ee}K=E[0].dts}if(a){var Le=K-W,be=Le>$,Ce=Le<-1;if(be||Ce){be?M.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Le,!0)+" ms ("+Le+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Le,!0)+" ms ("+Le+"dts) overlapping between fragments detected"),K=W;var _e=E[0].pts-Le;E[0].dts=K,E[0].pts=_e,M.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(_e,!0)+"/"+Object(y.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Le,!0)+" ms")}}o&&(K=Math.max(0,K));for(var ke=0,Ue=0,Pe=0;Pe<U;Pe++){for(var Oe=E[Pe],Je=Oe.units,Qe=Je.length,We=0,Ge=0;Ge<Qe;Ge++)We+=Je[Ge].data.length;Ue+=We,ke+=Qe,Oe.length=We,Oe.dts=Math.max(Oe.dts,K),Oe.pts=Math.max(Oe.pts,Oe.dts,0),q=Math.min(Oe.pts,q),ae=Math.max(Oe.pts,ae)}Y=E[U-1].dts;var Ze=Ue+4*ke+8,He;try{He=new Uint8Array(Ze)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ze,reason:"fail allocating video mdat "+Ze});return}var Ke=new DataView(He.buffer);Ke.setUint32(0,Ze),He.set(R.default.types.mdat,4);for(var Se=0;Se<U;Se++){for(var et=E[Se],Ye=et.units,De=0,Fe=0,he=Ye.length;Fe<he;Fe++){var le=Ye[Fe],de=le.data,J=le.data.byteLength;Ke.setUint32(_,J),_+=4,He.set(de,_),_+=J,De+=4+J}if(Se<U-1)k=E[Se+1].dts-et.dts;else{var Q=this.config,ee=et.dts-E[Se>0?Se-1:Se].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Q.maxBufferHole*m),ce=(g?q+g*m:this.nextAudioPts)-et.pts;ce>se?(k=ce-ee,k<0&&(k=ee),M.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=ee}else k=ee}var Ae=Math.round(et.pts-et.dts);P.push(new p(et.key,k,De,Ae))}if(P.length&&v&&v<70){var we=P[0].flags;we.dependsOn=2,we.isNonSync=0}console.assert(k!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+k,this.isVideoContiguous=!0;var Me=R.default.moof(c.sequenceNumber++,K,S({},c,{samples:P})),$e="video",ze={data1:Me,data2:He,startPTS:q/m,endPTS:(ae+k)/m,startDTS:K/m,endDTS:W/m,type:$e,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(He.length,"MDAT length must not be zero"),ze},b.remuxAudio=function(c,l,a,g,m){var E=c.inputTimeScale,P=c.samplerate?c.samplerate:E,U=E/P,j=c.isAAC?C:w,W=j*U,_=this._initPTS,k=!c.isAAC&&this.typeSupported.mpeg,K=[],Y=c.samples,q=k?0:8,ae=this.nextAudioPts||-1,Ee=l*E;if(this.isAudioContiguous=a=a||Y.length&&ae>0&&(g&&Math.abs(Ee-ae)<9e3||Math.abs(s(Y[0].pts-_,Ee)-ae)<20*W),Y.forEach(function(de){de.pts=s(de.pts-_,Ee)}),!a||ae<0){if(Y=Y.filter(function(de){return de.pts>=0}),!Y.length)return;m===0?ae=0:g?ae=Math.max(0,Ee):ae=Y[0].pts}if(c.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,fe=0,me=ae;fe<Y.length;fe++){var oe=Y[fe],pe=oe.pts,$=pe-me,ie=Math.abs(1e3*$/E);if($<=-ge*W&&ve)fe===0&&(M.logger.warn("Audio frame @ "+(pe/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/E)+" ms."),this.nextAudioPts=ae=me=pe);else if($>=ge*W&&ie<O&&ve){var Z=Math.round($/W);me=pe-Z*W,me<0&&(Z--,me+=W),fe===0&&(this.nextAudioPts=ae=me),M.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(me/E).toFixed(3)+"s due to "+Math.round(1e3*$/E)+" ms gap.");for(var xe=0;xe<Z;xe++){var Le=Math.max(me,0),be=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);be||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=oe.unit.subarray()),Y.splice(fe,0,{unit:be,pts:Le}),me+=W,fe++}}oe.pts=me,me+=W}for(var Ce=null,_e=null,ke,Ue=0,Pe=Y.length;Pe--;)Ue+=Y[Pe].unit.byteLength;for(var Oe=0,Je=Y.length;Oe<Je;Oe++){var Qe=Y[Oe],We=Qe.unit,Ge=Qe.pts;if(_e!==null){var Ze=K[Oe-1];Ze.duration=Math.round((Ge-_e)/U)}else if(a&&c.isAAC&&(Ge=ae),Ce=Ge,Ue>0){Ue+=q;try{ke=new Uint8Array(Ue)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating audio mdat "+Ue});return}if(!k){var He=new DataView(ke.buffer);He.setUint32(0,Ue),ke.set(R.default.types.mdat,4)}}else return;ke.set(We,q);var Ke=We.byteLength;q+=Ke,K.push(new p(!0,j,Ke,0)),_e=Ge}var Se=K.length;if(!Se)return;var et=K[K.length-1];this.nextAudioPts=ae=_e+U*et.duration;var Ye=k?new Uint8Array(0):R.default.moof(c.sequenceNumber++,Ce/U,S({},c,{samples:K}));c.samples=[];var De=Ce/E,Fe=ae/E,he="audio",le={data1:Ye,data2:ke,startPTS:De,endPTS:Fe,startDTS:De,endDTS:Fe,type:he,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},b.remuxEmptyAudio=function(c,l,a,g){var m=c.inputTimeScale,E=c.samplerate?c.samplerate:m,P=m/E,U=this.nextAudioPts,j=(U!==null?U:g.startDTS*m)+this._initDTS,W=g.endDTS*m+this._initDTS,_=P*C,k=Math.ceil((W-j)/_),K=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],q=0;q<k;q++){var ae=j+q*_;Y.push({unit:K,pts:ae,dts:ae})}return c.samples=Y,this.remuxAudio(c,l,a,!1)},b.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,E=this._initDTS,P=0;P<a;P++){var U=c.samples[P];U.pts=s(U.pts-m,l*g)/g,U.dts=s(U.dts-E,l*g)/g}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var P=c.samples[E];P.pts=s(P.pts-m,l*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},A}();function s(A,b){var h;if(b===null)return A;for(b<A?h=-8589934592:h=8589934592;Math.abs(A-b)>4294967296;)A+=h;return A}function x(A){for(var b=0;b<A.length;b++)if(A[b].key)return b;return-1}var p=function(b,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),F=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var S=y.prototype;return S.destroy=function(){},S.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(C,w,v){this.audioCodec=w,this.videoCodec=v,this.generateInitSegment(C),this.emitInitSegment=!0},S.generateInitSegment=function(C){var w=this.audioCodec,v=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(C);w||(w=D(d.audio,R.ElementaryStreamTypes.AUDIO)),v||(v=D(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:w+","+v,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:w,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(C,w,v,d,o){var u=this.initPTS,s=this.lastEndDTS,x={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(G.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var p=w.samples;if(!p||!p.length)return x;var f={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(p),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=M(A,p,s));var b=Object(I.getDuration)(p,A),h=s,c=b+h;Object(I.offsetStartDTS)(A,p,u),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!A.audio,a=!!A.video,g="";l&&(g+="audio"),a&&(g+="video");var m={data1:p,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:g,hasAudio:l,hasVideo:a,nb:1,dropped:0};return x.audio=m.type==="audio"?m:void 0,x.video=m.type!=="audio"?m:void 0,x.text=d,x.id3=v,x.initSegment=f,x},y}(),M=function(S,O,C){return Object(I.getStartDTS)(S,O)-C};function D(y,S){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=F},"./src/task-loop.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"CMCDVersion",function(){return G}),L.d(V,"CMCDObjectType",function(){return I}),L.d(V,"CMCDStreamingFormat",function(){return R}),L.d(V,"CMCDStreamType",function(){return B});var G=1,I;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(I||(I={}));var R;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(R||(R={}));var B;(function(F){F.VOD="v",F.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"HlsSkip",function(){return R}),L.d(V,"getSkipValue",function(){return B}),L.d(V,"HlsUrlParameters",function(){return F}),L.d(V,"Level",function(){return M});function G(D,y){for(var S=0;S<y.length;S++){var O=y[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function I(D,y,S){return y&&G(D.prototype,y),S&&G(D,S),D}var R;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(R||(R={}));function B(D,y){var S=D.canSkipUntil,O=D.canSkipDateRanges,C=D.endSN,w=y!==void 0?y-C:0;return S&&w<S?O?R.v2:R.Yes:R.No}var F=function(){function D(S,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=O,this.skip=C}var y=D.prototype;return y.addDirectives=function(O){var C=new self.URL(O);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},D}(),M=function(){function D(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return I(D,[{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(S){var O=S%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),D}()},"./src/types/loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"PlaylistContextType",function(){return G}),L.d(V,"PlaylistLevelType",function(){return I});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"ChunkMetadata",function(){return G});var G=function(B,F,M,D,y,S){D===void 0&&(D=0),y===void 0&&(y=-1),S===void 0&&(S=!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=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=F,this.id=M,this.size=D,this.part=y,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(M){typeof M=="string"&&(M=B.parseAttrList(M));for(var D in M)M.hasOwnProperty(D)&&(this[D]=M[D])}var F=B.prototype;return F.decimalInteger=function(D){var y=parseInt(this[D],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},F.hexadecimalInteger=function(D){if(this[D]){var y=(this[D]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var S=new Uint8Array(y.length/2),O=0;O<y.length/2;O++)S[O]=parseInt(y.slice(O*2,O*2+2),16);return S}else return null},F.hexadecimalIntegerAsNumber=function(D){var y=parseInt(this[D],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},F.decimalFloatingPoint=function(D){return parseFloat(this[D])},F.optionalFloat=function(D,y){var S=this[D];return S?parseFloat(S):y},F.enumeratedString=function(D){return this[D]},F.bool=function(D){return this[D]==="YES"},F.decimalResolution=function(D){var y=G.exec(this[D]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},B.parseAttrList=function(D){var y,S={},O='"';for(I.lastIndex=0;(y=I.exec(D))!==null;){var C=y[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),S[y[1]]=C}return S},B}()},"./src/utils/binary-search.ts":function(re,V,L){"use strict";L.r(V);var G={search:function(R,B){for(var F=0,M=R.length-1,D=null,y=null;F<=M;){D=(F+M)/2|0,y=R[D];var S=B(y);if(S>0)F=D+1;else if(S<0)M=D-1;else return y}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"BufferHelper",function(){return R});var G=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(M,D){try{if(M){for(var y=B.getBuffered(M),S=0;S<y.length;S++)if(D>=y.start(S)&&D<=y.end(S))return!0}}catch(O){}return!1},B.bufferInfo=function(M,D,y){try{if(M){var S=B.getBuffered(M),O=[],C;for(C=0;C<S.length;C++)O.push({start:S.start(C),end:S.end(C)});return this.bufferedInfo(O,D,y)}}catch(w){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(M,D,y){D=Math.max(0,D),M.sort(function(f,A){var b=f.start-A.start;return b||A.end-f.end});var S=[];if(y)for(var O=0;O<M.length;O++){var C=S.length;if(C){var w=S[C-1].end;M[O].start-w<y?M[O].end>w&&(S[C-1].end=M[O].end):S.push(M[O])}else S.push(M[O])}else S=M;for(var v=0,d,o=D,u=D,s=0;s<S.length;s++){var x=S[s].start,p=S[s].end;if(D+y>=x&&D<p)o=x,u=p,v=u-D;else if(D+y<x){d=x;break}}return{len:v,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(M){try{return M.buffered}catch(D){return G.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"Row",function(){return u}),L.d(V,"CaptionScreen",function(){return s});var G=L("./src/utils/logger.ts"),I={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},R=function(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},B=15,F=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var w=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,g){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+g)},h}(),v=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,g,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=g||!1,this.background=m||"black",this.flash=E||!1}var c=h.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 g=["foreground","underline","italics","background","flash"],m=0;m<g.length;m++){var E=g[m];a.hasOwnProperty(E)&&(this[E]=a[E])}},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},h}(),o=function(){function h(l,a,g,m,E,P){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,g,m,E,P)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},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()},h}(),u=function(){function h(l){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<F;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var g=!0,m=0;m<F;m++)if(!this.chars[m].equals(a.chars[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<F;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<F;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},c.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var m=this.pos+1;m<g+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=R(a);if(this.pos>=F){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<F;g++)this.chars[g].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=[],g=!0,m=0;m<F;m++){var E=this.chars[m].uchar;E!==" "&&(g=!1),a.push(E)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),s=function(){function h(l){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 u(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.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 g=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].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 g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var m=0;m<B;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var U=P.rows[E].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(P.rows[E+W])}}this.currRow=g;var _=this.rows[this.currRow];if(a.indent!==null){var k=a.indent,K=Math.max(k-1,0);_.setCursor(a.indent),a.color=_.chars[K].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(C.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(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],m="",E=-1,P=0;P<B;P++){var U=this.rows[P].getTextString();U&&(E=P+1,a?g.push("Row "+E+": '"+U+"'"):g.push(U.trim()))}return g.length>0&&(a?m="["+g.join(" | ")+"]":m=g.join(`
|
|
`)),m},c.getTextAndFormat=function(){return this.rows},h}(),x=function(){function h(l,a,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(g),this.nonDisplayedMemory=new s(g),this.lastOutputScreen=new s(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.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(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.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(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=E[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),p=function(){function h(l,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new w;this.channels=[null,new x(l,a,m),new x(l+1,g,m)],this.cmdHistory=b(),this.logger=m}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var m,E,P,U=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(E=g[j]&127,P=g[j+1]&127,E===0&&P===0)continue;if(this.logger.log(C.DATA,"["+v([g[j],g[j+1]])+"] -> ("+v([E,P])+")"),m=this.parseCmd(E,P),m||(m=this.parseMidrow(E,P)),m||(m=this.parsePAC(E,P)),m||(m=this.parseBackgroundAttributes(E,P)),!m&&(U=this.parseChars(E,P),U)){var W=this.currentChannel;if(W&&W>0){var _=this.channels[W];_.insertChars(U)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!U&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+v([E,P])+" orig: "+v([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,P=(a===23||a===31)&&g>=33&&g<=35;if(!(E||P))return!1;if(A(a,g,m))return f(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+v([a,g])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,j=this.channels[U];return a===20||a===21||a===28||a===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),f(a,g,m),this.currentChannel=U,!0},c.parseMidrow=function(a,g){var m=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+v([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var m,E=this.cmdHistory,P=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,U=(a===16||a===24)&&g>=64&&g<=95;if(!(P||U))return!1;if(A(a,g,E))return f(null,null,E),!0;var j=a<=23?1:2;g>=64&&g<=95?m=j===1?M[a]:y[a]:m=j===1?D[a]:S[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,g)),f(a,g,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?m=g-96:m=g-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},c.parseChars=function(a,g){var m,E=null,P=null;if(a>=25?(m=2,P=a-8):(m=1,P=a),P>=17&&P<=19){var U;P===17?U=g+80:P===18?U=g+112:U=g+144,this.logger.log(C.INFO,"Special char '"+R(U)+"' in channel "+m),E=[U]}else a>=32&&a<=127&&(E=g===0?[a]:[a,g]);if(E){var j=v(E);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),f(a,g,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,g){var m=(a===16||a===24)&&g>=32&&g<=47,E=(a===23||a===31)&&g>=45&&g<=47;if(!(m||E))return!1;var P,U={};a===16||a===24?(P=Math.floor((g-32)/2),U.background=O[P],g%2===1&&(U.background=U.background+"_semi")):g===45?U.background="transparent":(U.foreground="black",g===47&&(U.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(U),f(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var m=this.channels[g];m&&m.cueSplitAtTime(a)}},h}();function f(h,c,l){l.a=h,l.b=c}function A(h,c,l){return l.a===h&&l.b===c}function b(){return{a:null,b:null}}V.default=p},"./src/utils/codecs.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"isCodecType",function(){return I}),L.d(V,"isCodecSupportedInMp4",function(){return R});var G={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 I(B,F){var M=G[F];return!!M&&M[B.slice(0,4)]===!0}function R(B,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),B=/\s/,F={newCue:function(D,y,S,O){for(var C=[],w,v,d,o,u,s=self.VTTCue||self.TextTrackCue,x=0;x<O.rows.length;x++)if(w=O.rows[x],d=!0,o=0,u="",!w.isEmpty()){for(var p=0;p<w.chars.length;p++)B.test(w.chars[p].uchar)&&d?o++:(u+=w.chars[p].uchar,d=!1);w.cueStartTime=y,y===S&&(S+=1e-4),o>=16?o--:o++;var f=Object(G.fixLineBreaks)(u.trim()),A=Object(I.generateCueId)(y,S,f);(!D||!D.cues||!D.cues.getCueById(A))&&(v=new s(y,S,f),v.id=A,v.line=x+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(v))}return D&&C.length&&(C.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),C.forEach(function(b){return Object(R.addCueToTrack)(D,b)})),C}};V.default=F},"./src/utils/discontinuities.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"findFirstFragWithCC",function(){return B}),L.d(V,"shouldAlignOnDiscontinuities",function(){return F}),L.d(V,"findDiscontinuousReferenceFrag",function(){return M}),L.d(V,"adjustSlidingStart",function(){return y}),L.d(V,"alignStream",function(){return S}),L.d(V,"alignPDT",function(){return C}),L.d(V,"alignFragmentByPDTDelta",function(){return w}),L.d(V,"alignMediaPlaylistByPDT",function(){return v});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),R=L("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,x=d.length;s<x;s++){var p=d[s];if(p&&p.cc===o){u=p;break}}return u}function F(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function M(d,o){var u=d.fragments,s=o.fragments;if(!s.length||!u.length){I.logger.log("No fragments to align");return}var x=B(u,s[0].cc);if(!x||x&&!x.startPTS){I.logger.log("No frag in previous level to align on");return}return x}function D(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function y(d,o){for(var u=o.fragments,s=0,x=u.length;s<x;s++)D(u[s],d);o.fragmentHint&&D(o.fragmentHint,d),o.alignedSliding=!0}function S(d,o,u){if(!o)return;O(d,u,o),!u.alignedSliding&&o.details&&C(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(R.adjustSliding)(o.details,u)}function O(d,o,u){if(F(d,u,o)){var s=M(u.details,o);s&&Object(G.isFiniteNumber)(s.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(s.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,x=(s-u)/1e3+o.fragments[0].start;x&&Object(G.isFiniteNumber)(x)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(s-u)+"ms, sliding:"+x.toFixed(3)+" "+d.url+" "),y(x,d))}function w(d,o){var u=d.programDateTime;if(!u)return;var s=(u-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=o.fragments[0].start,x=u-s*1e3;d.fragments.forEach(function(p){w(p,x)}),d.fragmentHint&&w(d.fragmentHint,x),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/utils/ewma.ts"),I=function(){function R(F,M,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new G.default(F),this.fast_=new G.default(M)}var B=R.prototype;return B.update=function(M,D){var y=this.slow_,S=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new G.default(M,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new G.default(D,S.getEstimate(),S.getTotalWeight()))},B.sample=function(M,D){M=Math.max(M,this.minDelayMs_);var y=8*D,S=M/1e3,O=y/S;this.fast_.sample(S,O),this.slow_.sample(S,O)},B.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=I},"./src/utils/ewma.ts":function(re,V,L){"use strict";L.r(V);var G=function(){function I(B,F,M){F===void 0&&(F=0),M===void 0&&(M=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_=F,this.totalWeight_=M}var R=I.prototype;return R.sample=function(F,M){var D=Math.pow(this.alpha_,F);this.estimate_=M*(1-D)+D*this.estimate_,this.totalWeight_+=F},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},I}();V.default=G},"./src/utils/fetch-loader.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"fetchSupported",function(){return w});var G=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),R=L("./src/demux/chunk-cache.ts");function B(s,x){s.prototype=Object.create(x.prototype),s.prototype.constructor=s,S(s,x)}function F(s){var x=typeof Map=="function"?new Map:void 0;return F=function(f){if(f===null||!y(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(f))return x.get(f);x.set(f,A)}function A(){return M(f,arguments,O(this).constructor)}return A.prototype=Object.create(f.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),S(A,f)},F(s)}function M(s,x,p){return D()?M=Reflect.construct:M=function(A,b,h){var c=[null];c.push.apply(c,b);var l=Function.bind.apply(A,c),a=new l;return h&&S(a,h.prototype),a},M.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function y(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function S(s,x){return S=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},S(s,x)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(s)}function C(){return C=Object.assign||function(s){for(var x=1;x<arguments.length;x++){var p=arguments[x];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},C.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var x=s.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(f,A,b){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(f,this.controller.signal),a=b.onProgress,g=f.responseType==="arraybuffer",m=g?"byteLength":"length";this.context=f,this.config=A,this.callbacks=b,this.request=this.fetchSetup(f,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(c,f,h.response)},A.timeout),self.fetch(this.request).then(function(E){if(h.response=h.loader=E,!E.ok){var P=E.status,U=E.statusText;throw new u(U||"fetch, bad network response",P,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(A.highWaterMark)?h.loadProgressively(E,c,f,A.highWaterMark,a):g?E.arrayBuffer():E.text()}).then(function(E){var P=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[m];var U={url:P.url,data:E};a&&!Object(G.isFiniteNumber)(A.highWaterMark)&&a(c,f,E,P),b.onSuccess(U,c,f,P)}).catch(function(E){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var P=E.code||0;b.onError({code:P,text:E.message},f,E.details)})},x.getCacheAge=function(){var f=null;if(this.response){var A=this.response.headers.get("age");f=A?parseFloat(A):null}return f},x.loadProgressively=function(f,A,b,h,c){h===void 0&&(h=0);var l=new R.default,a=f.body.getReader(),g=function m(){return a.read().then(function(E){if(E.done)return l.dataLength&&c(A,b,l.flush(),f),Promise.resolve(new ArrayBuffer(0));var P=E.value,U=P.length;return A.loaded+=U,U<h||l.dataLength?(l.push(P),l.dataLength>=h&&c(A,b,l.flush(),f)):c(A,b,P,f),m()}).catch(function(){return Promise.reject()})};return g()},s}();function d(s,x){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&p.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),p}function o(s,x){return new self.Request(s.url,x)}var u=function(s){B(x,s);function x(p,f,A){var b;return b=s.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=A,b}return x}(F(Error));V.default=v},"./src/utils/imsc1-ttml-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"IMSC1_CODEC",function(){return y}),L.d(V,"parseIMSC1",function(){return w});var G=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),M=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},D.apply(this,arguments)}var y="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(h,c,l,a,g){var m=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(m.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],P=Object(B.utf8ArrayToStr)(new Uint8Array(h,E.start,E.end-E.start)),U=Object(F.toTimescaleFromScale)(c,1,l);try{a(v(P,U))}catch(j){g(j)}}function v(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(_,k){return _[k]=g.getAttribute("ttp:"+k)||m[k],_},{}),P=g.getAttribute("xml:space")!=="preserve",U=o(d(g,"styling","style")),j=o(d(g,"layout","region")),W=d(g,"body","[begin]");return[].map.call(W,function(_){var k=u(_,P);if(!k||!_.hasAttribute("begin"))return null;var K=f(_.getAttribute("begin"),E),Y=f(_.getAttribute("dur"),E),q=f(_.getAttribute("end"),E);if(K===null)throw p(_);if(q===null){if(Y===null)throw p(_);q=K+Y}var ae=new R.default(K-c,q-c,k);ae.id=Object(M.generateCueId)(ae.startTime,ae.endTime,ae.text);var Ee=j[_.getAttribute("region")],ve=U[_.getAttribute("style")];ae.position=10,ae.size=80;var ge=s(Ee,ve),fe=ge.textAlign;if(fe){var me=C[fe];me&&(ae.lineAlign=me),ae.align=fe}return D(ae,ge),ae}).filter(function(_){return _!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,g){var m;return a.nodeName==="br"&&g?l+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function s(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,m){var E=x(c,l,m)||x(h,l,m);return E&&(g[m]=E),g},{})}function x(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function p(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,c){if(!h)return null;var l=Object(I.parseTimeStamp)(h);return l===null&&(S.test(h)?l=A(h,c):O.test(h)&&(l=b(h,c))),l}function A(h,c){var l=S.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function b(h,c){var l=O.exec(h),a=Number(l[1]),g=l[2];switch(g){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(re,V,L){"use strict";L.r(V),L.d(V,"enableLogs",function(){return M}),L.d(V,"logger",function(){return D});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=I;function B(y){var S=self.console[y];return S?S.bind(self.console,"["+y+"] >"):G}function F(y){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];O.forEach(function(w){R[w]=y[w]?y[w].bind(y):B(w)})}function M(y){if(self.console&&y===!0||typeof y=="object"){F(y,"debug","log","info","warn","error");try{R.log()}catch(S){R=I}}else R=I}var D=R},"./src/utils/mediakeys-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"KeySystems",function(){return G}),L.d(V,"requestMediaKeySystemAccess",function(){return I});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"bin2str",function(){return F}),L.d(V,"readUint16",function(){return M}),L.d(V,"readUint32",function(){return D}),L.d(V,"writeUint32",function(){return y}),L.d(V,"findBox",function(){return S}),L.d(V,"parseSegmentIndex",function(){return O}),L.d(V,"parseInitSegment",function(){return C}),L.d(V,"getStartDTS",function(){return w}),L.d(V,"getDuration",function(){return v}),L.d(V,"computeRawDurationFromSamples",function(){return d}),L.d(V,"offsetStartDTS",function(){return o}),L.d(V,"segmentValidRange",function(){return u}),L.d(V,"appendUint8Array",function(){return s});var G=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function F(x){return String.fromCharCode.apply(null,x)}function M(x,p){"data"in x&&(p+=x.start,x=x.data);var f=x[p]<<8|x[p+1];return f<0?65536+f:f}function D(x,p){"data"in x&&(p+=x.start,x=x.data);var f=x[p]<<24|x[p+1]<<16|x[p+2]<<8|x[p+3];return f<0?4294967296+f:f}function y(x,p,f){"data"in x&&(p+=x.start,x=x.data),x[p]=f>>24,x[p+1]=f>>16&255,x[p+2]=f>>8&255,x[p+3]=f&255}function S(x,p){var f=[];if(!p.length)return f;var A,b,h;"data"in x?(A=x.data,b=x.start,h=x.end):(A=x,b=0,h=A.byteLength);for(var c=b;c<h;){var l=D(A,c),a=F(A.subarray(c+4,c+8)),g=l>1?c+l:h;if(a===p[0])if(p.length===1)f.push({data:A,start:c+8,end:g});else{var m=S({data:A,start:c+8,end:g},p.slice(1));m.length&&B.apply(f,m)}c=g}return f}function O(x){var p=S(x,["moov"]),f=p[0],A=f?f.end:null,b=S(x,["sidx"]);if(!b||!b[0])return null;var h=[],c=b[0],l=c.data[0],a=l===0?8:16,g=D(c,a);a+=4;var m=0,E=0;l===0?a+=8:a+=16,a+=2;var P=c.end+E,U=M(c,a);a+=2;for(var j=0;j<U;j++){var W=a,_=D(c,W);W+=4;var k=_&2147483647,K=(_&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=D(c,W);W+=4,h.push({referenceSize:k,subsegmentDuration:Y,info:{duration:Y/g,start:P,end:P+k-1}}),P+=k,W+=4,a=W}return{earliestPresentationTime:m,timescale:g,version:l,referencesCount:U,references:h,moovEndOffset:A}}function C(x){for(var p=[],f=S(x,["moov","trak"]),A=0;A<f.length;A++){var b=f[A],h=S(b,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=D(h,l),g=S(b,["mdia","mdhd"])[0];if(g){c=g.data[g.start],l=c===0?12:20;var m=D(g,l),E=S(b,["mdia","hdlr"])[0];if(E){var P=F(E.data.subarray(E.start+8,E.start+12)),U={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[P];if(U){var j=S(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=F(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:U},p[U]={timescale:m,id:a,codec:W}}}}}}var _=S(x,["moov","mvex","trex"]);return _.forEach(function(k){var K=D(k,4),Y=p[K];Y&&(Y.default={duration:D(k,12),flags:D(k,20)})}),p}function w(x,p){return S(p,["moof","traf"]).reduce(function(f,A){var b=S(A,["tfdt"])[0],h=b.data[b.start],c=S(A,["tfhd"]).reduce(function(l,a){var g=D(a,4),m=x[g];if(m){var E=D(b,4);h===1&&(E*=Math.pow(2,32),E+=D(b,8));var P=m.timescale||9e4,U=E/P;if(isFinite(U)&&(l===null||U<l))return U}return l},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(x,p){for(var f=0,A=0,b=0,h=S(x,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=S(l,["tfhd"])[0],g=D(a,4),m=p[g];if(!m)continue;var E=m.default,P=D(a,0)|(E==null?void 0:E.flags),U=E==null?void 0:E.duration;P&8&&(P&2?U=D(a,12):U=D(a,8));for(var j=m.timescale||9e4,W=S(l,["trun"]),_=0;_<W.length;_++){if(U){var k=D(W[_],4);f=U*k}else f=d(W[_]);m.type===I.ElementaryStreamTypes.VIDEO?A+=f/j:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=f/j)}}if(A===0&&b===0){var K=O(x);if(K!=null&&K.references)return K.references.reduce(function(Y,q){return Y+q.info.duration||0},0)}return A||b}function d(x){var p=D(x,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var A=0,b=D(x,4),h=0;h<b;h++){if(p&256){var c=D(x,f);A+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return A}function o(x,p,f){S(p,["moof","traf"]).forEach(function(A){S(A,["tfhd"]).forEach(function(b){var h=D(b,4),c=x[h];if(!c)return;var l=c.timescale||9e4;S(A,["tfdt"]).forEach(function(a){var g=a.data[a.start],m=D(a,4);if(g===0)y(a,4,m-f*l);else{m*=Math.pow(2,32),m+=D(a,8),m-=f*l,m=Math.max(m,0);var E=Math.floor(m/(R+1)),P=Math.floor(m%(R+1));y(a,4,E),y(a,8,P)}})})})}function u(x){var p={valid:null,remainder:null},f=S(x,["moof"]);if(f){if(f.length<2)return p.remainder=x,p}else return p;var A=f[f.length-1];return p.valid=Object(G.sliceUint8)(x,0,A.start-8),p.remainder=Object(G.sliceUint8)(x,A.start-8),p}function s(x,p){var f=new Uint8Array(x.length+p.length);return f.set(x),f.set(p,x.length),f}},"./src/utils/output-filter.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=F}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(F,M,D){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=M,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"sendAddTrackEvent",function(){return I}),L.d(V,"addCueToTrack",function(){return R}),L.d(V,"clearCurrentCues",function(){return B}),L.d(V,"removeCuesInRange",function(){return F}),L.d(V,"getCuesInRange",function(){return D});var G=L("./src/utils/logger.ts");function I(y,S){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,S.dispatchEvent(O)}function R(y,S){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(S.id))try{if(y.addCue(S),!y.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(w){G.logger.debug("[texttrack-utils]: "+w);var C=new self.TextTrackCue(S.startTime,S.endTime,S.text);C.id=S.id,y.addCue(C)}O==="disabled"&&(y.mode=O)}function B(y){var S=y.mode;if(S==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);S==="disabled"&&(y.mode=S)}function F(y,S,O){var C=y.mode;if(C==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var w=D(y.cues,S,O),v=0;v<w.length;v++)y.removeCue(w[v]);C==="disabled"&&(y.mode=C)}function M(y,S){if(S<y[0].startTime)return 0;var O=y.length-1;if(S>y[O].endTime)return-1;for(var C=0,w=O;C<=w;){var v=Math.floor((w+C)/2);if(S<y[v].startTime)w=v-1;else if(S>y[v].startTime&&C<O)C=v+1;else return v}return y[C].startTime-S<S-y[w].startTime?C:w}function D(y,S,O){var C=[],w=M(y,S);if(w>-1)for(var v=w,d=y.length;v<d;v++){var o=y[v];if(o.startTime>=S&&o.endTime<=O)C.push(o);else if(o.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(re,V,L){"use strict";L.r(V);var G={toString:function(R){for(var B="",F=R.length,M=0;M<F;M++)B+="["+R.start(M).toFixed(3)+","+R.end(M).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"toTimescaleFromBase",function(){return I}),L.d(V,"toTimescaleFromScale",function(){return R}),L.d(V,"toMsFromMpegTsClock",function(){return B}),L.d(V,"toMpegTsClockFromTimescale",function(){return F});var G=9e4;function I(M,D,y,S){y===void 0&&(y=1),S===void 0&&(S=!1);var O=M*D*y;return S?Math.round(O):O}function R(M,D,y,S){return y===void 0&&(y=1),S===void 0&&(S=!1),I(M,D,1/y,S)}function B(M,D){return D===void 0&&(D=!1),I(M,1e3,1/G,D)}function F(M,D){return D===void 0&&(D=1),I(M,G,1/D)}},"./src/utils/typed-array.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"sliceUint8",function(){return G});function G(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(re,V,L){"use strict";L.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function R(y,S){if(typeof S!="string")return!1;if(!Array.isArray(y))return!1;var O=S.toLowerCase();return~y.indexOf(O)?O:!1}function B(y){return R(G,y)}function F(y){return R(I,y)}function M(y){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];for(var w=1;w<arguments.length;w++){var v=arguments[w];for(var d in v)y[d]=v[d]}return y}function D(y,S,O){var C=this,w={enumerable:!0};C.hasBeenReset=!1;var v="",d=!1,o=y,u=S,s=O,x=null,p="",f=!0,A="auto",b="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",M({},w,{get:function(){return v},set:function(m){v=""+m}})),Object.defineProperty(C,"pauseOnExit",M({},w,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(C,"startTime",M({},w,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",M({},w,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",M({},w,{get:function(){return s},set:function(m){s=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",M({},w,{get:function(){return x},set:function(m){x=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",M({},w,{get:function(){return p},set:function(m){var E=B(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",M({},w,{get:function(){return f},set:function(m){f=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",M({},w,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",M({},w,{get:function(){return b},set:function(m){var E=F(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",M({},w,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",M({},w,{get:function(){return c},set:function(m){var E=F(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",M({},w,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",M({},w,{get:function(){return a},set:function(m){var E=F(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"parseTimeStamp",function(){return R}),L.d(V,"fixLineBreaks",function(){return S}),L.d(V,"VTTParser",function(){return O});var G=L("./src/utils/vttcue.ts"),I=function(){function C(){}var w=C.prototype;return w.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function w(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var v=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?w(v[2],v[3],0,v[4]):w(v[1],v[2],v[3],v[4]):null}var B=function(){function C(){this.values=Object.create(null)}var w=C.prototype;return w.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},w.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},w.has=function(d){return d in this.values},w.alt=function(d,o,u){for(var s=0;s<u.length;++s)if(o===u[s]){this.set(d,o);break}},w.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},w.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},C}();function F(C,w,v,d){var o=d?C.split(d):[C];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(v);if(s.length!==2)continue;var x=s[0],p=s[1];w(x,p)}}var M=new G.default(0,0,""),D=M.align==="middle"?"middle":"center";function y(C,w,v){var d=C;function o(){var x=R(C);if(x===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),x}function u(x,p){var f=new B;F(x,function(h,c){var l;switch(h){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(h,v[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(h,l[0]),f.percent(h,l[0])&&f.set("snapToLines",!1),f.alt(h,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",D,"end"]);break;case"position":l=c.split(","),f.percent(h,l[0]),l.length===2&&f.alt("positionAlign",l[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,c);break;case"align":f.alt(h,c,["start",D,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var A=f.get("line","auto");A==="auto"&&M.line===-1&&(A=-1),p.line=A,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",D);var b=f.get("position","auto");b==="auto"&&M.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function s(){C=C.replace(/^\s+/,"")}if(s(),w.startTime=o(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),s(),w.endTime=o(),s(),u(C,w)}function S(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=C.prototype;return w.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var b=o.buffer,h=0;for(b=S(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
|
|
`;)++h;var c=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
|
|
`&&++h,o.buffer=b.substr(h),c}function s(b){F(b,function(h,c){},/:/)}try{var x="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;x=u();var p=x.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[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:x=u();switch(o.state){case"HEADER":/:/.test(x)?s(x):x||(o.state="ID");continue;case"NOTE":x||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){o.state="NOTE";break}if(!x)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",x.indexOf("-->")===-1){o.cue.id=x;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(x,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=x.indexOf("-->")!==-1;if(!x||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+=x}continue;case"BADCUE":x||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(re,V,L){"use strict";L.r(V),L.d(V,"generateCueId",function(){return O}),L.d(V,"parseWebVTT",function(){return w});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),F=L("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,D=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),x=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,o+=60*60*1e3*x,o},S=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function O(v,d,o){return S(v.toString())+S(d.toString())+S(o)}var C=function(d,o,u){var s=d[o],x=d[s.prevCC];if(!x||!x.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(p=x)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=s.start-x.start,s.new=!1,s=x,x=d[s.prevCC]}d.presentationOffset=u};function w(v,d,o,u,s,x,p,f){var A=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(M,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,g=0,m,E=!0,P=!1;A.oncue=function(U){var j=u[s],W=u.ccOffset,_=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=u.ccOffset=j.start:C(u,s,_)),_&&(W=_-u.presentationOffset),P){var k=U.endTime-U.startTime,K=Object(F.normalizePts)((U.startTime+W-g)*9e4,x*9e4)/9e4;U.startTime=K,U.endTime=K+k}var Y=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(Y)),U.id||(U.id=O(U.startTime,U.endTime,Y)),U.endTime>0&&h.push(U)},A.onparsingerror=function(U){m=U},A.onflush=function(){if(m){f(m);return}p(h)},b.forEach(function(U){if(E)if(D(U,"X-TIMESTAMP-MAP=")){E=!1,P=!0,U.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?l=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=y(l)/1e3}catch(j){P=!1,m=j}return}else U===""&&(E=!1);A.parse(U+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(re,V,L){"use strict";L.r(V);var G=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function F(D){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=D?D.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var M=F.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},M.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(y,S,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=S,this.callbacks=O,this.retryDelay=S.retryDelay,this.loadInternal()},M.loadInternal=function(){var y=this.config,S=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var w=this.xhrSetup;try{if(w)try{w(O,S.url)}catch(o){O.open("GET",S.url,!0),w(O,S.url)}O.readyState||O.open("GET",S.url,!0);var v=this.context.headers;if(v)for(var d in v)O.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},S,O);return}S.rangeEnd&&O.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},M.readystatechange=function(){var y=this.context,S=this.loader,O=this.stats;if(!y||!S)return;var C=S.readyState,w=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){S.onreadystatechange=null,S.onprogress=null;var v=S.status;if(v>=200&&v<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=S.response,o=d.byteLength):(d=S.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,y,d,S),!this.callbacks)return;var s={url:S.responseURL,data:d};this.callbacks.onSuccess(s,O,y,S)}else O.retry>=w.maxRetry||v>=400&&v<499?(G.logger.error(v+" while loading "+y.url),this.callbacks.onError({code:v,text:S.statusText},y,S)):(G.logger.warn(v+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},M.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(y){var S=this.stats;S.loaded=y.loaded,y.lengthComputable&&(S.total=y.total)},M.getCacheAge=function(){var y=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");y=S?parseFloat(S):null}return y},F}();V.default=B}}).default})},vHTk:function(ut,qe,te){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|