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.
138 lines
754 KiB
138 lines
754 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[169,6,7,16],{"+NIl":function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(H,L){"use strict";function z(w,b){w.cmdState.push(b)}function F(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var b=w.cmdState.pop();b&&b.closeBracket()}function B(w){for(var b=w.cmdState,x=b.length-1;x>=0;x--){var l=b[x];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function N(w,b,x){return function(){this.name=w,this.bracketNo=0,this.style=b,this.styles=x,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=N("importmodule","tag",["string","builtin"]),P.documentclass=N("documentclass","tag",["","atom"]),P.usepackage=N("usepackage","tag",["atom"]),P.begin=N("begin","tag",["atom"]),P.end=N("end","tag",["atom"]),P.label=N("label","tag",["atom"]),P.ref=N("ref","tag",["atom"]),P.eqref=N("eqref","tag",["atom"]),P.cite=N("cite","tag",["atom"]),P.bibitem=N("bibitem","tag",["atom"]),P.Bibitem=N("Bibitem","tag",["atom"]),P.RBibitem=N("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function C(w,b){w.f=b}function c(w,b){var x;if(w.match(/^\\[a-zA-Z@]+/)){var l=w.current().slice(1);return x=P.hasOwnProperty(l)?P[l]:P.DEFAULT,x=new x,z(b,x),C(b,R),x.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return C(b,function(s,u){return p(s,u,"\\]")}),"keyword";if(w.match("\\("))return C(b,function(s,u){return p(s,u,"\\)")}),"keyword";if(w.match("$$"))return C(b,function(s,u){return p(s,u,"$$")}),"keyword";if(w.match("$"))return C(b,function(s,u){return p(s,u,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(x=F(b),x)x.closeBracket(a),C(b,R);else return"error";return"bracket"}else return a=="{"||a=="["?(x=P.DEFAULT,x=new x,z(b,x),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),x=B(b),x.name=="begin"&&(x.argument=w.current()),x.styleIdentifier())}function p(w,b,x){if(w.eatSpace())return null;if(x&&w.match(x))return C(b,c),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=w.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(w.skipToEnd(),"comment"):"error"}function R(w,b){var x=w.peek(),l;return x=="{"||x=="["?(l=F(b),l.openBracket(x),w.eat(x),C(b,c),"bracket"):/[ \t\r]/.test(x)?(w.eat(x),null):(C(b,c),O(b),c(w,b))}return{startState:function(){var w=L.inMathMode?function(b,x){return p(b,x)}:c;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,b){return b.f(w,b)},blankLine:function(w){w.f=c,w.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"19Vz":function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){J.defineOption("placeholder","",function(N,P,C){var c=C&&C!=J.Init;if(P&&!c)N.on("blur",F),N.on("change",O),N.on("swapDoc",O),J.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){z(N)}),O(N);else if(!P&&c){N.off("blur",F),N.off("change",O),N.off("swapDoc",O),J.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),H(N);var p=N.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}P&&!N.hasFocus()&&F(N)});function H(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function L(N){H(N);var P=N.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=N.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var C=N.getOption("placeholder");typeof C=="string"&&(C=document.createTextNode(C)),P.appendChild(C),N.display.lineSpace.insertBefore(P,N.display.lineSpace.firstChild)}function z(N){setTimeout(function(){var P=!1,C=N.getInputField();C.nodeName=="TEXTAREA"?P=!C.value:N.lineCount()==1&&(P=!/[^\u200b]/.test(C.querySelector(".CodeMirror-line").textContent)),P?L(N):H(N)},20)}function F(N){B(N)&&L(N)}function O(N){var P=N.getWrapperElement(),C=B(N);P.className=P.className.replace(" CodeMirror-empty","")+(C?" CodeMirror-empty":""),C?L(N):H(N)}function B(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){"use strict";var H={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};J.defineMode("xml",function(z,F){var O=z.indentUnit,B={},N=F.htmlMode?H:L;for(var P in N)B[P]=N[P];for(var P in F)B[P]=F[P];var C,c;function p(o,E){function y(I){return E.tokenize=I,I(o,E)}var m=o.next();if(m=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?y(b("atom","]]>")):null:o.match("--")?y(b("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),y(x(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),E.tokenize=b("meta","?>"),"meta"):(C=o.eat("/")?"closeTag":"openTag",E.tokenize=R,"tag bracket");if(m=="&"){var k;return o.eat("#")?o.eat("x")?k=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):k=o.eatWhile(/[\d]/)&&o.eat(";"):k=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),k?"atom":"error"}else return o.eatWhile(/[^&<]/),null}p.isInText=!0;function R(o,E){var y=o.next();if(y==">"||y=="/"&&o.eat(">"))return E.tokenize=p,C=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return C="equals",null;if(y=="<"){E.tokenize=p,E.state=u,E.tagName=E.tagStart=null;var m=E.tokenize(o,E);return m?m+" tag error":"tag error"}else return/[\'\"]/.test(y)?(E.tokenize=w(y),E.stringStartCol=o.column(),E.tokenize(o,E)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var E=function(y,m){for(;!y.eol();)if(y.next()==o){m.tokenize=R;break}return"string"};return E.isInAttribute=!0,E}function b(o,E){return function(y,m){for(;!y.eol();){if(y.match(E)){m.tokenize=p;break}y.next()}return o}}function x(o){return function(E,y){for(var m;(m=E.next())!=null;){if(m=="<")return y.tokenize=x(o+1),y.tokenize(E,y);if(m==">")if(o==1){y.tokenize=p;break}else return y.tokenize=x(o-1),y.tokenize(E,y)}return"meta"}}function l(o,E,y){this.prev=o.context,this.tagName=E,this.indent=o.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(E)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,E){for(var y;;){if(!o.context)return;if(y=o.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(E))return;a(o)}}function u(o,E,y){return o=="openTag"?(y.tagStart=E.column(),A):o=="closeTag"?v:u}function A(o,E,y){return o=="word"?(y.tagName=E.current(),c="tag",T):B.allowMissingTagName&&o=="endTag"?(c="tag bracket",T(o,E,y)):(c="error",A)}function v(o,E,y){if(o=="word"){var m=E.current();return y.context&&y.context.tagName!=m&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==m||B.matchClosing===!1?(c="tag",g):(c="tag error",D)}else return B.allowMissingTagName&&o=="endTag"?(c="tag bracket",g(o,E,y)):(c="error",D)}function g(o,E,y){return o!="endTag"?(c="error",g):(a(y),u)}function D(o,E,y){return c="error",g(o,E,y)}function T(o,E,y){if(o=="word")return c="attribute",f;if(o=="endTag"||o=="selfcloseTag"){var m=y.tagName,k=y.tagStart;return y.tagName=y.tagStart=null,o=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(m)?s(y,m):(s(y,m),y.context=new l(y,m,k==y.indented)),u}return c="error",T}function f(o,E,y){return o=="equals"?h:(B.allowMissing||(c="error"),T(o,E,y))}function h(o,E,y){return o=="string"?d:o=="word"&&B.allowUnquoted?(c="string",T):(c="error",T(o,E,y))}function d(o,E,y){return o=="string"?d:T(o,E,y)}return{startState:function(o){var E={tokenize:p,state:u,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(E.baseIndent=o),E},token:function(o,E){if(!E.tagName&&o.sol()&&(E.indented=o.indentation()),o.eatSpace())return null;C=null;var y=E.tokenize(o,E);return(y||C)&&y!="comment"&&(c=null,E.state=E.state(C||y,o,E),c&&(y=c=="error"?y+" error":c)),y},indent:function(o,E,y){var m=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+O;if(m&&m.noIndent)return J.Pass;if(o.tokenize!=R&&o.tokenize!=p)return y?y.match(/^(\s*)/)[0].length:0;if(o.tagName)return B.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+O*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var k=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(k&&k[1])for(;m;)if(m.tagName==k[2]){m=m.prev;break}else if(B.implicitlyClosed.hasOwnProperty(m.tagName))m=m.prev;else break;else if(k)for(;m;){var I=B.contextGrabbers[m.tagName];if(I&&I.hasOwnProperty(k[2]))m=m.prev;else break}for(;m&&m.prev&&!m.startOfLine;)m=m.prev;return m?m.indent+O:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(o){o.state==h&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var E=[],y=o.context;y;y=y.prev)y.tagName&&E.push(y.tagName);return E.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(nt,ze,re){"use strict";var J=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),H=new Uint8Array(16);function L(){if(!J)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return J(H)}var z=/^(?:[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 F(R){return typeof R=="string"&&z.test(R)}for(var O=F,B=[],N=0;N<256;++N)B.push((N+256).toString(16).substr(1));function P(R){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=(B[R[w+0]]+B[R[w+1]]+B[R[w+2]]+B[R[w+3]]+"-"+B[R[w+4]]+B[R[w+5]]+"-"+B[R[w+6]]+B[R[w+7]]+"-"+B[R[w+8]]+B[R[w+9]]+"-"+B[R[w+10]]+B[R[w+11]]+B[R[w+12]]+B[R[w+13]]+B[R[w+14]]+B[R[w+15]]).toLowerCase();if(!O(b))throw TypeError("Stringified UUID is invalid");return b}var C=P;function c(R,w,b){R=R||{};var x=R.random||(R.rng||L)();if(x[6]=x[6]&15|64,x[8]=x[8]&63|128,w){b=b||0;for(var l=0;l<16;++l)w[b+l]=x[l];return w}return C(x)}var p=ze.a=c},"7ahc":function(nt,ze,re){"use strict";re.d(ze,"a",function(){return A});var J=re("k1fw"),H=re("0Owb"),L=re("+L6B"),z=re("2/Rp"),F=re("y8nQ"),O=re("Vl3Y"),B=re("tJVT"),N=re("OaEy"),P=re("2fM7"),C=re("cDcd"),c=re.n(C),p=re("VrN/"),R=re.n(p),w=re("p77/"),b=re.n(w),x=re("c5Ni"),l=re.n(x),a=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};ze.b=function(v){var g=v.callback,D=v.onCancel,T=Object(C.useState)("python"),f=Object(B.a)(T,2),h=f[0],d=f[1];function o(y){d(u[y][1])}function E(y){g(y)}return c.a.createElement(O.a,Object(H.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),c.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(P.a,{onChange:o},Object.keys(u).map(function(y){return c.a.createElement(a,{key:y,value:y},u[y][0])}))),c.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(A,{mode:h})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(z.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function A(v){var g=v.value,D=v.onChange,T=v.mode,f=v.options,h=f===void 0?{}:f,d=Object(C.useRef)(),o=Object(C.useState)(),E=Object(B.a)(o,2),y=E[0],m=E[1];return Object(C.useEffect)(function(){if(y){function k(I){var U=I.getValue();D&&D(U)}return y.on("change",k),function(){y.off("change",k)}}},[y,D]),Object(C.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(C.useEffect)(function(){y&&((g!==y.getValue()||g==="")&&setTimeout(function(){y.setValue(g||" ")},300))},[y,g]),Object(C.useEffect)(function(){if(d.current&&!y){var k=R.a.fromTextArea(d.current,Object(J.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));m(k)}},[d.current,y]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:d}))}},"7ixt":function(nt,ze,re){"use strict";re.d(ze,"a",function(){return L});var J={adjustX:1,adjustY:1},H=[0,0],L={left:{points:["cr","cl"],overflow:J,offset:[-4,0],targetOffset:H},right:{points:["cl","cr"],overflow:J,offset:[4,0],targetOffset:H},top:{points:["bc","tc"],overflow:J,offset:[0,-4],targetOffset:H},bottom:{points:["tc","bc"],overflow:J,offset:[0,4],targetOffset:H},topLeft:{points:["bl","tl"],overflow:J,offset:[0,-4],targetOffset:H},leftTop:{points:["tr","tl"],overflow:J,offset:[-4,0],targetOffset:H},topRight:{points:["br","tr"],overflow:J,offset:[0,-4],targetOffset:H},rightTop:{points:["tl","tr"],overflow:J,offset:[4,0],targetOffset:H},bottomRight:{points:["tr","br"],overflow:J,offset:[0,4],targetOffset:H},rightBottom:{points:["bl","br"],overflow:J,offset:[4,0],targetOffset:H},bottomLeft:{points:["tl","bl"],overflow:J,offset:[0,4],targetOffset:H},leftBottom:{points:["br","bl"],overflow:J,offset:[-4,0],targetOffset:H}},z=L},"8EBN":function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){"use strict";J.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 H=0;H<J.modeInfo.length;H++){var L=J.modeInfo[H];L.mimes&&(L.mime=L.mimes[0])}J.findModeByMIME=function(z){z=z.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.mime==z)return O;if(O.mimes){for(var B=0;B<O.mimes.length;B++)if(O.mimes[B]==z)return O}}if(/\+xml$/.test(z))return J.findModeByMIME("application/xml");if(/\+json$/.test(z))return J.findModeByMIME("application/json")},J.findModeByExtension=function(z){z=z.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.ext){for(var B=0;B<O.ext.length;B++)if(O.ext[B]==z)return O}}},J.findModeByFileName=function(z){for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.file&&O.file.test(z))return O}var B=z.lastIndexOf("."),N=B>-1&&z.substring(B+1,z.length);if(N)return J.findModeByExtension(N)},J.findModeByName=function(z){z=z.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.name.toLowerCase()==z)return O;if(O.alias){for(var B=0;B<O.alias.length;B++)if(O.alias[B].toLowerCase()==z)return O}}}})},"8hTe":function(nt,ze,re){nt.exports={button:"button___1wy9m"}},"9Bee":function(nt,ze,re){"use strict";var J=re("DYRE"),H=re("zeV3"),L=re("+L6B"),z=re("2/Rp"),F=re("k1fw"),O=re("tJVT"),B=re("cDcd"),N=re.n(B),P=re("vg9a"),C=re("DlQD"),c=re.n(C),p=re("rUJ1");function R(he,fe){var ue=he.match(/^(\s+)(?:```)/);if(ue===null)return fe;var ie=ue[1];return fe.split(`
|
|
`).map(function(pe){var $=pe.match(/^\s+/);if($===null)return pe;var ae=Object(O.a)($,1),ee=ae[0];return ee.length>=ie.length?pe.slice(ie.length):pe}).join(`
|
|
`)}var w=[],b=["<ul>"],x=new c.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){w.length=0,b=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(he,fe,ue,ie){if(fe>=he.length||he[fe].level<=ue)return fe;var pe=he[fe];ie.push("<li><a href='#"+pe.anchor+"'>"+pe.text+"</a>"),fe++;var $=[];return fe=u(he,fe,pe.level,$),$.length>0&&(ie.push("<ul>"),$.forEach(function(ae){ie.push(ae)}),ie.push("</ul>")),ie.push("</li>"),fe=u(he,fe,ue,ie),fe}function A(){return u(w,0,0,b),b.push("</ul>"),b.join("")}var v={heading:function(fe){var ue=l.exec(fe);if(ue)return{type:"heading",raw:ue[0],depth:ue[1].length,text:ue[2]}},fences:function(fe){var ue=this.rules.block.fences.exec(fe);if(ue){var ie=ue[0],pe=R(ie,ue[3]||""),$=ue[2]?ue[2].trim():ue[2];if(["latex","katex","math"].indexOf($)>=0){var ae=T(),ee=pe;pe=ae,f[ae]={type:"block",expression:ee}}return{type:"code",raw:ie,lang:$,text:pe}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,D=0,T=function(){return"__special_katext_id_".concat(D++,"__")},f={};function h(){return f}function d(){D=0,f={}}function o(he){return he=he.replace(g,function(fe,ue){var ie=T();return f[ie]={type:"inline",expression:ue},ie}),he}var E=x.listitem;x.listitem=function(he){return E(o(he))};var y=x.paragraph;x.paragraph=function(he){return y(o(he))};var m=x.tablecell;x.tablecell=function(he,fe){return m(o(he),fe)},x.code=function(he,fe,ue){var ie=(fe||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(ue?he:Object(p.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ue?he:Object(p.escape)(he,!0))+"</code></pre>"},x.heading=function(he,fe,ue){var ie=this.options.headerPrefix+ue.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ie,level:fe,text:he}),"<h"+fe+' id="'+ie+'">'+he+"</h"+fe+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:v,renderer:x});var k=c.a,I=re("SJMd"),U=re("ulZh"),W=re.n(U),_=re("m3rI"),M=re("Oy/b"),K=re("p5ED"),Y=re("8hTe"),q=re.n(Y),oe=/<pre[^>]*>/g;function be(he){var fe=document.createElement("div");return fe.innerHTML=he,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var me=ze.a=function(he){var fe=he.value,ue=fe===void 0?"":fe,ie=he.edit,pe=ie===void 0?!1:ie,$=he.className,ae=he.showTextOnly,ee=he.showLines,Ee=he.replaces,Ce=he.zoomImg,ve=he.hasMask,Se=he.style,Re=Se===void 0?{}:Se,Ne=he.stylesPrev,_e=Ne===void 0?{}:Ne,Pe=String(ue),ke=Object(B.useRef)(),Ze=Object(B.useRef)(),Ge=Object(B.useState)(""),Ve=Object(O.a)(Ge,2),We=Ve[0],rt=Ve[1],Xe=Object(B.useState)("office"),$e=Object(O.a)(Xe,2),we=$e[0],qe=$e[1],Ye=Object(B.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Pe=Pe.replace(ce,"("+_.a.API_SERVER+"/api/attachments/").replace(Q,'"'+_.a.API_SERVER+"/api/attachments/").replace(Z,'"'+_.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(De){}var te=k(Pe),se=h();if(Pe.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",A()),a()),te=te.replace(/(__special_katext_id_\d+__)/g,function(De,Be){var et=se[Be],ut=et.type,Le=et.expression;return Object(M.renderToString)(be(Le)||"",{displayMode:ut==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),d(),ae){var Te=document.createElement("div");return Te.innerHTML=te,Te.innerText}return setTimeout(function(){return ge()},500),te},[Pe]),Ae=Object(B.useRef)();s.WebkitLineClamp=ee,ee&&(Re=Object(F.a)(Object(F.a)({},Re),s));function Me(ce){var Q=ce.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var Z=Q.getAttribute("src");rt(Z),qe("image")}}else if(Q.tagName.toUpperCase()==="A"){var te=Q.getAttribute("href");if(te.indexOf("office")>-1)ce.preventDefault(),rt(te),qe("office");else if(te.indexOf("application/pdf")>-1)ce.preventDefault(),rt(te),qe("pdf");else if(te.indexOf("text/html")>-1)ce.preventDefault(),rt(te),qe("html");else if(te.startsWith("#")){ce.preventDefault();var se=document.getElementById(te.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=function(){var Q,Z=(Q=Ae.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");Z==null||Z.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(te.src),se.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Ae.current&&Ye&&(Ye.match(oe)&&window.PR.prettyPrint()),Ae.current)return Ae.current.addEventListener("click",Me),function(){Ae.current.removeEventListener("click",Me),d(),a()}},[Ye,Ae.current,Me]);var de=function(Q){if(!pe)return;Q.target.nodeName==="IMG"?(ke.current.style.display="flex",ke.current.style.width=Q.target.clientWidth+"px",ke.current.style.height=Q.target.clientHeight+"px",ke.current.style.top=Q.target.offsetTop+"px",ke.current.style.left=Q.target.offsetLeft+"px",Ze.current.src=Q.target.getAttribute("src")):ke.current.style.display="none"};return N.a.createElement("div",{style:{position:"relative"}},N.a.createElement("div",{ref:Ae,style:Object(F.a)({},Re),className:"".concat($||""," markdown-body ").concat(q.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:Ye}}),N.a.createElement("div",{ref:ke,className:q.a.button},N.a.createElement(H.a,null,N.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),N.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),N.a.createElement("img",{ref:Ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),N.a.createElement(K.a,{close:!0,data:We,type:We!=null&&We.length?we:"",style:Object(F.a)({},_e),onClose:function(){return rt("")}}))}},"9VGf":function(nt,ze,re){"use strict";re.d(ze,"a",function(){return L});var J=re("cDcd"),H=re.n(J);function L(z,F){var O=Object(J.useRef)();Object(J.useEffect)(function(){O.current=z}),Object(J.useEffect)(function(){function B(){O.current()}if(F!==null){var N=setInterval(B,F);return function(){return clearInterval(N)}}},[F])}},"9ivq":function(nt,ze,re){},Bd2K:function(nt,ze,re){(function(J){J(re("VrN/"),re("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(P,C,c){if(c!=J.Init&&c&&P.removeKeyMap("autoCloseTags"),!C)return;var p={name:"autoCloseTags"};(typeof C!="object"||C.whenClosing!==!1)&&(p["'/'"]=function(R){return O(R)}),(typeof C!="object"||C.whenOpening!==!1)&&(p["'>'"]=function(R){return z(R)}),P.addKeyMap(p)});var H=["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 z(P){if(P.getOption("disableInput"))return J.Pass;for(var C=P.listSelections(),c=[],p=P.getOption("autoCloseTags"),R=0;R<C.length;R++){if(!C[R].empty())return J.Pass;var w=C[R].head,b=P.getTokenAt(w),x=J.innerMode(P.getMode(),b.state),l=x.state,a=x.mode.xmlCurrentTag&&x.mode.xmlCurrentTag(l),s=a&&a.name;if(!s)return J.Pass;var u=x.mode.configuration=="html",A=typeof p=="object"&&p.dontCloseTags||u&&H,v=typeof p=="object"&&p.indentTags||u&&L;b.end>w.ch&&(s=s.slice(0,s.length-b.end+w.ch));var g=s.toLowerCase();if(!s||b.type=="string"&&(b.end!=w.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&a.close||b.string.indexOf("/")==w.ch-b.start-1||A&&B(A,g)>-1||N(P,x.mode.xmlCurrentContext&&x.mode.xmlCurrentContext(l)||[],s,w,!0))return J.Pass;var D=typeof p=="object"&&p.emptyTags;if(D&&B(D,s)>-1){c[R]={text:"/>",newPos:J.Pos(w.line,w.ch+2)};continue}var T=v&&B(v,g)>-1;c[R]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+s+">",newPos:T?J.Pos(w.line+1,0):J.Pos(w.line,w.ch+1)}}for(var f=typeof p=="object"&&p.dontIndentOnAutoClose,R=C.length-1;R>=0;R--){var h=c[R];P.replaceRange(h.text,C[R].head,C[R].anchor,"+insert");var d=P.listSelections().slice(0);d[R]={head:h.newPos,anchor:h.newPos},P.setSelections(d),!f&&h.indent&&(P.indentLine(h.newPos.line,null,!0),P.indentLine(h.newPos.line+1,null,!0))}}function F(P,C){for(var c=P.listSelections(),p=[],R=C?"/":"</",w=P.getOption("autoCloseTags"),b=typeof w=="object"&&w.dontIndentOnSlash,x=0;x<c.length;x++){if(!c[x].empty())return J.Pass;var l=c[x].head,a=P.getTokenAt(l),s=J.innerMode(P.getMode(),a.state),u=s.state;if(C&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=l.ch-1))return J.Pass;var A,v=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(v&&s.mode.name=="javascript")A=R+"script";else if(v&&s.mode.name=="css")A=R+"style";else{var g=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!g||g.length&&N(P,g,g[g.length-1],l))return J.Pass;A=R+g[g.length-1]}P.getLine(l.line).charAt(a.end)!=">"&&(A+=">"),p[x]=A}if(P.replaceSelections(p),c=P.listSelections(),!b)for(var x=0;x<c.length;x++)(x==c.length-1||c[x].head.line<c[x+1].head.line)&&P.indentLine(c[x].head.line)}function O(P){return P.getOption("disableInput")?J.Pass:F(P,!0)}J.commands.closeTag=function(P){return F(P)};function B(P,C){if(P.indexOf)return P.indexOf(C);for(var c=0,p=P.length;c<p;++c)if(P[c]==C)return c;return-1}function N(P,C,c,p,R){if(!J.scanForClosingTag)return!1;var w=Math.min(P.lastLine()+1,p.line+500),b=J.scanForClosingTag(P,p,null,w);if(!b||b.tag!=c)return!1;for(var x=R?1:0,l=C.length-1;l>=0&&C[l]==c;l--)++x;p=b.to;for(var l=1;l<x;l++){var a=J.scanForClosingTag(P,p,null,w);if(!a||a.tag!=c)return!1;p=a.to}return!0}})},BjJ7:function(nt,ze,re){"use strict";re.d(ze,"d",function(){return H}),re.d(ze,"c",function(){return L}),re.d(ze,"e",function(){return z}),re.d(ze,"b",function(){return F}),re.d(ze,"a",function(){return B});var J=re("m3rI");function H(N){var P=!0;if(N.length>0){for(var C=0;C<N.length;C++)if(N[C].compile_success==0||!N[C].compile_success){P=!1;break}}else P=!1;return P}function L(N){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",C=[],c=0;c<N.length;c++){var p=N[c],R=P?"".concat(P,"/").concat(p.name):"".concat(p.name);C.push({title:p.name,isLeaf:!(p.type==="tree"),key:R})}return C}function z(N,P,C){for(var c=0;c<N.length;c++){var p=N[c];if(p.key===P){p.children=C;break}p.children&&z(p.children,P,C)}return N}function F(N,P,C){var c;return function(){var p=this,R=arguments,w=function(){c=null,C||N.apply(p,R)},b=C&&!c;clearTimeout(c),c=setTimeout(w,P),b&&N.apply(p,R)}}var O=!0,B=J.a.API_SERVER},"C+DQ":function(nt,ze,re){},D1Df:function(nt,ze,re){"use strict";function J(m){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(I){return typeof I}:J=function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},J(m)}function H(){return H=Object.assign||function(m){for(var k=1;k<arguments.length;k++){var I=arguments[k];for(var U in I)Object.prototype.hasOwnProperty.call(I,U)&&(m[U]=I[U])}return m},H.apply(this,arguments)}function L(m,k){var I=Object.keys(m);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(m);k&&(U=U.filter(function(W){return Object.getOwnPropertyDescriptor(m,W).enumerable})),I.push.apply(I,U)}return I}function z(m){for(var k=1;k<arguments.length;k++){var I=arguments[k]!=null?arguments[k]:{};k%2?L(I,!0).forEach(function(U){b(m,U,I[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(I)):L(I).forEach(function(U){Object.defineProperty(m,U,Object.getOwnPropertyDescriptor(I,U))})}return m}function F(m,k){if(m==null)return{};var I=O(m,k),U,W;if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(m);for(W=0;W<_.length;W++){if(U=_[W],k.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(m,U))continue;I[U]=m[U]}}return I}function O(m,k){if(m==null)return{};var I={},U=Object.keys(m),W,_;for(_=0;_<U.length;_++){if(W=U[_],k.indexOf(W)>=0)continue;I[W]=m[W]}return I}function B(m,k){if(!(m instanceof k))throw new TypeError("Cannot call a class as a function")}function N(m,k){for(var I=0;I<k.length;I++){var U=k[I];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(m,U.key,U)}}function P(m,k,I){return k&&N(m.prototype,k),I&&N(m,I),m}function C(m,k){return k&&(J(k)==="object"||typeof k=="function")?k:p(m)}function c(m){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(I){return I.__proto__||Object.getPrototypeOf(I)},c(m)}function p(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function R(m,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(k&&k.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),k&&w(m,k)}function w(m,k){return w=Object.setPrototypeOf||function(U,W){return U.__proto__=W,U},w(m,k)}function b(m,k,I){return k in m?Object.defineProperty(m,k,{value:I,enumerable:!0,configurable:!0,writable:!0}):m[k]=I,m}var x=re("cDcd"),l=re("17x9"),a=re("H38U"),s=re("aRTE");function u(m){for(var k="",I=0;I<m.length;I++){var U=m.charCodeAt(I);U<128?k+=String.fromCharCode(U):U<2048?(k+=String.fromCharCode(192|U>>6),k+=String.fromCharCode(128|U&63)):U<55296||U>=57344?(k+=String.fromCharCode(224|U>>12),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63)):(I++,U=65536+((U&1023)<<10|m.charCodeAt(I)&1023),k+=String.fromCharCode(240|U>>18),k+=String.fromCharCode(128|U>>12&63),k+=String.fromCharCode(128|U>>6&63),k+=String.fromCharCode(128|U&63))}return k}var A={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},v={},g=4,D=.1;function T(m){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,I=[];return m.forEach(function(U,W){var _=null;U.forEach(function(M,K){if(!M&&_!==null){I.push("M".concat(_+k," ").concat(W+k,"h").concat(K-_,"v1H").concat(_+k,"z")),_=null;return}if(K===U.length-1){if(!M)return;_===null?I.push("M".concat(K+k,",").concat(W+k," h1v1H").concat(K+k,"z")):I.push("M".concat(_+k,",").concat(W+k," h").concat(K+1-_,"v1H").concat(_+k,"z"));return}M&&_===null&&(_=K)})}),I.join("")}function f(m,k){return m.slice().map(function(I,U){return U<k.y||U>=k.y+k.h?I:I.map(function(W,_){return _<k.x||_>=k.x+k.w?W:!1})})}function h(m,k){var I=m.imageSettings,U=m.size,W=m.includeMargin;if(I==null)return null;var _=W?g:0,M=k.length+_*2,K=Math.floor(U*D),Y=M/U,q=(I.width||K)*Y,oe=(I.height||K)*Y,be=I.x==null?k.length/2-q/2:I.x*Y,me=I.y==null?k.length/2-oe/2:I.y*Y,he=null;if(I.excavate){var fe=Math.floor(be),ue=Math.floor(me),ie=Math.ceil(q+be-fe),pe=Math.ceil(oe+me-ue);he={x:fe,y:ue,w:ie,h:pe}}return{x:be,y:me,h:oe,w:q,excavation:he}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(m){return!1}return!0}(),o=function(m){R(k,m);function k(){var I,U;B(this,k);for(var W=arguments.length,_=new Array(W),M=0;M<W;M++)_[M]=arguments[M];return U=C(this,(I=c(k)).call.apply(I,[this].concat(_))),b(p(U),"_canvas",void 0),b(p(U),"_image",void 0),b(p(U),"state",{imgLoaded:!1}),b(p(U),"handleImageLoad",function(){U.setState({imgLoaded:!0})}),U}return P(k,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var U=this.props,W=U.value,_=U.size,M=U.level,K=U.bgColor,Y=U.fgColor,q=U.includeMargin,oe=U.imageSettings,be=new a(-1,s[M]);if(be.addData(u(W)),be.make(),this._canvas!=null){var me=this._canvas,he=me.getContext("2d");if(!he)return;var fe=be.modules;if(fe===null)return;var ue=q?g:0,ie=fe.length+ue*2,pe=h(this.props,fe);oe!=null&&pe!=null&&(pe.excavation!=null&&(fe=f(fe,pe.excavation)));var $=window.devicePixelRatio||1;me.height=me.width=_*$;var ae=_/ie*$;he.scale(ae,ae),he.fillStyle=K,he.fillRect(0,0,ie,ie),he.fillStyle=Y,d?he.fill(new Path2D(T(fe,ue))):fe.forEach(function(ee,Ee){ee.forEach(function(Ce,ve){Ce&&he.fillRect(ve+ue,Ee+ue,1,1)})}),this.state.imgLoaded&&this._image&&pe!=null&&he.drawImage(this._image,pe.x+ue,pe.y+ue,pe.w,pe.h)}}},{key:"render",value:function(){var U=this,W=this.props,_=W.value,M=W.size,K=W.level,Y=W.bgColor,q=W.fgColor,oe=W.style,be=W.includeMargin,me=W.imageSettings,he=F(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),fe=z({height:M,width:M},oe),ue=null,ie=me&&me.src;return me!=null&&ie!=null&&(ue=x.createElement("img",{src:ie,style:{display:"none"},onLoad:this.handleImageLoad,ref:function($){return U._image=$}})),x.createElement(x.Fragment,null,x.createElement("canvas",H({style:fe,height:M,width:M,ref:function($){return U._canvas=$}},he)),ue)}}]),k}(x.PureComponent);b(o,"defaultProps",A);var E=function(m){R(k,m);function k(){return B(this,k),C(this,c(k).apply(this,arguments))}return P(k,[{key:"render",value:function(){var U=this.props,W=U.value,_=U.size,M=U.level,K=U.bgColor,Y=U.fgColor,q=U.includeMargin,oe=U.imageSettings,be=F(U,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),me=new a(-1,s[M]);me.addData(u(W)),me.make();var he=me.modules;if(he===null)return null;var fe=q?g:0,ue=he.length+fe*2,ie=h(this.props,he),pe=null;oe!=null&&ie!=null&&(ie.excavation!=null&&(he=f(he,ie.excavation)),pe=x.createElement("image",{xlinkHref:oe.src,height:ie.h,width:ie.w,x:ie.x+fe,y:ie.y+fe,preserveAspectRatio:"none"}));var $=T(he,fe);return x.createElement("svg",H({shapeRendering:"crispEdges",height:_,width:_,viewBox:"0 0 ".concat(ue," ").concat(ue)},be),x.createElement("path",{fill:K,d:"M0,0 h".concat(ue,"v").concat(ue,"H0z")}),x.createElement("path",{fill:Y,d:$}),pe)}}]),k}(x.PureComponent);b(E,"defaultProps",A);var y=function(k){var I=k.renderAs,U=F(k,["renderAs"]),W=I==="svg"?E:o;return x.createElement(W,U)};y.defaultProps=z({renderAs:"canvas"},A),nt.exports=y},DlQD:function(nt,ze,re){(function(J,H){nt.exports=H()})(this,function(){"use strict";function J(ge,de){for(var ce=0;ce<de.length;ce++){var Q=de[ce];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ge,Q.key,Q)}}function H(ge,de,ce){return de&&J(ge.prototype,de),ce&&J(ge,ce),ge}function L(ge,de){if(!ge)return;if(typeof ge=="string")return z(ge,de);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return z(ge,de)}function z(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,Q=new Array(de);ce<de;ce++)Q[ce]=ge[ce];return Q}function F(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=L(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var Q=0;return function(){return Q>=ge.length?{done:!0}:{done:!1,value:ge[Q++]}}}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 ce=ge[Symbol.iterator](),ce.next.bind(ce)}function O(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var B=O(function(ge){function de(){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 ce(Q){ge.exports.defaults=Q}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),N=B.defaults,P=B.getDefaults,C=B.changeDefaults,c=/[&<>"']/,p=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,b={"&":"&","<":"<",">":">",'"':""","'":"'"},x=function(de){return b[de]};function l(ge,de){if(de){if(c.test(ge))return ge.replace(p,x)}else if(R.test(ge))return ge.replace(w,x);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ge){return ge.replace(a,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var u=/(^|[^\[])\^/g;function A(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(Z,te){return te=te.source||te,te=te.replace(u,"$1"),ge=ge.replace(Z,te),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var v=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var Q;try{Q=decodeURIComponent(s(ce)).replace(v,"").toLowerCase()}catch(Z){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}de&&!g.test(ce)&&(ce=o(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(Z){return null}return ce}var T={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(ge,de){T[" "+ge]||(f.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=k(ge,"/",!0)),ge=T[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(h,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(d,"$1")+de:ge+de}var E={exec:function(){}};function y(ge){for(var de=1,ce,Q;de<arguments.length;de++){ce=arguments[de];for(Q in ce)Object.prototype.hasOwnProperty.call(ce,Q)&&(ge[Q]=ce[Q])}return ge}function m(ge,de){var ce=ge.replace(/\|/g,function(te,se,Te){for(var De=!1,Be=se;--Be>=0&&Te[Be]==="\\";)De=!De;return De?"|":" |"}),Q=ce.split(/ \|/),Z=0;if(Q.length>de)Q.splice(de);else for(;Q.length<de;)Q.push("");for(;Z<Q.length;Z++)Q[Z]=Q[Z].trim().replace(/\\\|/g,"|");return Q}function k(ge,de,ce){var Q=ge.length;if(Q===0)return"";for(var Z=0;Z<Q;){var te=ge.charAt(Q-Z-1);if(te===de&&!ce)Z++;else if(te!==de&&ce)Z++;else break}return ge.substr(0,Q-Z)}function I(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,Q=0,Z=0;Z<ce;Z++)if(ge[Z]==="\\")Z++;else if(ge[Z]===de[0])Q++;else if(ge[Z]===de[1]&&(Q--,Q<0))return Z;return-1}function U(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:l,unescape:s,edit:A,cleanUrl:D,resolveUrl:o,noopTest:E,merge:y,splitCells:m,rtrim:k,findClosingBracket:I,checkSanitizeDeprecation:U},_=B.defaults,M=W.rtrim,K=W.splitCells,Y=W.escape,q=W.findClosingBracket;function oe(ge,de,ce){var Q=de.href,Z=de.title?Y(de.title):null,te=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:Q,title:Z,text:te}:{type:"image",raw:ce,href:Q,title:Z,text:Y(te)}}function be(ge,de){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return de;var Q=ce[1];return de.split(`
|
|
`).map(function(Z){var te=Z.match(/^\s+/);if(te===null)return Z;var se=te[0];return se.length>=Q.length?Z.slice(Q.length):Z}).join(`
|
|
`)}var me=function(){function ge(ce){this.options=ce||_}var de=ge.prototype;return de.space=function(Q){var Z=this.rules.block.newline.exec(Q);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
`}},de.code=function(Q,Z){var te=this.rules.block.code.exec(Q);if(te){var se=Z[Z.length-1];if(se&&se.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var Te=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:M(Te,`
|
|
`)}}},de.fences=function(Q){var Z=this.rules.block.fences.exec(Q);if(Z){var te=Z[0],se=be(te,Z[3]||"");return{type:"code",raw:te,lang:Z[2]?Z[2].trim():Z[2],text:se}}},de.heading=function(Q){var Z=this.rules.block.heading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},de.nptable=function(Q){var Z=this.rules.block.nptable.exec(Q);if(Z){var te={type:"table",header:K(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Z[0]};if(te.header.length===te.align.length){var se=te.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(se=te.cells.length,Te=0;Te<se;Te++)te.cells[Te]=K(te.cells[Te],te.header.length);return te}}},de.hr=function(Q){var Z=this.rules.block.hr.exec(Q);if(Z)return{type:"hr",raw:Z[0]}},de.blockquote=function(Q){var Z=this.rules.block.blockquote.exec(Q);if(Z){var te=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:te}}},de.list=function(Q){var Z=this.rules.block.list.exec(Q);if(Z){for(var te=Z[0],se=Z[2],Te=se.length>1,De=se[se.length-1]===")",Be={type:"list",raw:te,ordered:Te,start:Te?+se.slice(0,-1):"",loose:!1,items:[]},et=Z[0].match(this.rules.block.item),ut=!1,Le,ht,it,Qe,vt,xt,yt,St=et.length,mt=0;mt<St;mt++)Le=et[mt],te=Le,ht=Le.length,Le=Le.replace(/^ *([*+-]|\d+[.)]) */,""),~Le.indexOf(`
|
|
`)&&(ht-=Le.length,Le=this.options.pedantic?Le.replace(/^ {1,4}/gm,""):Le.replace(new RegExp("^ {1,"+ht+"}","gm"),"")),mt!==St-1&&(it=this.rules.block.bullet.exec(et[mt+1])[0],(Te?it.length===1||!De&&it[it.length-1]===")":it.length>1||this.options.smartLists&&it!==se)&&(Qe=et.slice(mt+1).join(`
|
|
`),Be.raw=Be.raw.substring(0,Be.raw.length-Qe.length),mt=St-1)),vt=ut||/\n\n(?!\s*$)/.test(Le),mt!==St-1&&(ut=Le.charAt(Le.length-1)===`
|
|
`,vt||(vt=ut)),vt&&(Be.loose=!0),xt=/^\[[ xX]\] /.test(Le),yt=void 0,xt&&(yt=Le[1]!==" ",Le=Le.replace(/^\[[ xX]\] +/,"")),Be.items.push({type:"list_item",raw:te,task:xt,checked:yt,loose:vt,text:Le});return Be}},de.html=function(Q){var Z=this.rules.block.html.exec(Q);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):Y(Z[0]):Z[0]}},de.def=function(Q){var Z=this.rules.block.def.exec(Q);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var te=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Z[0],href:Z[2],title:Z[3]}}},de.table=function(Q){var Z=this.rules.block.table.exec(Q);if(Z){var te={type:"table",header:K(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=Z[0];var se=te.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(se=te.cells.length,Te=0;Te<se;Te++)te.cells[Te]=K(te.cells[Te].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},de.lheading=function(Q){var Z=this.rules.block.lheading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},de.paragraph=function(Q){var Z=this.rules.block.paragraph.exec(Q);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
`?Z[1].slice(0,-1):Z[1]}},de.text=function(Q,Z){var te=this.rules.block.text.exec(Q);if(te){var se=Z[Z.length-1];return se&&se.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},de.escape=function(Q){var Z=this.rules.inline.escape.exec(Q);if(Z)return{type:"escape",raw:Z[0],text:Y(Z[1])}},de.tag=function(Q,Z,te){var se=this.rules.inline.tag.exec(Q);if(se)return!Z&&/^<a /i.test(se[0])?Z=!0:Z&&/^<\/a>/i.test(se[0])&&(Z=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Z,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},de.link=function(Q){var Z=this.rules.inline.link.exec(Q);if(Z){var te=q(Z[2],"()");if(te>-1){var se=Z[0].indexOf("!")===0?5:4,Te=se+Z[1].length+te;Z[2]=Z[2].substring(0,te),Z[0]=Z[0].substring(0,Te).trim(),Z[3]=""}var De=Z[2],Be="";if(this.options.pedantic){var et=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);et?(De=et[1],Be=et[3]):Be=""}else Be=Z[3]?Z[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var ut=oe(Z,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:Be&&Be.replace(this.rules.inline._escapes,"$1")},Z[0]);return ut}},de.reflink=function(Q,Z){var te;if((te=this.rules.inline.reflink.exec(Q))||(te=this.rules.inline.nolink.exec(Q))){var se=(te[2]||te[1]).replace(/\s+/g," ");if(se=Z[se.toLowerCase()],!se||!se.href){var Te=te[0].charAt(0);return{type:"text",raw:Te,text:Te}}var De=oe(te,se,te[0]);return De}},de.strong=function(Q,Z,te){te===void 0&&(te="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*Q.length);var Te=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var De;(se=Te.exec(Z))!=null;)if(De=this.rules.inline.strong.middle.exec(Z.slice(0,se.index+3)),De)return{type:"strong",raw:Q.slice(0,De[0].length),text:Q.slice(2,De[0].length-2)}}},de.em=function(Q,Z,te){te===void 0&&(te="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*Q.length);var Te=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var De;(se=Te.exec(Z))!=null;)if(De=this.rules.inline.em.middle.exec(Z.slice(0,se.index+2)),De)return{type:"em",raw:Q.slice(0,De[0].length),text:Q.slice(1,De[0].length-1)}}},de.codespan=function(Q){var Z=this.rules.inline.code.exec(Q);if(Z){var te=Z[2].replace(/\n/g," "),se=/[^ ]/.test(te),Te=te.startsWith(" ")&&te.endsWith(" ");return se&&Te&&(te=te.substring(1,te.length-1)),te=Y(te,!0),{type:"codespan",raw:Z[0],text:te}}},de.br=function(Q){var Z=this.rules.inline.br.exec(Q);if(Z)return{type:"br",raw:Z[0]}},de.del=function(Q){var Z=this.rules.inline.del.exec(Q);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},de.autolink=function(Q,Z){var te=this.rules.inline.autolink.exec(Q);if(te){var se,Te;return te[2]==="@"?(se=Y(this.options.mangle?Z(te[1]):te[1]),Te="mailto:"+se):(se=Y(te[1]),Te=se),{type:"link",raw:te[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(Q,Z){var te;if(te=this.rules.inline.url.exec(Q)){var se,Te;if(te[2]==="@")se=Y(this.options.mangle?Z(te[0]):te[0]),Te="mailto:"+se;else{var De;do De=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(De!==te[0]);se=Y(te[0]),te[1]==="www."?Te="http://"+se:Te=se}return{type:"link",raw:te[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(Q,Z,te){var se=this.rules.inline.text.exec(Q);if(se){var Te;return Z?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:Te=Y(this.options.smartypants?te(se[0]):se[0]),{type:"text",raw:se[0],text:Te}}},ge}(),he=W.noopTest,fe=W.edit,ue=W.merge,ie={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=fe(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=fe(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=fe(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=fe(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=fe(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=fe(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=ue({},ie),ie.gfm=ue({},ie.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*|$)"}),ie.gfm.nptable=fe(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=fe(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=ue({},ie.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:he,paragraph:fe(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var pe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,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",ie._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=ue({},pe),pe.pedantic=ue({},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=ue({},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=ue({},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:ie,inline:pe},ae=B.defaults,ee=$.block,Ee=$.inline;function Ce(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ve(ge){var de="",ce,Q,Z=ge.length;for(ce=0;ce<Z;ce++)Q=ge.charCodeAt(ce),Math.random()>.5&&(Q="x"+Q.toString(16)),de+="&#"+Q+";";return de}var Se=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ae,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:ee.normal,inline:Ee.normal};this.options.pedantic?(Q.block=ee.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=ee.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,Z){var te=new ge(Z);return te.lex(Q)};var de=ge.prototype;return de.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(Q,Z,te){Z===void 0&&(Z=[]),te===void 0&&(te=!0),Q=Q.replace(/^ +$/gm,"");for(var se,Te,De,Be;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&Z.push(se);continue}if(se=this.tokenizer.code(Q,Z)){Q=Q.substring(se.raw.length),se.type?Z.push(se):(Be=Z[Z.length-1],Be.raw+=`
|
|
`+se.raw,Be.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],te),Z.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),De=se.items.length,Te=0;Te<De;Te++)se.items[Te].tokens=this.blockTokens(se.items[Te].text,[],!1);Z.push(se);continue}if(se=this.tokenizer.html(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(te&&(se=this.tokenizer.def(Q))){Q=Q.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(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.lheading(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(te&&(se=this.tokenizer.paragraph(Q))){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.text(Q,Z)){Q=Q.substring(se.raw.length),se.type?Z.push(se):(Be=Z[Z.length-1],Be.raw+=`
|
|
`+se.raw,Be.text+=`
|
|
`+se.text);continue}if(Q){var et="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(et);break}else throw new Error(et)}}return Z},de.inline=function(Q){var Z,te,se,Te,De,Be,et=Q.length;for(Z=0;Z<et;Z++){Be=Q[Z];switch(Be.type){case"paragraph":case"text":case"heading":{Be.tokens=[],this.inlineTokens(Be.text,Be.tokens);break}case"table":{for(Be.tokens={header:[],cells:[]},Te=Be.header.length,te=0;te<Te;te++)Be.tokens.header[te]=[],this.inlineTokens(Be.header[te],Be.tokens.header[te]);for(Te=Be.cells.length,te=0;te<Te;te++)for(De=Be.cells[te],Be.tokens.cells[te]=[],se=0;se<De.length;se++)Be.tokens.cells[te][se]=[],this.inlineTokens(De[se],Be.tokens.cells[te][se]);break}case"blockquote":{this.inline(Be.tokens);break}case"list":{for(Te=Be.items.length,te=0;te<Te;te++)this.inline(Be.items[te].tokens);break}}}return Q},de.inlineTokens=function(Q,Z,te,se,Te){Z===void 0&&(Z=[]),te===void 0&&(te=!1),se===void 0&&(se=!1),Te===void 0&&(Te="");var De,Be=Q,et;if(this.tokens.links){var ut=Object.keys(this.tokens.links);if(ut.length>0)for(;(et=this.tokenizer.rules.inline.reflinkSearch.exec(Be))!=null;)ut.includes(et[0].slice(et[0].lastIndexOf("[")+1,-1))&&(Be=Be.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(et=this.tokenizer.rules.inline.blockSkip.exec(Be))!=null;)Be=Be.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(De=this.tokenizer.escape(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.tag(Q,te,se)){Q=Q.substring(De.raw.length),te=De.inLink,se=De.inRawBlock,Z.push(De);continue}if(De=this.tokenizer.link(Q)){Q=Q.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Z.push(De);continue}if(De=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Z.push(De);continue}if(De=this.tokenizer.strong(Q,Be,Te)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Z.push(De);continue}if(De=this.tokenizer.em(Q,Be,Te)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Z.push(De);continue}if(De=this.tokenizer.codespan(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.br(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.del(Q)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],te,se),Z.push(De);continue}if(De=this.tokenizer.autolink(Q,ve)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(!te&&(De=this.tokenizer.url(Q,ve))){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.inlineText(Q,se,Ce)){Q=Q.substring(De.raw.length),Te=De.raw.slice(-1),Z.push(De);continue}if(Q){var Le="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Le);break}else throw new Error(Le)}}return Z},H(ge,null,[{key:"rules",get:function(){return{block:ee,inline:Ee}}}]),ge}(),Re=B.defaults,Ne=W.cleanUrl,_e=W.escape,Pe=function(){function ge(ce){this.options=ce||Re}var de=ge.prototype;return de.code=function(Q,Z,te){var se=(Z||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Q,se);Te!=null&&Te!==Q&&(te=!0,Q=Te)}return se?'<pre><code class="'+this.options.langPrefix+_e(se,!0)+'">'+(te?Q:_e(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?Q:_e(Q,!0))+`</code></pre>
|
|
`},de.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},de.html=function(Q){return Q},de.heading=function(Q,Z,te,se){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+se.slug(te)+'">'+Q+"</h"+Z+`>
|
|
`:"<h"+Z+">"+Q+"</h"+Z+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(Q,Z,te){var se=Z?"ol":"ul",Te=Z&&te!==1?' start="'+te+'"':"";return"<"+se+Te+`>
|
|
`+Q+"</"+se+`>
|
|
`},de.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},de.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},de.table=function(Q,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+Z+`</table>
|
|
`},de.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},de.tablecell=function(Q,Z){var te=Z.header?"th":"td",se=Z.align?"<"+te+' align="'+Z.align+'">':"<"+te+">";return se+Q+"</"+te+`>
|
|
`},de.strong=function(Q){return"<strong>"+Q+"</strong>"},de.em=function(Q){return"<em>"+Q+"</em>"},de.codespan=function(Q){return"<code>"+Q+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(Q){return"<del>"+Q+"</del>"},de.link=function(Q,Z,te){if(Q=Ne(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var se='<a href="'+_e(Q)+'"';return Z&&(se+=' title="'+Z+'"'),se+=">"+te+"</a>",se},de.image=function(Q,Z,te){if(Q=Ne(this.options.sanitize,this.options.baseUrl,Q),Q===null)return te;var se='<img src="'+Q+'" alt="'+te+'"';return Z&&(se+=' title="'+Z+'"'),se+=this.options.xhtml?"/>":">",se},de.text=function(Q){return Q},ge}(),ke=function(){function ge(){}var de=ge.prototype;return de.strong=function(Q){return Q},de.em=function(Q){return Q},de.codespan=function(Q){return Q},de.del=function(Q){return Q},de.html=function(Q){return Q},de.text=function(Q){return Q},de.link=function(Q,Z,te){return""+te},de.image=function(Q,Z,te){return""+te},de.br=function(){return""},ge}(),Ze=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(Q){var Z=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var te=Z;do this.seen[te]++,Z=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ge}(),Ge=B.defaults,Ve=W.unescape,We=function(){function ge(ce){this.options=ce||Ge,this.options.renderer=this.options.renderer||new Pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ke,this.slugger=new Ze}ge.parse=function(Q,Z){var te=new ge(Z);return te.parse(Q)};var de=ge.prototype;return de.parse=function(Q,Z){Z===void 0&&(Z=!0);var te="",se,Te,De,Be,et,ut,Le,ht,it,Qe,vt,xt,yt,St,mt,Yt,Kt,Ut,Tr=Q.length;for(se=0;se<Tr;se++){Qe=Q[se];switch(Qe.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,Ve(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(ht="",Le="",Be=Qe.header.length,Te=0;Te<Be;Te++)Le+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[Te]),{header:!0,align:Qe.align[Te]});for(ht+=this.renderer.tablerow(Le),it="",Be=Qe.cells.length,Te=0;Te<Be;Te++){for(ut=Qe.tokens.cells[Te],Le="",et=ut.length,De=0;De<et;De++)Le+=this.renderer.tablecell(this.parseInline(ut[De]),{header:!1,align:Qe.align[De]});it+=this.renderer.tablerow(Le)}te+=this.renderer.table(ht,it);continue}case"blockquote":{it=this.parse(Qe.tokens),te+=this.renderer.blockquote(it);continue}case"list":{for(vt=Qe.ordered,xt=Qe.start,yt=Qe.loose,Be=Qe.items.length,it="",Te=0;Te<Be;Te++)mt=Qe.items[Te],Yt=mt.checked,Kt=mt.task,St="",mt.task&&(Ut=this.renderer.checkbox(Yt),yt?mt.tokens.length>0&&mt.tokens[0].type==="text"?(mt.tokens[0].text=Ut+" "+mt.tokens[0].text,mt.tokens[0].tokens&&mt.tokens[0].tokens.length>0&&mt.tokens[0].tokens[0].type==="text"&&(mt.tokens[0].tokens[0].text=Ut+" "+mt.tokens[0].tokens[0].text)):mt.tokens.unshift({type:"text",text:Ut}):St+=Ut),St+=this.parse(mt.tokens,yt),it+=this.renderer.listitem(St,Kt,Yt);te+=this.renderer.list(it,vt,xt);continue}case"html":{te+=this.renderer.html(Qe.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(it=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;se+1<Tr&&Q[se+1].type==="text";)Qe=Q[++se],it+=`
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);te+=Z?this.renderer.paragraph(it):it;continue}default:{var vr='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return te},de.parseInline=function(Q,Z){Z=Z||this.renderer;var te="",se,Te,De=Q.length;for(se=0;se<De;se++){Te=Q[se];switch(Te.type){case"escape":{te+=Z.text(Te.text);break}case"html":{te+=Z.html(Te.text);break}case"link":{te+=Z.link(Te.href,Te.title,this.parseInline(Te.tokens,Z));break}case"image":{te+=Z.image(Te.href,Te.title,Te.text);break}case"strong":{te+=Z.strong(this.parseInline(Te.tokens,Z));break}case"em":{te+=Z.em(this.parseInline(Te.tokens,Z));break}case"codespan":{te+=Z.codespan(Te.text);break}case"br":{te+=Z.br();break}case"del":{te+=Z.del(this.parseInline(Te.tokens,Z));break}case"text":{te+=Z.text(Te.text);break}default:{var Be='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Be);return}else throw new Error(Be)}}}return te},ge}(),rt=W.merge,Xe=W.checkSanitizeDeprecation,$e=W.escape,we=B.getDefaults,qe=B.changeDefaults,Ye=B.defaults;function Ae(ge,de,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=rt({},Ae.defaults,de||{}),Xe(de),ce){var Q=de.highlight,Z;try{Z=Se.lex(ge,de)}catch(De){return ce(De)}var te=function(Be){var et;if(!Be)try{et=We.parse(Z,de)}catch(ut){Be=ut}return de.highlight=Q,Be?ce(Be):ce(null,et)};if(!Q||Q.length<3)return te();if(delete de.highlight,!Z.length)return te();var se=0;Ae.walkTokens(Z,function(De){De.type==="code"&&(se++,setTimeout(function(){Q(De.text,De.lang,function(Be,et){if(Be)return te(Be);et!=null&&et!==De.text&&(De.text=et,De.escaped=!0),se--,se===0&&te()})},0))}),se===0&&te();return}try{var Te=Se.lex(ge,de);return de.walkTokens&&Ae.walkTokens(Te,de.walkTokens),We.parse(Te,de)}catch(De){if(De.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+$e(De.message+"",!0)+"</pre>";throw De}}Ae.options=Ae.setOptions=function(ge){return rt(Ae.defaults,ge),qe(Ae.defaults),Ae},Ae.getDefaults=we,Ae.defaults=Ye,Ae.use=function(ge){var de=rt({},ge);if(ge.renderer&&function(){var Q=Ae.defaults.renderer||new Pe,Z=function(Te){var De=Q[Te];Q[Te]=function(){for(var Be=arguments.length,et=new Array(Be),ut=0;ut<Be;ut++)et[ut]=arguments[ut];var Le=ge.renderer[Te].apply(Q,et);return Le===!1&&(Le=De.apply(Q,et)),Le}};for(var te in ge.renderer)Z(te);de.renderer=Q}(),ge.tokenizer&&function(){var Q=Ae.defaults.tokenizer||new me,Z=function(Te){var De=Q[Te];Q[Te]=function(){for(var Be=arguments.length,et=new Array(Be),ut=0;ut<Be;ut++)et[ut]=arguments[ut];var Le=ge.tokenizer[Te].apply(Q,et);return Le===!1&&(Le=De.apply(Q,et)),Le}};for(var te in ge.tokenizer)Z(te);de.tokenizer=Q}(),ge.walkTokens){var ce=Ae.defaults.walkTokens;de.walkTokens=function(Q){ge.walkTokens(Q),ce&&ce(Q)}}Ae.setOptions(de)},Ae.walkTokens=function(ge,de){for(var ce=F(ge),Q;!(Q=ce()).done;){var Z=Q.value;de(Z);switch(Z.type){case"table":{for(var te=F(Z.tokens.header),se;!(se=te()).done;){var Te=se.value;Ae.walkTokens(Te,de)}for(var De=F(Z.tokens.cells),Be;!(Be=De()).done;)for(var et=Be.value,ut=F(et),Le;!(Le=ut()).done;){var ht=Le.value;Ae.walkTokens(ht,de)}break}case"list":{Ae.walkTokens(Z.items,de);break}default:Z.tokens&&Ae.walkTokens(Z.tokens,de)}}},Ae.Parser=We,Ae.parser=We.parse,Ae.Renderer=Pe,Ae.TextRenderer=ke,Ae.Lexer=Se,Ae.lexer=Se.lex,Ae.Tokenizer=me,Ae.Slugger=Ze,Ae.parse=Ae;var Me=Ae;return Me})},ELLl:function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){var H={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=J.Pos;J.defineOption("autoCloseBrackets",!1,function(b,x,l){l&&l!=J.Init&&(b.removeKeyMap(F),b.state.closeBrackets=null),x&&(O(z(x,"pairs")),b.state.closeBrackets=x,b.addKeyMap(F))});function z(b,x){return x=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[x]!=null?b[x]:H[x]}var F={Backspace:P,Enter:C};function O(b){for(var x=0;x<b.length;x++){var l=b.charAt(x),a="'"+l+"'";F[a]||(F[a]=B(l))}}O(H.pairs+"`");function B(b){return function(x){return p(x,b)}}function N(b){var x=b.state.closeBrackets;if(!x||x.override)return x;var l=b.getModeAt(b.getCursor());return l.closeBrackets||x}function P(b){var x=N(b);if(!x||b.getOption("disableInput"))return J.Pass;for(var l=z(x,"pairs"),a=b.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return J.Pass;var u=R(b,a[s].head);if(!u||l.indexOf(u)%2!=0)return J.Pass}for(var s=a.length-1;s>=0;s--){var A=a[s].head;b.replaceRange("",L(A.line,A.ch-1),L(A.line,A.ch+1),"+delete")}}function C(b){var x=N(b),l=x&&z(x,"explode");if(!l||b.getOption("disableInput"))return J.Pass;for(var a=b.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return J.Pass;var u=R(b,a[s].head);if(!u||l.indexOf(u)%2!=0)return J.Pass}b.operation(function(){var A=b.lineSeparator()||`
|
|
`;b.replaceSelection(A+A,null),b.execCommand("goCharLeft"),a=b.listSelections();for(var v=0;v<a.length;v++){var g=a[v].head.line;b.indentLine(g,null,!0),b.indentLine(g+1,null,!0)}})}function c(b){var x=J.cmpPos(b.anchor,b.head)>0;return{anchor:new L(b.anchor.line,b.anchor.ch+(x?-1:1)),head:new L(b.head.line,b.head.ch+(x?1:-1))}}function p(b,x){var l=N(b);if(!l||b.getOption("disableInput"))return J.Pass;var a=z(l,"pairs"),s=a.indexOf(x);if(s==-1)return J.Pass;for(var u=z(l,"closeBefore"),A=z(l,"triples"),v=a.charAt(s+1)==x,g=b.listSelections(),D=s%2==0,T,f=0;f<g.length;f++){var h=g[f],d=h.head,o,E=b.getRange(d,L(d.line,d.ch+1));if(D&&!h.empty())o="surround";else if((v||!D)&&E==x)v&&w(b,d)?o="both":A.indexOf(x)>=0&&b.getRange(d,L(d.line,d.ch+3))==x+x+x?o="skipThree":o="skip";else if(v&&d.ch>1&&A.indexOf(x)>=0&&b.getRange(L(d.line,d.ch-2),d)==x+x){if(d.ch>2&&/\bstring/.test(b.getTokenTypeAt(L(d.line,d.ch-2))))return J.Pass;o="addFour"}else if(v){var y=d.ch==0?" ":b.getRange(L(d.line,d.ch-1),d);if(!J.isWordChar(E)&&y!=x&&!J.isWordChar(y))o="both";else return J.Pass}else if(D&&(E.length===0||/\s/.test(E)||u.indexOf(E)>-1))o="both";else return J.Pass;if(!T)T=o;else if(T!=o)return J.Pass}var m=s%2?a.charAt(s-1):x,k=s%2?x:a.charAt(s+1);b.operation(function(){if(T=="skip")b.execCommand("goCharRight");else if(T=="skipThree")for(var I=0;I<3;I++)b.execCommand("goCharRight");else if(T=="surround"){for(var U=b.getSelections(),I=0;I<U.length;I++)U[I]=m+U[I]+k;b.replaceSelections(U,"around"),U=b.listSelections().slice();for(var I=0;I<U.length;I++)U[I]=c(U[I]);b.setSelections(U)}else T=="both"?(b.replaceSelection(m+k,null),b.triggerElectric(m+k),b.execCommand("goCharLeft")):T=="addFour"&&(b.replaceSelection(m+m+m+m,"before"),b.execCommand("goCharRight"))})}function R(b,x){var l=b.getRange(L(x.line,x.ch-1),L(x.line,x.ch+1));return l.length==2?l:null}function w(b,x){var l=b.getTokenAt(L(x.line,x.ch+1));return/\bstring/.test(l.type)&&l.start==x.ch&&(x.ch==0||!/\bstring/.test(b.getTokenTypeAt(x)))}})},GfqC:function(nt,ze,re){"use strict";var J=re("cDcd"),H=re.n(J),L=re("TSYQ"),z=re.n(L);function F(W,_){var M="cannot "+W.method+" "+W.action+" "+_.status+"'",K=new Error(M);return K.status=_.status,K.method=W.method,K.url=W.action,K}function O(W){var _=W.responseText||W.response;if(!_)return _;try{return JSON.parse(_)}catch(M){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 M=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var q=W.data[Y];if(Array.isArray(q)){q.forEach(function(oe){M.append(Y+"[]",oe)});return}M.append(Y,W.data[Y])}),W.file instanceof Blob?M.append(W.filename,W.file,W.file.name):M.append(W.filename,W.file),_.onerror=function(q){W.onError(q)},_.onload=function(){return _.status<200||_.status>=300?W.onError(F(W,_),O(_)):W.onSuccess(O(_),_)},_.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(M),{abort:function(){_.abort()}}}var N=+new Date,P=0;function C(){return"rc-upload-"+N+"-"+ ++P}function c(W,_){return W.indexOf(_,W.length-_.length)!==-1}var p=function(W,_){if(W&&_){var M=Array.isArray(_)?_:_.split(","),K=W.name||"",Y=W.type||"",q=Y.replace(/\/.*$/,"");return M.some(function(oe){var be=oe.trim();return be.charAt(0)==="."?c(K.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?q===be.replace(/\/.*$/,""):Y===be})}return!0};function R(W,_){var M=W.createReader(),K=[];function Y(){M.readEntries(function(q){var oe=Array.prototype.slice.apply(q);K=K.concat(oe);var be=!oe.length;be?_(K):Y()})}Y()}var w=function(_,M,K){var Y=function q(oe,be){be=be||"",oe.isFile?oe.file(function(me){K(me)&&(oe.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),M([me]))}):oe.isDirectory&&R(oe,function(me){me.forEach(function(he){q(he,""+be+oe.name+"/")})})};_.forEach(function(q){Y(q.webkitGetAsEntry())})},b=w,x=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var K in M)Object.prototype.hasOwnProperty.call(M,K)&&(W[K]=M[K])}return W},l=function(){function W(_,M){var K=[],Y=!0,q=!1,oe=void 0;try{for(var be=_[Symbol.iterator](),me;!(Y=(me=be.next()).done)&&!(K.push(me.value),M&&K.length===M);Y=!0);}catch(he){q=!0,oe=he}finally{try{!Y&&be.return&&be.return()}finally{if(q)throw oe}}return K}return function(_,M){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return W(_,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function W(_,M){for(var K=0;K<M.length;K++){var Y=M[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,M,K){return M&&W(_.prototype,M),K&&W(_,K),_}}();function s(W,_,M){return _ in W?Object.defineProperty(W,_,{value:M,enumerable:!0,configurable:!0,writable:!0}):W[_]=M,W}function u(W,_){var M={};for(var K in W){if(_.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;M[K]=W[K]}return M}function A(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function v(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function g(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 D=function(_){return Object.keys(_).reduce(function(M,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(M[K]=_[K]),M},{})},T=function(W){g(_,W);function _(){var M,K,Y,q;A(this,_);for(var oe=arguments.length,be=Array(oe),me=0;me<oe;me++)be[me]=arguments[me];return q=(K=(Y=v(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(be))),Y),Y.state={uid:C()},Y.reqs={},Y.onChange=function(he){var fe=he.target.files;Y.uploadFiles(fe),Y.reset()},Y.onClick=function(he){var fe=Y.fileInput;if(!fe)return;var ue=Y.props,ie=ue.children,pe=ue.onClick;ie&&ie.type==="button"&&(fe.parentNode.focus(),fe.parentNode.querySelector("button").blur()),fe.click(),pe&&pe(he)},Y.onKeyDown=function(he){he.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(he){var fe=Y.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(Y.props.directory)b(Array.prototype.slice.call(he.dataTransfer.items),Y.uploadFiles,function(ie){return p(ie,Y.props.accept)});else{var ue=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ie){return p(ie,Y.props.accept)});fe===!1&&(ue=ue.slice(0,1)),Y.uploadFiles(ue)}},Y.uploadFiles=function(he){var fe=Array.prototype.slice.call(he);fe.map(function(ue){return ue.uid=C(),ue}).forEach(function(ue){Y.upload(ue,fe)})},Y.saveFileInput=function(he){Y.fileInput=he},K),v(Y,q)}return a(_,[{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,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return q.post(K)},0);var be=oe.beforeUpload(K,Y);be&&be.then?be.then(function(me){var he=Object.prototype.toString.call(me);return he==="[object File]"||he==="[object Blob]"?q.post(me):q.post(K)}).catch(function(me){console.log(me)}):be!==!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,oe=q.onStart,be=q.onProgress,me=q.transformFile,he=me===void 0?function(fe){return fe}:me;new Promise(function(fe){var ue=q.action;return typeof ue=="function"&&(ue=ue(K)),fe(ue)}).then(function(fe){var ue=K.uid,ie=q.customRequest||B,pe=Promise.resolve(he(K)).then(function($){var ae=q.data;return typeof ae=="function"&&(ae=ae($)),Promise.all([$,ae])}).catch(function($){console.error($)});pe.then(function($){var ae=l($,2),ee=ae[0],Ee=ae[1],Ce={action:fe,filename:q.name,data:Ee,file:ee,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:be?function(ve){be(ve,K)}:null,onSuccess:function(Se,Re){delete Y.reqs[ue],q.onSuccess(Se,K,Re)},onError:function(Se,Re){delete Y.reqs[ue],q.onError(Se,Re,K)}};oe(K),Y.reqs[ue]=ie(Ce)})})}},{key:"reset",value:function(){this.setState({uid:C()})}},{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(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var K,Y=this.props,q=Y.component,oe=Y.prefixCls,be=Y.className,me=Y.disabled,he=Y.id,fe=Y.style,ue=Y.multiple,ie=Y.accept,pe=Y.children,$=Y.directory,ae=Y.openFileDialogOnClick,ee=Y.onMouseEnter,Ee=Y.onMouseLeave,Ce=u(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ve=z()((K={},s(K,oe,!0),s(K,oe+"-disabled",me),s(K,be,be),K)),Se=me?{}:{onClick:ae?this.onClick:function(){},onKeyDown:ae?this.onKeyDown:function(){},onMouseEnter:ee,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return H.a.createElement(q,x({},Se,{className:ve,role:"button",style:fe}),H.a.createElement("input",x({},D(Ce),{id:he,type:"file",ref:this.saveFileInput,onClick:function(Ne){return Ne.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:ue,onChange:this.onChange})),pe)}}]),_}(J.Component),f=T,h=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var K in M)Object.prototype.hasOwnProperty.call(M,K)&&(W[K]=M[K])}return W},d=function(){function W(_,M){for(var K=0;K<M.length;K++){var Y=M[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(_,Y.key,Y)}}return function(_,M,K){return M&&W(_.prototype,M),K&&W(_,K),_}}();function o(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function E(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function y(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 m(){}var k=function(W){y(_,W);function _(){var M,K,Y,q;o(this,_);for(var oe=arguments.length,be=Array(oe),me=0;me<oe;me++)be[me]=arguments[me];return q=(K=(Y=E(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(be))),Y),Y.saveUploader=function(he){Y.uploader=he},K),E(Y,q)}return d(_,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return H.a.createElement(f,h({},this.props,{ref:this.saveUploader}))}}]),_}(J.Component);k.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:m,onError:m,onSuccess:m,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var I=k,U=ze.a=I},Gytx:function(nt,ze){nt.exports=function(J,H,L,z){var F=L?L.call(z,J,H):void 0;if(F!==void 0)return!!F;if(J===H)return!0;if(typeof J!="object"||!J||typeof H!="object"||!H)return!1;var O=Object.keys(J),B=Object.keys(H);if(O.length!==B.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind(H),P=0;P<O.length;P++){var C=O[P];if(!N(C))return!1;var c=J[C],p=H[C];if(F=L?L.call(z,c,p,C):void 0,F===!1||F===void 0&&c!==p)return!1}return!0}},H38U:function(nt,ze,re){var J=re("f4xo"),H=re("rcnY"),L=re("wU8J"),z=re("Iq15"),F=re("dWSS");function O(N,P){this.typeNumber=N,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var B=O.prototype;B.addData=function(N){var P=new J(N);this.dataList.push(P),this.dataCache=null},B.isDark=function(N,P){if(N<0||this.moduleCount<=N||P<0||this.moduleCount<=P)throw new Error(N+","+P);return this.modules[N][P]},B.getModuleCount=function(){return this.moduleCount},B.make=function(){if(this.typeNumber<1){var N=1;for(N=1;N<40;N++){for(var P=H.getRSBlocks(N,this.errorCorrectLevel),C=new L,c=0,p=0;p<P.length;p++)c+=P[p].dataCount;for(var p=0;p<this.dataList.length;p++){var R=this.dataList[p];C.put(R.mode,4),C.put(R.getLength(),z.getLengthInBits(R.mode,N)),R.write(C)}if(C.getLengthInBits()<=c*8)break}this.typeNumber=N}this.makeImpl(!1,this.getBestMaskPattern())},B.makeImpl=function(N,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var C=0;C<this.moduleCount;C++){this.modules[C]=new Array(this.moduleCount);for(var c=0;c<this.moduleCount;c++)this.modules[C][c]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(N,P),this.typeNumber>=7&&this.setupTypeNumber(N),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},B.setupPositionProbePattern=function(N,P){for(var C=-1;C<=7;C++){if(N+C<=-1||this.moduleCount<=N+C)continue;for(var c=-1;c<=7;c++){if(P+c<=-1||this.moduleCount<=P+c)continue;0<=C&&C<=6&&(c==0||c==6)||0<=c&&c<=6&&(C==0||C==6)||2<=C&&C<=4&&2<=c&&c<=4?this.modules[N+C][P+c]=!0:this.modules[N+C][P+c]=!1}}},B.getBestMaskPattern=function(){for(var N=0,P=0,C=0;C<8;C++){this.makeImpl(!0,C);var c=z.getLostPoint(this);(C==0||N>c)&&(N=c,P=C)}return P},B.createMovieClip=function(N,P,C){var c=N.createEmptyMovieClip(P,C),p=1;this.make();for(var R=0;R<this.modules.length;R++)for(var w=R*p,b=0;b<this.modules[R].length;b++){var x=b*p,l=this.modules[R][b];l&&(c.beginFill(0,100),c.moveTo(x,w),c.lineTo(x+p,w),c.lineTo(x+p,w+p),c.lineTo(x,w+p),c.endFill())}return c},B.setupTimingPattern=function(){for(var N=8;N<this.moduleCount-8;N++){if(this.modules[N][6]!=null)continue;this.modules[N][6]=N%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},B.setupPositionAdjustPattern=function(){for(var N=z.getPatternPosition(this.typeNumber),P=0;P<N.length;P++)for(var C=0;C<N.length;C++){var c=N[P],p=N[C];if(this.modules[c][p]!=null)continue;for(var R=-2;R<=2;R++)for(var w=-2;w<=2;w++)R==-2||R==2||w==-2||w==2||R==0&&w==0?this.modules[c+R][p+w]=!0:this.modules[c+R][p+w]=!1}},B.setupTypeNumber=function(N){for(var P=z.getBCHTypeNumber(this.typeNumber),C=0;C<18;C++){var c=!N&&(P>>C&1)==1;this.modules[Math.floor(C/3)][C%3+this.moduleCount-8-3]=c}for(var C=0;C<18;C++){var c=!N&&(P>>C&1)==1;this.modules[C%3+this.moduleCount-8-3][Math.floor(C/3)]=c}},B.setupTypeInfo=function(N,P){for(var C=this.errorCorrectLevel<<3|P,c=z.getBCHTypeInfo(C),p=0;p<15;p++){var R=!N&&(c>>p&1)==1;p<6?this.modules[p][8]=R:p<8?this.modules[p+1][8]=R:this.modules[this.moduleCount-15+p][8]=R}for(var p=0;p<15;p++){var R=!N&&(c>>p&1)==1;p<8?this.modules[8][this.moduleCount-p-1]=R:p<9?this.modules[8][15-p-1+1]=R:this.modules[8][15-p-1]=R}this.modules[this.moduleCount-8][8]=!N},B.mapData=function(N,P){for(var C=-1,c=this.moduleCount-1,p=7,R=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var b=0;b<2;b++)if(this.modules[c][w-b]==null){var x=!1;R<N.length&&(x=(N[R]>>>p&1)==1);var l=z.getMask(P,c,w-b);l&&(x=!x),this.modules[c][w-b]=x,p--,p==-1&&(R++,p=7)}if(c+=C,c<0||this.moduleCount<=c){c-=C,C=-C;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(N,P,C){for(var c=H.getRSBlocks(N,P),p=new L,R=0;R<C.length;R++){var w=C[R];p.put(w.mode,4),p.put(w.getLength(),z.getLengthInBits(w.mode,N)),w.write(p)}for(var b=0,R=0;R<c.length;R++)b+=c[R].dataCount;if(p.getLengthInBits()>b*8)throw new Error("code length overflow. ("+p.getLengthInBits()+">"+b*8+")");for(p.getLengthInBits()+4<=b*8&&p.put(0,4);p.getLengthInBits()%8!=0;)p.putBit(!1);for(;!(p.getLengthInBits()>=b*8);){if(p.put(O.PAD0,8),p.getLengthInBits()>=b*8)break;p.put(O.PAD1,8)}return O.createBytes(p,c)},O.createBytes=function(N,P){for(var C=0,c=0,p=0,R=new Array(P.length),w=new Array(P.length),b=0;b<P.length;b++){var x=P[b].dataCount,l=P[b].totalCount-x;c=Math.max(c,x),p=Math.max(p,l),R[b]=new Array(x);for(var a=0;a<R[b].length;a++)R[b][a]=255&N.buffer[a+C];C+=x;var s=z.getErrorCorrectPolynomial(l),u=new F(R[b],s.getLength()-1),A=u.mod(s);w[b]=new Array(s.getLength()-1);for(var a=0;a<w[b].length;a++){var v=a+A.getLength()-w[b].length;w[b][a]=v>=0?A.get(v):0}}for(var g=0,a=0;a<P.length;a++)g+=P[a].totalCount;for(var D=new Array(g),T=0,a=0;a<c;a++)for(var b=0;b<P.length;b++)a<R[b].length&&(D[T++]=R[b][a]);for(var a=0;a<p;a++)for(var b=0;b<P.length;b++)a<w[b].length&&(D[T++]=w[b][a]);return D},nt.exports=O},HmJG:function(nt,ze,re){},Iq15:function(nt,ze,re){var J=re("nVVt"),H=re("dWSS"),L=re("dQei"),z={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},F={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var B=O<<10;F.getBCHDigit(B)-F.getBCHDigit(F.G15)>=0;)B^=F.G15<<F.getBCHDigit(B)-F.getBCHDigit(F.G15);return(O<<10|B)^F.G15_MASK},getBCHTypeNumber:function(O){for(var B=O<<12;F.getBCHDigit(B)-F.getBCHDigit(F.G18)>=0;)B^=F.G18<<F.getBCHDigit(B)-F.getBCHDigit(F.G18);return O<<12|B},getBCHDigit:function(O){for(var B=0;O!=0;)B++,O>>>=1;return B},getPatternPosition:function(O){return F.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,B,N){switch(O){case z.PATTERN000:return(B+N)%2==0;case z.PATTERN001:return B%2==0;case z.PATTERN010:return N%3==0;case z.PATTERN011:return(B+N)%3==0;case z.PATTERN100:return(Math.floor(B/2)+Math.floor(N/3))%2==0;case z.PATTERN101:return B*N%2+B*N%3==0;case z.PATTERN110:return(B*N%2+B*N%3)%2==0;case z.PATTERN111:return(B*N%3+(B+N)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var B=new H([1],0),N=0;N<O;N++)B=B.multiply(new H([1,L.gexp(N)],0));return B},getLengthInBits:function(O,B){if(1<=B&&B<10)switch(O){case J.MODE_NUMBER:return 10;case J.MODE_ALPHA_NUM:return 9;case J.MODE_8BIT_BYTE:return 8;case J.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(B<27)switch(O){case J.MODE_NUMBER:return 12;case J.MODE_ALPHA_NUM:return 11;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(B<41)switch(O){case J.MODE_NUMBER:return 14;case J.MODE_ALPHA_NUM:return 13;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+B)},getLostPoint:function(O){for(var B=O.getModuleCount(),N=0,P=0;P<B;P++)for(var C=0;C<B;C++){for(var c=0,p=O.isDark(P,C),R=-1;R<=1;R++){if(P+R<0||B<=P+R)continue;for(var w=-1;w<=1;w++){if(C+w<0||B<=C+w)continue;if(R==0&&w==0)continue;p==O.isDark(P+R,C+w)&&c++}}c>5&&(N+=3+c-5)}for(var P=0;P<B-1;P++)for(var C=0;C<B-1;C++){var b=0;O.isDark(P,C)&&b++,O.isDark(P+1,C)&&b++,O.isDark(P,C+1)&&b++,O.isDark(P+1,C+1)&&b++,(b==0||b==4)&&(N+=3)}for(var P=0;P<B;P++)for(var C=0;C<B-6;C++)O.isDark(P,C)&&!O.isDark(P,C+1)&&O.isDark(P,C+2)&&O.isDark(P,C+3)&&O.isDark(P,C+4)&&!O.isDark(P,C+5)&&O.isDark(P,C+6)&&(N+=40);for(var C=0;C<B;C++)for(var P=0;P<B-6;P++)O.isDark(P,C)&&!O.isDark(P+1,C)&&O.isDark(P+2,C)&&O.isDark(P+3,C)&&O.isDark(P+4,C)&&!O.isDark(P+5,C)&&O.isDark(P+6,C)&&(N+=40);for(var x=0,C=0;C<B;C++)for(var P=0;P<B;P++)O.isDark(P,C)&&x++;var l=Math.abs(100*x/B/B-50)/5;return N+=l*10,N}};nt.exports=F},LdHM:function(nt,ze,re){"use strict";re.d(ze,"b",function(){return u}),re.d(ze,"a",function(){return v});var J=re("1OyB"),H=re("vuIU"),L=re("Ji7U"),z=re("LK+K"),F=re("cDcd"),O=re("rePB"),B=re("Ff2n"),N=re("ODXe"),P=re("4IlW"),C=re("bX4T"),c=re("YrtM"),p=re("TSYQ"),R=re.n(p),w=re("+nKL"),b=re("8OUc"),x=function(K,Y){var q=K.prefixCls,oe=K.id,be=K.flattenOptions,me=K.childrenAsData,he=K.values,fe=K.searchValue,ue=K.multiple,ie=K.defaultActiveFirstOption,pe=K.height,$=K.itemHeight,ae=K.notFoundContent,ee=K.open,Ee=K.menuItemSelectedIcon,Ce=K.virtual,ve=K.onSelect,Se=K.onToggleOpen,Re=K.onActiveValue,Ne=K.onScroll,_e=K.onMouseEnter,Pe="".concat(q,"-item"),ke=Object(c.a)(function(){return be},[ee,be],function(Me,ge){return ge[0]&&Me[1]!==ge[1]}),Ze=F.useRef(null),Ge=function(ge){ge.preventDefault()},Ve=function(ge){Ze.current&&Ze.current.scrollTo({index:ge})},We=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=ke.length,Q=0;Q<ce;Q+=1){var Z=(ge+Q*de+ce)%ce,te=ke[Z],se=te.group,Te=te.data;if(!se&&!Te.disabled)return Z}return-1},rt=F.useState(function(){return We(0)}),Xe=Object(N.a)(rt,2),$e=Xe[0],we=Xe[1],qe=function(ge){we(ge);var de=ke[ge];if(!de){Re(null,-1);return}Re(de.data.value,ge)};F.useEffect(function(){qe(ie!==!1?We(0):-1)},[ke.length,fe]),F.useEffect(function(){var Me=setTimeout(function(){if(!ue&&ee&&he.size===1){var ge=Array.from(he)[0],de=ke.findIndex(function(ce){var Q=ce.data;return Q.value===ge});qe(de),Ve(de)}});return function(){return clearTimeout(Me)}},[ee]);var Ye=function(ge){ge!==void 0&&ve(ge,{selected:!he.has(ge)}),ue||Se(!1)};if(F.useImperativeHandle(Y,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case P.a.UP:case P.a.DOWN:{var ce=0;if(de===P.a.UP?ce=-1:de===P.a.DOWN&&(ce=1),ce!==0){var Q=We($e+ce,ce);Ve(Q),qe(Q)}break}case P.a.ENTER:{var Z=ke[$e];Z&&!Z.data.disabled?Ye(Z.data.value):Ye(void 0),ee&&ge.preventDefault();break}case P.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(ge){Ve(ge)}}}),ke.length===0)return F.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Pe,"-empty"),onMouseDown:Ge},ae);function Ae(Me){var ge=ke[Me];if(!ge)return null;var de=ge.data||{},ce=de.value,Q=de.label,Z=de.children,te=Object(C.a)(de,!0),se=me?Z:Q;return ge?F.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},te,{key:Me,role:"option",id:"".concat(oe,"_list_").concat(Me),"aria-selected":he.has(ce)}),ce):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ae($e-1),Ae($e),Ae($e+1)),F.createElement(w.a,{itemKey:"key",ref:Ze,data:ke,height:pe,itemHeight:$,fullHeight:!1,onMouseDown:Ge,onScroll:Ne,virtual:Ce,onMouseEnter:_e},function(Me,ge){var de,ce=Me.group,Q=Me.groupOption,Z=Me.data,te=Z.label,se=Z.key;if(ce)return F.createElement("div",{className:R()(Pe,"".concat(Pe,"-group"))},te!==void 0?te:se);var Te=Z.disabled,De=Z.value,Be=Z.title,et=Z.children,ut=Z.style,Le=Z.className,ht=Object(B.a)(Z,["disabled","value","title","children","style","className"]),it=he.has(De),Qe="".concat(Pe,"-option"),vt=R()(Pe,Qe,Le,(de={},Object(O.a)(de,"".concat(Qe,"-grouped"),Q),Object(O.a)(de,"".concat(Qe,"-active"),$e===ge&&!Te),Object(O.a)(de,"".concat(Qe,"-disabled"),Te),Object(O.a)(de,"".concat(Qe,"-selected"),it),de)),xt=me?et:te,yt=!Ee||typeof Ee=="function"||it;return F.createElement("div",Object.assign({},ht,{"aria-selected":it,className:vt,title:Be,onMouseMove:function(){if($e===ge||Te)return;qe(ge)},onClick:function(){Te||Ye(De)},style:ut}),F.createElement("div",{className:"".concat(Qe,"-content")},xt||De),F.isValidElement(Ee)||it,yt&&F.createElement(b.a,{className:"".concat(Pe,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:it}},it?"\u2713":null))}))},l=F.forwardRef(x);l.displayName="OptionList";var a=l,s=function(){return null};s.isSelectOption=!0;var u=s,A=function(){return null};A.isSelectOptGroup=!0;var v=A,g=re("VTBJ"),D=re("Zm9Q");function T(M){var K=M.key,Y=M.props,q=Y.children,oe=Y.value,be=Object(B.a)(Y,["children","value"]);return Object(g.a)({key:K,value:oe!==void 0?oe:K,children:q},be)}function f(M){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(M).map(function(Y,q){if(!F.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,be=Y.key,me=Y.props,he=me.children,fe=Object(B.a)(me,["children"]);return K||!oe?T(Y):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(be===null?q:be,"__"),label:be},fe),{},{options:f(he)})}).filter(function(Y){return Y})}var h=re("2Qr1"),d=re("qNPg"),o=re("U8pU"),E=re("Kwbf"),y=re("WKfj");function m(M){var K=M.mode,Y=M.options,q=M.children,oe=M.backfill,be=M.allowClear,me=M.placeholder,he=M.getInputElement,fe=M.showSearch,ue=M.onSearch,ie=M.defaultOpen,pe=M.autoFocus,$=M.labelInValue,ae=M.value,ee=M.inputValue,Ee=M.optionLabelProp,Ce=K==="multiple"||K==="tags",ve=fe!==void 0?fe:Ce||K==="combobox",Se=Y||f(q);if(Object(E.a)(K!=="tags"||Se.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 Re=Se.some(function(Pe){return Pe.options?Pe.options.some(function(ke){return typeof("value"in ke?ke.value:ke.key)=="number"}):typeof("value"in Pe?Pe.value:Pe.key)=="number"});Object(E.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(K!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(K==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(E.a)(K==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(E.b)(K!=="combobox"||!he||!be||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ue&&!ve&&K!=="combobox"&&K!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!ie||pe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var Ne=Object(y.d)(ae);Object(E.a)(!$||Ne.every(function(Pe){return Object(o.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(E.a)(!Ce||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var _e=null;Object(D.a)(q).some(function(Pe){if(!F.isValidElement(Pe)||!Pe.type)return!1;var ke=Pe.type;if(ke.isSelectOption)return!1;if(ke.isSelectOptGroup){var Ze=Object(D.a)(Pe.props.children).every(function(Ge){return!F.isValidElement(Ge)||!Pe.type||Ge.type.isSelectOption?!0:(_e=Ge.type,!1)});return!Ze}return _e=ke,!0}),_e&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_e.displayName||_e.name||_e,"`.")),Object(E.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=m,I=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:k,fillOptionsWithMissingValue:h.a}),U=function(M){Object(L.a)(Y,M);var K=Object(z.a)(Y);function Y(){var q;return Object(J.a)(this,Y),q=K.apply(this,arguments),q.selectRef=F.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(H.a)(Y,[{key:"render",value:function(){return F.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),Y}(F.Component);U.Option=u,U.OptGroup=v;var W=U,_=ze.c=W},M8RZ:function(nt,ze,re){"use strict";re.d(ze,"a",function(){return P});var J=re("fWQN"),H=re("mtLc"),L=re("yKVA"),z=re("879j"),F=re("cDcd"),O=re.n(F),B=re("faye"),N=re.n(B),P=function(C){Object(L.a)(p,C);var c=Object(z.a)(p);function p(R){var w;Object(J.a)(this,p),w=c.call(this,R);var b=window.document;return w.node=b.createElement("div"),b.body.appendChild(w.node),w}return Object(H.a)(p,[{key:"render",value:function(){var w=this.props.children;return Object(B.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(O.a.Component)},OLES:function(nt,ze,re){"use strict";var J=re("U8pU"),H=re("VTBJ"),L=re("Ff2n"),z=re("cDcd"),F=re("uciX"),O=re("7ixt"),B=function(R){var w=R.overlay,b=R.prefixCls,x=R.id,l=R.overlayInnerStyle;return z.createElement("div",{className:"".concat(b,"-inner"),id:x,role:"tooltip",style:l},typeof w=="function"?w():w)},N=B,P=function(R,w){var b=R.overlayClassName,x=R.trigger,l=x===void 0?["hover"]:x,a=R.mouseEnterDelay,s=a===void 0?0:a,u=R.mouseLeaveDelay,A=u===void 0?.1:u,v=R.overlayStyle,g=R.prefixCls,D=g===void 0?"rc-tooltip":g,T=R.children,f=R.onVisibleChange,h=R.afterVisibleChange,d=R.transitionName,o=R.animation,E=R.placement,y=E===void 0?"right":E,m=R.align,k=m===void 0?{}:m,I=R.destroyTooltipOnHide,U=I===void 0?!1:I,W=R.defaultVisible,_=R.getTooltipContainer,M=R.overlayInnerStyle,K=Object(L.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Y=Object(z.useRef)(null);Object(z.useImperativeHandle)(w,function(){return Y.current});var q=Object(H.a)({},K);"visible"in R&&(q.popupVisible=R.visible);var oe=function(){var ue=R.arrowContent,ie=ue===void 0?null:ue,pe=R.overlay,$=R.id;return[z.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},ie),z.createElement(N,{key:"content",prefixCls:D,id:$,overlay:pe,overlayInnerStyle:M})]},be=!1,me=!1;if(typeof U=="boolean")be=U;else if(U&&Object(J.a)(U)==="object"){var he=U.keepParent;be=he===!0,me=he===!1}return z.createElement(F.a,Object.assign({popupClassName:b,prefixCls:D,popup:oe,action:l,builtinPlacements:O.a,popupPlacement:y,ref:Y,popupAlign:k,getPopupContainer:_,onPopupVisibleChange:f,afterPopupVisibleChange:h,popupTransitionName:d,popupAnimation:o,defaultPopupVisible:W,destroyPopupOnHide:be,autoDestroy:me,mouseLeaveDelay:A,popupStyle:v,mouseEnterDelay:s},q),T)},C=Object(z.forwardRef)(P),c=ze.a=C},Ot1p:function(nt,ze,re){"use strict";var J=re("2qtc"),H=re("kLXV"),L=re("rAM+"),z=re("miYZ"),F=re("tsqr"),O=re("9og8"),B=re("tJVT"),N=re("jrin"),P=re("WmNS"),C=re.n(P),c=re("cDcd"),p=re.n(c),R=re("VrN/"),w=re.n(R),b=re("bdgK"),x=re("p77/"),l=re("Bd2K"),a=re("ELLl"),s=re("19Vz"),u=re("lZu9"),A=re("+NIl"),v=re("kSUc"),g=re("9Bee"),D=function(Le){var ht=Le.value,it=ht===void 0?"":ht,Qe=Le.className,vt=Le.showTextOnly,xt=Le.showLines,yt=Le.style,St=yt===void 0?{}:yt,mt=Object(c.useMemo)(function(){return""},[it]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:mt}}))},T=re("Q9mQ"),f=re("diRs"),h=re("0Owb"),d=re("dejd"),o=re("C+DQ"),E=re("D1Df"),y=re.n(E),m=re("1vsH"),k=re("m3rI"),I=[{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 U(Le){var ht=Le.onActionCallback,it=Le.title,Qe=Le.icon,vt=Le.actionName,xt=Le.className,yt=xt===void 0?"":xt,St=Le.children;function mt(){ht(vt)}return p.a.createElement("a",{title:it,className:yt,onClick:mt},p.a.createElement("i",{className:"md-iconfont ".concat(Qe)}),St)}var W=function(Le){var ht=Le.watch,it=Le.showNullButton,Qe=Le.onActionCallback,vt=Le.fullScreen,xt=Le.insertTemp,yt=Le.hidetoolBar,St=Le.uuid,mt=Le.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(m.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.G)("_educoder_session"),"&key=").concat(St,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER)));var Yt=[].concat(I,[{title:"".concat(ht?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ht?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!yt&&Yt.map(function(Kt,Ut){return p.a.createElement("li",{key:Ut},Kt.actionName?p.a.createElement(U,Object(h.a)({},Kt,{onActionCallback:Qe})):p.a.createElement("span",{className:"v-line"}))}),it?p.a.createElement("li",null,p.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Qe},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,xt&&p.a.createElement("li",null,p.a.createElement(U,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(xt),onActionCallback:Qe},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",null,p.a.createElement(f.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:p.a.createElement("div",null,p.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(m.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.G)("_educoder_session"),"&key=").concat(St,"&api=").concat(encodeURIComponent(k.a.PROXY_SERVER))}))},p.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return mt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(U,{icon:"".concat(vt?"icon-shrink":"icon-enlarge"),title:vt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Qe})))},_=re("M8RZ"),M=re("+L6B"),K=re("2/Rp"),Y=re("y8nQ"),q=re("Vl3Y"),oe=re("5NDa"),be=re("5rEg"),me={labelCol:{span:4},wrapperCol:{span:20}},he=function(Le){var ht=Le.callback,it=Le.onCancel;function Qe(vt){ht(vt)}return p.a.createElement(q.a,Object(h.a)({},me,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Qe}),p.a.createElement(q.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(be.a,null)),p.a.createElement(q.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(be.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},fe=re("7ahc"),ue=re("k1fw"),ie=re("HmJG"),pe=re("BjJ7"),$=q.a.useForm,ae={width:280,marginRight:10},ee={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Le){var ht=Le.callback,it=Le.onCancel,Qe=$(),vt=Object(B.a)(Qe,1),xt=vt[0],yt=useRef();function St(Kt){ht(Object(ue.a)(Object(ue.a)({},Kt),{},{name:yt.current}))}function mt(Kt,Ut){if(Kt.status===-1){F.b.error(Kt.message);return}xt.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ut.type})}function Yt(Kt){var Ut=Kt.target.files[0];yt.current=Ut.name,ve(Ut,mt)}return p.a.createElement(q.a,Object(h.a)({form:xt},ee,{className:"upload-image-panel",onFinish:St}),p.a.createElement(q.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(q.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},p.a.createElement(be.a,{style:ae})),p.a.createElement(Ce,{onFileChange:Yt}))),p.a.createElement(q.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(be.a,{style:{width:264}})),p.a.createElement(q.a.Item,{style:{textAlign:"right"}},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function Ce(Le){var ht=Le.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:ht}))}function ve(Le,ht){if(!Le)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",Le),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var Qe=new window.XMLHttpRequest;Qe.withCredentials=!0,Qe.addEventListener("load",function(vt){ht(JSON.parse(vt.target.responseText),Le)},!1),Qe.addEventListener("error",function(vt){console.error(vt)},!1),Qe.open("POST","".concat(pe.a,"/api/attachments.json")),Qe.send(it)}var Se=re("giR+"),Re=re("fyUT"),Ne=re("7Kak"),_e=re("9yH6"),Pe=_e.a.Group,ke={margin:"0 8px"},Ze=function(Le){var ht=Le.callback,it=Le.onCancel;function Qe(vt){ht(vt)}return p.a.createElement(q.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Qe},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:ke},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:ke},"\u884C\u6570"),p.a.createElement(q.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(Re.a,null)),p.a.createElement("span",{style:ke},"\u5217\u6570"),p.a.createElement(q.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(Re.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:ke},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(q.a.Item,{name:"align"},p.a.createElement(Pe,null,p.a.createElement(_e.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(_e.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(_e.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(_e.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},Ge=re("ErOA"),Ve=re("7Cbv"),We="link",rt="upload-image",Xe="code-block",$e="add-table",we="------------",qe={default:we,left:":".concat(we),center:":".concat(we,":"),right:"".concat(we,":")},Ye=re("9VGf"),Ae,Me;function ge(){}var de=0,ce=1e4,Q="\u2581",Z=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function te(Le){return/^\d+$/.test(Le)?"".concat(Le,"px"):Le}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=se?"Cmd":"Ctrl",De=["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"],Be=(Ae={},Object(N.a)(Ae,Te+"-B","bold"),Object(N.a)(Ae,Te+"-I","italic"),Ae),et=(Me={},Object(N.a)(Me,We,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Me,Xe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Me,rt,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Me,$e,"\u6DFB\u52A0\u8868\u683C"),Me),ut=ze.a=function(Le){var ht=Le.defaultValue,it=ht===void 0?"":ht,Qe=Le.onChange,vt=Le.width,xt=vt===void 0?"100%":vt,yt=Le.height,St=yt===void 0?400:yt,mt=Le.miniToolbar,Yt=mt===void 0?!1:mt,Kt=Le.isFocus,Ut=Kt===void 0?!1:Kt,Tr=Le.watch,vr=Le.insertTemp,wi=Le.mode,pr=wi===void 0?"markdown":wi,vn=Le.id,Jr=vn===void 0?"markdown-editor-id":vn,Mt=Le.showResizeBar,ot=Mt===void 0?!1:Mt,Sr=Le.noStorage,Vn=Sr===void 0?!1:Sr,cr=Le.showNullButton,Ct=cr===void 0?!1:cr,wr=Le.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Le.fullScreen,Fe=yn===void 0?!1:yn,ct=Le.onBlur,qr=Le.onCMBeforeChange,en=Le.onFullScreen,tn=Le.className,bn=tn===void 0?"":tn,Xn=Le.disablePaste,pt=Xn===void 0?!1:Xn,Ci=Le.placeholder,Ai=Ci===void 0?"":Ci,rn=Le.values,sr=rn===void 0?"":rn,Li=Object(c.useState)(null),Yn=Object(B.a)(Li,2),Ue=Yn[0],$n=Yn[1],Di=Object(c.useState)(it),xn=Object(B.a)(Di,2),nn=xn[0],Nr=xn[1],Oi=Object(c.useState)(Tr),Qn=Object(B.a)(Oi,2),Or=Qn[0],Ri=Qn[1],ki=Object(c.useState)(Fe),mr=Object(B.a)(ki,2),Cr=mr[0],Pi=mr[1],En=Object(c.useState)(""),Fr=Object(B.a)(En,2),Ur=Fr[0],Br=Fr[1],aa=Object(c.useState)(0),Mi=Object(B.a)(aa,2),Rr=Mi[0],Tn=Mi[1],oa=Object(c.useState)(St),Jn=Object(B.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(c.useState)(!1),wn=Object(B.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(c.useRef)(Object(Ve.a)()),_i=Object(c.useRef)(!1),qn=Object(c.useRef)(),Qt=Object(c.useRef)(),jr=Object(c.useRef)(),An=Object(c.useRef)(),Wr=Object(c.useRef)(),Ii=function(){var at=Object(O.a)(C.a.mark(function ft(){var lt,bt;return C.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(Ge.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:bt=Rt.sent,bt!=null&&(lt=bt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",Ue,Qt),bt.attachments.map(function(Et){Et.content_type.indexOf("image")>-1?Ue.replaceSelection(".concat(Et.content_type,")")):Et.content_type.indexOf("video")>-1?Ue.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Et.content_type.indexOf("pdf")>-1?Ue.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Et.id,"?type=").concat(Et.content_type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):Ue.replaceSelection("[".concat(Et.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Et.id,"?type=").concat(Et.content_type,")"))}));case 4:case"end":return Rt.stop()}},ft)}));return function(){return at.apply(this,arguments)}}();Object(c.useEffect)(function(){Nr(sr),Ue==null||Ue.setValue(sr)},[sr]),Object(c.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(c.useEffect)(function(){if(Qt.current){var at=w.a.fromTextArea(Qt.current,{mode:pr,lineNumbers:!Yt,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Ut&&at.focus();function ft(lt,bt){if(pt){bt.preventDefault();return}var wt=bt.clipboardData;if(wt){var Rt=wt.types.toString(),Et=wt.items;if(Rt==="Files"||wt.types.indexOf("Files")>-1){if(bt.preventDefault(),pr=="stex")return;try{var It,Wt=Et[1];((It=Et[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=Et[0]);var Tt=Wt.getAsFile(),Pr=Tt.name.split(".").pop();ve(Tt,function(Lt){if(Lt.id){var qt,Ot,gr;(Tt==null||((qt=Tt.type)===null||qt===void 0)?void 0:qt.indexOf("image"))>-1?at.replaceSelection(".concat(Lt.content_type,")")):(Tt==null||((Ot=Tt.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(Tt==null||((gr=Tt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):De.includes(Pr)?at.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):at.replaceSelection("[".concat(Tt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})}catch(Lt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",ft),at.on("dragleave",function(lt,bt){jr.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(lt,bt){jr.current.classList.add("mouse-hover-md")}),at.on("drop",function(lt,bt){jr.current.classList.add("mouse-hover-md");var wt;if(wt=bt.dataTransfer.files,wt.length>0){bt.preventDefault(),bt.stopPropagation();for(var Rt=function(Wt){var Tt=wt[Wt],Pr=Tt.name.split(".").pop();ve(Tt,function(Lt){if(Lt.id){var qt,Ot,gr;(Tt==null||((qt=Tt.type)===null||qt===void 0)?void 0:qt.indexOf("image"))>-1?at.replaceSelection(".concat(Lt.content_type,")")):(Tt==null||((Ot=Tt.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(Tt==null||((gr=Tt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):De.includes(Pr)?at.replaceSelection('<a href="'.concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):at.replaceSelection("[".concat(Tt.name,"](").concat(k.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})},Et=0;Et<wt.length;Et++)Rt(Et)}}),$n(at),function(){at.off("paste",ft)}}},[]);var yr=Object(c.useCallback)(function(){if(jr.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(c.useEffect)(function(){function at(){var lt=new b.default(function(bt){var wt=Object(L.a)(bt),Rt;try{for(wt.s();!(Rt=wt.n()).done;){var Et=Rt.value;(Et.target.offsetHeight>0||Et.target.offsetWidth>0)&&(yr(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(It){wt.e(It)}finally{wt.f()}});return lt.observe(Qt.current.parentElement),lt}if(Ue){var ft=at();return function(){ft.unobserve(Qt.current.parentElement)}}},[Ue,yr]),Object(c.useEffect)(function(){if(Ue){for(var at=[],ft=function(){var Et=bt[lt];wt=Object(B.a)(Et,2);var It=wt[0],Wt=wt[1],Tt=Object(N.a)({},It,function(){Ln(Wt)});at.push(Tt),Ue.addKeyMap(Tt)},lt=0,bt=Object.entries(Be);lt<bt.length;lt++){var wt;ft()}return qn.current=setInterval(function(){_i.current&&Ii()},4e3),function(){clearInterval(qn.current);var Rt=Object(L.a)(at),Et;try{for(Rt.s();!(Et=Rt.n()).done;){var It=Et.value;Ue.removeKeyMap(It)}}catch(Wt){Rt.e(Wt)}finally{Rt.f()}}}},[Ue]),Object(c.useEffect)(function(){Fe!==Cr&&Pi(Fe)},[Fe]),Object(Ye.a)(function(){if(!Vn&&Rr>0){var at=new Date().getTime(),ft=window.sessionStorage.getItem(Jr);at>=Rr+ce&&(!ft||ft!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},ce),Object(c.useEffect)(function(){Ri(Tr)},[Ue,Tr]),Object(c.useEffect)(function(){Ue&&(Ut&&Ue.focus())},[Ue,Ut]),Object(c.useEffect)(function(){if(Or&&Ue){var at=Ue.getScrollerElement();function ft(lt){var bt=lt.target;if(Wr.current){var wt=bt.scrollTop/bt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*wt}}return at.addEventListener("scroll",ft),function(){at.removeEventListener("scroll",ft)}}},[Ue,Or]),Object(c.useEffect)(function(){if(Ue&&qr){function at(ft,lt){qr(ft,lt)}return Ue.on("beforeChange",at),function(){Ue.off("beforeChange",at)}}},[Ue,qr]),Object(c.useEffect)(function(){if(Ue&&ct){function at(){ct(Ue.getValue())}return Ue.on("blur",at),function(){Ue.off("blur",at)}}},[Ue,ct]),Object(c.useEffect)(function(){if(Ue){function at(ft){var lt=ft.getValue();Nr(lt),Tn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Qe&&Qe(lt)}return Ue.on("change",at),function(){Ue.off("change",at)}}},[Ue,Qe]),Object(c.useEffect)(function(){Ue&&(it==null?(Ue.setValue(""),Nr("")):it!==Ue.getValue()&&(Ue.setValue(it),Nr(it),Ue.setCursor(Ue.lineCount(),0)))},[Ue,it]);var Ln=Object(c.useCallback)(function(at){var ft=Ue.getCursor(),lt=Ue.getSelection(),bt=lt.split(`
|
|
`);switch(at){case"bold":return Ue.replaceSelection("**"+lt+"**"),lt===""&&Ue.setCursor(ft.line,ft.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+lt+"*"),lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+lt+"`"),lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+lt+"$$`"),lt===""&&Ue.setCursor(ft.line,ft.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+lt+"\n```"),Ue.setCursor(ft.line+1,lt.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`<br/>
|
|
`),Ue.focus();case"list-ul":return lt===""?Ue.replaceSelection("- "+lt):Ue.replaceSelection(bt.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
|
|
`)),Ue.focus();case"list-ol":return lt===""?Ue.replaceSelection("1. "+lt):Ue.replaceSelection(bt.map(function(wt,Rt){return wt===""?"":"".concat(Rt+1,". ").concat(wt)}).join(`
|
|
`)),Ue.focus();case"add-null-ch":return lt===""&&Ue.setCursor(ft.line,ft.ch+1),Ue.replaceSelection(Q),Ue.focus();case"inster-template-1":return lt===""&&Ue.setCursor(ft.line,ft.ch),Ue.replaceSelection(Z),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return Ri(!Or),Ue.focus();case"trigger-full-screen":return Pi(!Cr),Ue.focus();case We:Br(We);return;case Xe:Br(Xe);return;case rt:Br(rt);return;case $e:Br($e);return;default:throw new Error}},[Ue,Or,Cr]),lr=Object(c.useCallback)(function(at){Br("");switch(Ur){case We:var ft=at.title,lt=at.link;return Ue.replaceSelection("[".concat(ft,"](").concat(lt,")")),Ue.focus();case Xe:var bt=at.language,wt=at.content;return Ue.replaceSelection(["```"+bt,wt,"```"].join(`
|
|
`)),Ue.focus();case rt:var Rt=at.src,Et=at.alt;return Et?Ue.replaceSelection(".concat(Rt,' "').concat(Et,'" )')):Ue.replaceSelection("")),Ue.focus();case $e:for(var It=at.row,Wt=at.col,Tt=at.align,Pr=`
|
|
`,Lt=0;Lt<It;Lt++){for(var qt=[],Ot=[],gr=0;gr<Wt;gr++)Lt===1&&Ot.push(qe[Tt]),qt.push(" ");Lt===1&&(Pr+="| ".concat(Ot.join(" | "),` |
|
|
`)),Pr+="| ".concat(qt.join(Wt===1?"":" | "),` |
|
|
`)}return Ue.replaceSelection(Pr+`
|
|
`),Ue.focus();default:throw new Error}},[Ue,Ur]),Dn=Object(c.useMemo)(function(){switch(Ur){case We:return p.a.createElement(he,{callback:lr,onCancel:kr});case Xe:return p.a.createElement(fe.b,{callback:lr,onCancel:kr});case rt:return p.a.createElement(Ee,{callback:lr,onCancel:kr});case $e:return p.a.createElement(Ze,{callback:lr,onCancel:kr});default:return null}},[Ur]);function kr(){Br("")}Object(c.useEffect)(function(){if(An.current){var at=An.current,ft=!1,lt=0;function bt(Et){ft=!0,lt=Et.pageY}function wt(){ft=!1}function Rt(Et){if(ft){var It=Et.pageY-lt;It<0&&(It=0),It>300&&(It=300);var Wt=St+It+"px";an(Wt)}}return at.addEventListener("mousedown",bt),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",wt),function(){at.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",wt)}}},[Ue,An]),Object(c.useEffect)(function(){an(St)},[St]);var Hr=te(xt),la=te(Zn),ua={width:Hr,height:la},$a=Object(c.useMemo)(function(){if(Rr){var at=new Date(Rr),ft=at.getHours(),lt=at.getMinutes(),bt=at.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,bt=bt<10?"0"+bt:bt,"".concat(ft,":").concat(lt,":").concat(bt)}return 0},[Rr]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),Ue.setValue(window.sessionStorage.getItem(Jr))}function Ni(at,ft){var lt=Ue.getValue();lt=lt.replace(at,ft),Nr(lt),Ue==null||Ue.setValue(lt)}return p.a.createElement(c.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},p.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Or?"on-preview":""," ").concat(Yt?"mini":""," ").concat(Cr?"full-screen":""),style:ua},p.a.createElement(W,{insertTemp:vr,watch:Or,fullScreen:Cr,showNullButton:Ct,onActionCallback:Ln,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){_i.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Qt,placeholder:Ai})),Or?p.a.createElement("div",{ref:Wr,className:"preview-container"},pr==="stex"&&p.a.createElement(D,{value:nn}),pr!=="stex"&&p.a.createElement(g.a,{edit:!0,value:nn,replaces:Ni})):null))),ot?p.a.createElement("a",{ref:An,className:"editor-resize"}):null,p.a.createElement(_.a,null,et[Ur]?p.a.createElement(H.a,{centered:!0,title:et[Ur],visible:!0,onCancel:kr,footer:null,className:"markdown-popup-form"},Dn):null))}},SJMd:function(nt,ze){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var re,J,H,L=!1,z,F;window.PR_SHOULD_USE_CONTINUATION=!0;var O,B;(function(){var N=window,P=["break,continue,do,else,for,if,return,while"],C=[P,"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"],c=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[c,"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"],R=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[c,"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"],b="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",x=[c,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[p,w,R,x,l,a,s,u],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",D="kwd",T="com",f="typ",h="lit",d="pun",o="pln",E="tag",y="dec",m="src",k="atn",I="atv",U="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(ve){for(var Se=0,Re=!1,Ne=!1,_e=0,Pe=ve.length;_e<Pe;++_e){var ke=ve[_e];if(ke.ignoreCase)Ne=!0;else if(/[a-z]/i.test(ke.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Ne=!1;break}}var Ze={b:8,t:9,n:10,v:11,f:12,r:13};function Ge($e){var we=$e.charCodeAt(0);if(we!==92)return we;var qe=$e.charAt(1);return we=Ze[qe],we||("0"<=qe&&qe<="7"?parseInt($e.substring(1),8):qe==="u"||qe==="x"?parseInt($e.substring(2),16):$e.charCodeAt(1))}function Ve($e){if($e<32)return($e<16?"\\x0":"\\x")+$e.toString(16);var we=String.fromCharCode($e);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function We($e){var we=$e.substring(1,$e.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")),qe=[],Ye=we[0]==="^",Ae=["["];Ye&&Ae.push("^");for(var Me=Ye?1:0,ge=we.length;Me<ge;++Me){var de=we[Me];if(/\\[bdsw]/i.test(de))Ae.push(de);else{var ce=Ge(de),Q;Me+2<ge&&we[Me+1]==="-"?(Q=Ge(we[Me+2]),Me+=2):Q=ce,qe.push([ce,Q]),Q<65||ce>122||(Q<65||ce>90||qe.push([Math.max(65,ce)|32,Math.min(Q,90)|32]),Q<97||ce>122||qe.push([Math.max(97,ce)&~32,Math.min(Q,122)&~32]))}}qe.sort(function(Te,De){return Te[0]-De[0]||De[1]-Te[1]});for(var Z=[],te=[],Me=0;Me<qe.length;++Me){var se=qe[Me];se[0]<=te[1]+1?te[1]=Math.max(te[1],se[1]):Z.push(te=se)}for(var Me=0;Me<Z.length;++Me){var se=Z[Me];Ae.push(Ve(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Ae.push("-"),Ae.push(Ve(se[1])))}return Ae.push("]"),Ae.join("")}function rt($e){for(var we=$e.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")),qe=we.length,Ye=[],Ae=0,Me=0;Ae<qe;++Ae){var ge=we[Ae];if(ge==="(")++Me;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Me?Ye[de]=-1:we[Ae]=Ve(de))}}for(var Ae=1;Ae<Ye.length;++Ae)Ye[Ae]===-1&&(Ye[Ae]=++Se);for(var Ae=0,Me=0;Ae<qe;++Ae){var ge=we[Ae];if(ge==="(")++Me,Ye[Me]||(we[Ae]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Me&&(we[Ae]="\\"+Ye[de])}}for(var Ae=0;Ae<qe;++Ae)we[Ae]==="^"&&we[Ae+1]!=="^"&&(we[Ae]="");if($e.ignoreCase&&Re)for(var Ae=0;Ae<qe;++Ae){var ge=we[Ae],ce=ge.charAt(0);ge.length>=2&&ce==="["?we[Ae]=We(ge):ce!=="\\"&&(we[Ae]=ge.replace(/[a-zA-Z]/g,function(te){var se=te.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return we.join("")}for(var Xe=[],_e=0,Pe=ve.length;_e<Pe;++_e){var ke=ve[_e];if(ke.global||ke.multiline)throw new Error(""+ke);Xe.push("(?:"+rt(ke)+")")}return new RegExp(Xe.join("|"),Ne?"gi":"g")}function M(ve,Se){var Re=/(?:^|\s)nocode(?:\s|$)/,Ne=[],_e=0,Pe=[],ke=0;function Ze(Ge){var Ve=Ge.nodeType;if(Ve==1){if(Re.test(Ge.className))return;for(var We=Ge.firstChild;We;We=We.nextSibling)Ze(We);var rt=Ge.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Ne[ke]=`
|
|
`,Pe[ke<<1]=_e++,Pe[ke++<<1|1]=Ge)}else if(Ve==3||Ve==4){var Xe=Ge.nodeValue;Xe.length&&(Se?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Ne[ke]=Xe,Pe[ke<<1]=_e,_e+=Xe.length,Pe[ke++<<1|1]=Ge)}}return Ze(ve),{sourceCode:Ne.join("").replace(/\n$/,""),spans:Pe}}function K(ve,Se,Re,Ne,_e){if(!Re)return;var Pe={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:Se,decorations:null};Ne(Pe),_e.push.apply(_e,Pe.decorations)}var Y=/\S/;function q(ve){for(var Se=void 0,Re=ve.firstChild;Re;Re=Re.nextSibling){var Ne=Re.nodeType;Se=Ne===1?Se?ve:Re:Ne===3&&Y.test(Re.nodeValue)?ve:Se}return Se===ve?void 0:Se}function oe(ve,Se){var Re={},Ne;(function(){for(var ke=ve.concat(Se),Ze=[],Ge={},Ve=0,We=ke.length;Ve<We;++Ve){var rt=ke[Ve],Xe=rt[3];if(Xe)for(var $e=Xe.length;--$e>=0;)Re[Xe.charAt($e)]=rt;var we=rt[1],qe=""+we;Ge.hasOwnProperty(qe)||(Ze.push(we),Ge[qe]=null)}Ze.push(/[\0-\uffff]/),Ne=_(Ze)})();var _e=Se.length,Pe=function(ke){for(var Ze=ke.sourceCode,Ge=ke.basePos,Ve=ke.sourceNode,We=[Ge,o],rt=0,Xe=Ze.match(Ne)||[],$e={},we=0,qe=Xe.length;we<qe;++we){var Ye=Xe[we],Ae=$e[Ye],Me=void 0,ge;if(typeof Ae=="string")ge=!1;else{var de=Re[Ye.charAt(0)];if(de)Me=Ye.match(de[1]),Ae=de[0];else{for(var ce=0;ce<_e;++ce)if(de=Se[ce],Me=Ye.match(de[1]),Me){Ae=de[0];break}Me||(Ae=o)}ge=Ae.length>=5&&Ae.substring(0,5)==="lang-",ge&&!(Me&&typeof Me[1]=="string")&&(ge=!1,Ae=m),ge||($e[Ye]=Ae)}var Q=rt;if(rt+=Ye.length,!ge)We.push(Ge+Q,Ae);else{var Z=Me[1],te=Ye.indexOf(Z),se=te+Z.length;Me[2]&&(se=Ye.length-Me[2].length,te=se-Z.length);var Te=Ae.substring(5);K(Ve,Ge+Q,Ye.substring(0,te),Pe,We),K(Ve,Ge+Q+te,Z,pe(Te,Z),We),K(Ve,Ge+Q+se,Ye.substring(se),Pe,We)}}ke.decorations=We};return Pe}function be(ve){var Se=[],Re=[];ve.tripleQuotedStrings?Se.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?Se.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&Re.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=ve.hashComments;Ne&&(ve.cStyleComments?(Ne>1?Se.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([T,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(Re.push([T,/^\/\/[^\r\n]*/,null]),Re.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _e=ve.regexLiterals;if(_e){var Pe=_e>1?"":`
|
|
\r`,ke=Pe?".":"[\\S\\s]",Ze="/(?=[^/*"+Pe+"])(?:[^/\\x5B\\x5C"+Pe+"]|\\x5C"+ke+"|\\x5B(?:[^\\x5C\\x5D"+Pe+"]|\\x5C"+ke+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+W+"("+Ze+")")])}var Ge=ve.types;Ge&&Re.push([f,Ge]);var Ve=(""+ve.keywords).replace(/^ | $/g,"");Ve.length&&Re.push([D,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var We="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(We+="(?!s*/)"),Re.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[d,new RegExp(We),null]),oe(Se,Re)}var me=be({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ve,Se,Re){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,_e=/\r\n?|\n/,Pe=ve.ownerDocument,ke=Pe.createElement("li");ve.firstChild;)ke.appendChild(ve.firstChild);var Ze=[ke];function Ge(we){var qe=we.nodeType;if(qe==1&&!Ne.test(we.className))if(we.nodeName==="br")Ve(we),we.parentNode&&we.parentNode.removeChild(we);else for(var Ye=we.firstChild;Ye;Ye=Ye.nextSibling)Ge(Ye);else if((qe==3||qe==4)&&Re){var Ae=we.nodeValue,Me=Ae.match(_e);if(Me){var ge=Ae.substring(0,Me.index);we.nodeValue=ge;var de=Ae.substring(Me.index+Me[0].length);if(de){var ce=we.parentNode;ce.insertBefore(Pe.createTextNode(de),we.nextSibling)}Ve(we),ge||we.parentNode.removeChild(we)}}}function Ve(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function qe(Me,ge){var de=ge?Me.cloneNode(!1):Me,ce=Me.parentNode;if(ce){var Q=qe(ce,1),Z=Me.nextSibling;Q.appendChild(de);for(var te=Z;te;te=Z)Z=te.nextSibling,Q.appendChild(te)}return de}for(var Ye=qe(we.nextSibling,0),Ae;(Ae=Ye.parentNode)&&Ae.nodeType===1;)Ye=Ae;Ze.push(Ye)}for(var We=0;We<Ze.length;++We)Ge(Ze[We]);Se===(Se|0)&&Ze[0].setAttribute("value",Se);var rt=Pe.createElement("ol");rt.className="linenums";for(var Xe=Math.max(0,Se-1|0)||0,We=0,$e=Ze.length;We<$e;++We)ke=Ze[We],ke.className="L"+(We+Xe)%10,ke.firstChild||ke.appendChild(Pe.createTextNode("\xA0")),rt.appendChild(ke);ve.appendChild(rt)}function fe(ve){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var Re=/\n/g,Ne=ve.sourceCode,_e=Ne.length,Pe=0,ke=ve.spans,Ze=ke.length,Ge=0,Ve=ve.decorations,We=Ve.length,rt=0;Ve[We]=_e;var Xe,$e;for($e=Xe=0;$e<We;)Ve[$e]!==Ve[$e+2]?(Ve[Xe++]=Ve[$e++],Ve[Xe++]=Ve[$e++]):$e+=2;for(We=Xe,$e=Xe=0;$e<We;){for(var we=Ve[$e],qe=Ve[$e+1],Ye=$e+2;Ye+2<=We&&Ve[Ye+1]===qe;)Ye+=2;Ve[Xe++]=we,Ve[Xe++]=qe,$e=Ye}We=Ve.length=Xe;var Ae=ve.sourceNode,Me="";Ae&&(Me=Ae.style.display,Ae.style.display="none");try{for(var ge=null;Ge<Ze;){var de=ke[Ge],ce=ke[Ge+2]||_e,Q=Ve[rt+2]||_e,Ye=Math.min(ce,Q),Z=ke[Ge+1],te;if(Z.nodeType!==1&&(te=Ne.substring(Pe,Ye))){Se&&(te=te.replace(Re,"\r")),Z.nodeValue=te;var se=Z.ownerDocument,Te=se.createElement("span");Te.className=Ve[rt+1];var De=Z.parentNode;De.replaceChild(Te,Z),Te.appendChild(Z),Pe<ce&&(ke[Ge+1]=Z=se.createTextNode(Ne.substring(Ye,ce)),De.insertBefore(Z,Te.nextSibling))}Pe=Ye,Pe>=ce&&(Ge+=2),Pe>=Q&&(rt+=2)}}finally{Ae&&(Ae.style.display=Me)}}var ue={};function ie(ve,Se){for(var Re=Se.length;--Re>=0;){var Ne=Se[Re];ue.hasOwnProperty(Ne)?N.console&&console.warn("cannot override language handler %s",Ne):ue[Ne]=ve}}function pe(ve,Se){return ve&&ue.hasOwnProperty(ve)||(ve=/^\s*</.test(Se)?"default-markup":"default-code"),ue[ve]}ie(me,["default-code"]),ie(oe([],[[o,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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"]),ie(oe([[o,/^[\s]+/,null,` \r
|
|
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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"]),ie(oe([],[[I,/^[\s\S]+/]]),["uq.val"]),ie(be({keywords:p,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ie(be({keywords:"null,true,false"}),["json"]),ie(be({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ie(be({keywords:R,cStyleComments:!0}),["java"]),ie(be({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(be({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(be({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(be({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(be({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(be({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(oe([],[[g,/^[\s\S]+/]]),["regex"]);function $(ve){var Se=ve.langExtension;try{var Re=M(ve.sourceNode,ve.pre),Ne=Re.sourceCode;ve.sourceCode=Ne,ve.spans=Re.spans,ve.basePos=0,pe(Se,Ne)(ve),fe(ve)}catch(_e){N.console&&console.log(_e&&_e.stack||_e)}}function ae(ve,Se,Re){var Ne=Re||!1,_e=Se||null,Pe=document.createElement("div");Pe.innerHTML="<pre>"+ve+"</pre>",Pe=Pe.firstChild,Ne&&he(Pe,Ne,!0);var ke={langExtension:_e,numberLines:Ne,sourceNode:Pe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(ke),Pe.innerHTML}function ee(ve,Se){var Re=Se||document.body,Ne=Re.ownerDocument||document;function _e(de){return Re.getElementsByTagName(de)}for(var Pe=[_e("pre"),_e("code"),_e("xmp")],ke=[],Ze=0;Ze<Pe.length;++Ze)for(var Ge=0,Ve=Pe[Ze].length;Ge<Ve;++Ge)ke.push(Pe[Ze][Ge]);Pe=null;var We=Date;We.now||(We={now:function(){return+new Date}});var rt=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,$e=/\bprettyprint\b/,we=/\bprettyprinted\b/,qe=/pre|xmp/i,Ye=/^code$/i,Ae=/^(?:pre|code|xmp)$/i,Me={};function ge(){for(var de=N.PR_SHOULD_USE_CONTINUATION?We.now()+250:Infinity;rt<ke.length&&We.now()<de;rt++){for(var ce=ke[rt],Q=Me,Z=ce;Z=Z.previousSibling;){var te=Z.nodeType,se=(te===7||te===8)&&Z.nodeValue;if(se?!/^\??prettify\b/.test(se):te!==3||/\S/.test(Z.nodeValue))break;if(se){Q={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(St,mt,Yt){Q[mt]=Yt});break}}var Te=ce.className;if((Q!==Me||$e.test(Te))&&!we.test(Te)){for(var De=!1,Be=ce.parentNode;Be;Be=Be.parentNode){var et=Be.tagName;if(Ae.test(et)&&Be.className&&$e.test(Be.className)){De=!0;break}}if(!De){ce.className+=" prettyprinted";var ut=Q.lang;if(!ut){ut=Te.match(Xe);var Le;!ut&&(Le=q(ce))&&Ye.test(Le.tagName)&&(ut=Le.className.match(Xe)),ut&&(ut=ut[1])}var ht;if(qe.test(ce.tagName))ht=1;else{var it=ce.currentStyle,Qe=Ne.defaultView,vt=it?it.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(ce,null).getPropertyValue("white-space"):0;ht=vt&&vt.substring(0,3)==="pre"}var xt=Q.linenums;(xt=xt==="true"||+xt)||(xt=Te.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&he(ce,xt,ht);var yt={langExtension:ut,sourceNode:ce,numberLines:xt,pre:ht,sourceCode:null,basePos:null,spans:null,decorations:null};$(yt)}}}rt<ke.length?N.setTimeout(ge,250):typeof ve=="function"&&ve()}ge()}var Ee=N.PR={createSimpleLexer:oe,registerLangHandler:ie,sourceDecorator:be,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:I,PR_COMMENT:T,PR_DECLARATION:y,PR_KEYWORD:D,PR_LITERAL:h,PR_NOCODE:U,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:m,PR_STRING:g,PR_TAG:E,PR_TYPE:f,prettyPrintOne:L?N.prettyPrintOne=ae:O=ae,prettyPrint:B=L?N.prettyPrint=ee:B=ee},Ce=N.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(nt,ze,re){(function(J,H){nt.exports=H()})(this,function(){"use strict";var J=navigator.userAgent,H=navigator.platform,L=/gecko\/\d/i.test(J),z=/MSIE \d/.test(J),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J),O=/Edge\/(\d+)/.exec(J),B=z||F||O,N=B&&(z?document.documentMode||6:+(O||F)[1]),P=!O&&/WebKit\//.test(J),C=P&&/Qt\/\d+\.\d+/.test(J),c=!O&&/Chrome\//.test(J),p=/Opera\//.test(J),R=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(J),b=/PhantomJS/.test(J),x=!O&&/AppleWebKit/.test(J)&&/Mobile\/\w+/.test(J),l=/Android/.test(J),a=x||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(J),s=x||/Mac/.test(H),u=/\bCrOS\b/.test(J),A=/win/i.test(H),v=p&&J.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(p=!1,P=!0);var g=s&&(C||p&&(v==null||v<12.11)),D=L||B&&N>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=T(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return h(e).appendChild(t)}function o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)i.appendChild(t[S]);return i}function E(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function m(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function k(){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 I(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function U(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};x?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 M(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 S=r||0,j=i||0;;){var G=e.indexOf(" ",S);if(G<0||G>=t)return j+(t-S);j+=G-S,j+=n-j%n,S=G+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 oe=50,be={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},he={origin:"*mouse"},fe={origin:"+move"};function ue(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var j=S-r;if(S==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ie=[""];function pe(e){for(;ie.length<=e;)ie.push($(ie)+" ");return ie[e]}function $(e){return e[e.length-1]}function ae(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ee(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&M(t,n),n}var ve=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ve.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function Ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var _e=/[\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&&_e.test(e)}function ke(e,t,n){for(;(n<0?t>0:t<e.length)&&Pe(e.charAt(t));)t+=n;return t}function Ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function Ge(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var j=e[S];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ve=null;function We(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ve=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,j=/[Lb1n]/,G=/[1n]/;function V(X,ne,le){this.level=X,this.from=ne,this.to=le}return function(X,ne){var le=ne=="ltr"?"L":"R";if(X.length==0||ne=="ltr"&&!r.test(X))return!1;for(var xe=X.length,ye=[],Oe=0;Oe<xe;++Oe)ye.push(n(X.charCodeAt(Oe)));for(var Ie=0,je=le;Ie<xe;++Ie){var He=ye[Ie];He=="m"?ye[Ie]=je:je=He}for(var Je=0,Ke=le;Je<xe;++Je){var tt=ye[Je];tt=="1"&&Ke=="r"?ye[Je]="n":S.test(tt)&&(Ke=tt,tt=="r"&&(ye[Je]="R"))}for(var dt=1,st=ye[0];dt<xe-1;++dt){var gt=ye[dt];gt=="+"&&st=="1"&&ye[dt+1]=="1"?ye[dt]="1":gt==","&&st==ye[dt+1]&&(st=="1"||st=="n")&&(ye[dt]=st),st=gt}for(var kt=0;kt<xe;++kt){var Vt=ye[kt];if(Vt==",")ye[kt]="N";else if(Vt=="%"){var _t=void 0;for(_t=kt+1;_t<xe&&ye[_t]=="%";++_t);for(var dr=kt&&ye[kt-1]=="!"||_t<xe&&ye[_t]=="1"?"1":"N",ir=kt;ir<_t;++ir)ye[ir]=dr;kt=_t-1}}for(var Bt=0,ar=le;Bt<xe;++Bt){var $t=ye[Bt];ar=="L"&&$t=="1"?ye[Bt]="L":S.test($t)&&(ar=$t)}for(var Ht=0;Ht<xe;++Ht)if(i.test(ye[Ht])){var jt=void 0;for(jt=Ht+1;jt<xe&&i.test(ye[jt]);++jt);for(var Nt=(Ht?ye[Ht-1]:le)=="L",or=(jt<xe?ye[jt]:le)=="L",Gn=Nt==or?Nt?"L":"R":le,Qr=Ht;Qr<jt;++Qr)ye[Qr]=Gn;Ht=jt-1}for(var Zt=[],Dr,Xt=0;Xt<xe;)if(j.test(ye[Xt])){var Xa=Xt;for(++Xt;Xt<xe&&j.test(ye[Xt]);++Xt);Zt.push(new V(0,Xa,Xt))}else{var Ir=Xt,mn=Zt.length,gn=ne=="rtl"?1:0;for(++Xt;Xt<xe&&ye[Xt]!="L";++Xt);for(var tr=Ir;tr<Xt;)if(G.test(ye[tr])){Ir<tr&&(Zt.splice(mn,0,new V(1,Ir,tr)),mn+=gn);var zn=tr;for(++tr;tr<Xt&&G.test(ye[tr]);++tr);Zt.splice(mn,0,new V(2,zn,tr)),mn+=gn,Ir=tr}else++tr;Ir<Xt&&Zt.splice(mn,0,new V(1,Ir,Xt))}return ne=="ltr"&&(Zt[0].level==1&&(Dr=X.match(/^\s+/))&&(Zt[0].from=Dr[0].length,Zt.unshift(new V(0,0,Dr[0].length))),$(Zt).level==1&&(Dr=X.match(/\s+$/))&&($(Zt).to-=Dr[0].length,Zt.push(new V(0,xe-Dr[0].length,xe)))),ne=="rtl"?Zt.reverse():Zt}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var $e=[],we=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]||$e).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||$e}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 S=q(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Ae(e,t){var n=qe(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 Me(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ae(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)q(n,t[r])==-1&&n.push(t[r])}function de(e,t){return qe(e,t).length>0}function ce(e){e.prototype.on=function(t,n){we(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),Z(e)}function Te(e){return e.target||e.srcElement}function De(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Be=function(){if(B&&N<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),et;function ut(e){if(et==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(et=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&N<8))}var n=et?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Le;function ht(e){if(Le!=null)return Le;var t=d(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:Le=r.right-n.right<3}var it=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=S.indexOf("\r");j!=-1?(n.push(S.slice(0,j)),t+=j+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Qe=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},vt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function yt(e){if(xt!=null)return xt;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var St={},mt={};function Yt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}function Kt(e,t){mt[e]=t}function Ut(e){if(typeof e=="string"&&mt.hasOwnProperty(e))e=mt[e];else if(e&&typeof e.name=="string"&&mt.hasOwnProperty(e.name)){var t=mt[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ut("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ut("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ut(t);var n=St[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};M(t,n)}function pr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function vn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Jr(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=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)},Mt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ot(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var j=S.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ct(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 wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var G=e.lines[j],V=G.height;if(t<V)break;t-=V}return n+j}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function en(e){return Fe(e.line,e.ch)}function tn(e,t){return ct(e,t)<0?t:e}function bn(e,t){return ct(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pt(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,ot(e,n).text.length):Ci(t,ot(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Ai(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=pt(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,pr(e.mode,t.state),n,t.lookAhead):new sr(e,pr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?pr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Li(e,t,n,r){var i=[e.state.modeGen],S={};Qn(e,t.text,e.doc.mode,n,function(X,ne){return i.push(X,ne)},S,r);for(var j=n.state,G=function(X){n.baseTokens=i;var ne=e.state.overlays[X],le=1,xe=0;n.state=!0,Qn(e,t.text,ne.mode,n,function(ye,Oe){for(var Ie=le;xe<ye;){var je=i[le];je>ye&&i.splice(le,1,ye,i[le+1],je),le+=2,xe=Math.min(ye,je)}if(!Oe)return;if(ne.opaque)i.splice(Ie,le-Ie,ye,"overlay "+Oe),le=Ie+2;else for(;Ie<le;Ie+=2){var He=i[Ie+1];i[Ie+1]=(He?He+" ":"")+"overlay "+Oe}},S),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)G(V);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ue(e,Ct(t)),i=t.text.length>e.options.maxHighlightLength&&pr(e.doc.mode,r.state),S=Li(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ue(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var S=Or(e,t,n),j=S>r.first&&ot(r,S-1).stateAfter,G=j?sr.fromSaved(r,j,S):new sr(r,Jr(r.mode),S);return r.iter(S,t,function(V){$n(e,V.text,G);var X=G.line;V.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?G.save():null,G.nextLine()}),n&&(r.modeFrontier=G.line),G}function $n(e,t,n,r){var i=e.doc.mode,S=new Mt(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Di(i,n.state);!S.eol();)xn(i,S,n.state),S.start=S.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Nr(e,t,n,r){var i=e.doc,S=i.mode,j;t=pt(i,t);var G=ot(i,t.line),V=Ue(e,t.line,n),X=new Mt(G.text,e.options.tabSize,V),ne;for(r&&(ne=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,j=xn(S,X,V.state),r&&ne.push(new nn(X,j,pr(i.mode,V.state)));return r?ne:new nn(X,j,V.state)}function Oi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Qn(e,t,n,r,i,S,j){var G=n.flattenSpans;G==null&&(G=e.options.flattenSpans);var V=0,X=null,ne=new Mt(t,e.options.tabSize,r),le,xe=e.options.addModeClass&&[null];for(t==""&&Oi(Di(n,r.state),S);!ne.eol();){if(ne.pos>e.options.maxHighlightLength?(G=!1,j&&$n(e,t,r,ne.pos),ne.pos=t.length,le=null):le=Oi(xn(n,ne,r.state,xe),S),xe){var ye=xe[0].name;ye&&(le="m-"+(le?ye+" "+le:ye))}if(!G||X!=le){for(;V<ne.start;)V=Math.min(ne.start,V+5e3),i(V,X);X=le}ne.start=ne.pos}for(;V<ne.pos;){var Oe=Math.min(ne.pos,V+5e3);i(Oe,X),V=Oe}}function Or(e,t,n){for(var r,i,S=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>j;--G){if(G<=S.first)return S.first;var V=ot(S,G-1),X=V.stateAfter;if(X&&(!n||G+(X instanceof rn?X.lookAhead:0)<=S.modeFrontier))return G;var ne=K(V.text,null,e.options.tabSize);(i==null||r>ne)&&(i=G-1,r=ne)}return i}function Ri(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=ot(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var ki=!1,mr=!1;function Cr(){ki=!0}function Pi(){mr=!0}function En(e,t,n){this.marker=e,this.from=t,this.to=n}function Fr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ur(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],j=S.marker,G=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);if(G||S.from==t&&j.type=="bookmark"&&(!n||!S.marker.insertLeft)){var V=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new En(j,S.from,V?null:S.to))}}return r}function Mi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],j=S.marker,G=S.to==null||(j.inclusiveRight?S.to>=t:S.to>t);if(G||S.from==t&&j.type=="bookmark"&&(!n||S.marker.insertLeft)){var V=S.from==null||(j.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new En(j,V?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Rr(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&ot(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&ot(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,j=ct(t.from,t.to)==0,G=aa(n,i,j),V=Mi(r,S,j),X=t.text.length==1,ne=$(t.text).length+(X?i:0);if(G)for(var le=0;le<G.length;++le){var xe=G[le];if(xe.to==null){var ye=Fr(V,xe.marker);ye?X&&(xe.to=ye.to==null?null:ye.to+ne):xe.to=i}}if(V)for(var Oe=0;Oe<V.length;++Oe){var Ie=V[Oe];if(Ie.to!=null&&(Ie.to+=ne),Ie.from==null){var je=Fr(G,Ie.marker);je||(Ie.from=ne,X&&(G||(G=[])).push(Ie))}else Ie.from+=ne,X&&(G||(G=[])).push(Ie)}G&&(G=Tn(G)),V&&V!=G&&(V=Tn(V));var He=[G];if(!X){var Je=t.text.length-2,Ke;if(Je>0&&G)for(var tt=0;tt<G.length;++tt)G[tt].to==null&&(Ke||(Ke=[])).push(new En(G[tt].marker,null,null));for(var dt=0;dt<Je;++dt)He.push(Ke);He.push(V)}return He}function Tn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var Oe=0;Oe<ye.markedSpans.length;++Oe){var Ie=ye.markedSpans[Oe].marker;Ie.readOnly&&(!r||q(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var j=r[S],G=j.find(0),V=0;V<i.length;++V){var X=i[V];if(ct(X.to,G.from)<0||ct(X.from,G.to)>0)continue;var ne=[V,1],le=ct(X.from,G.from),xe=ct(X.to,G.to);(le<0||!j.inclusiveLeft&&!le)&&ne.push({from:X.from,to:G.from}),(xe>0||!j.inclusiveRight&&!xe)&&ne.push({from:G.to,to:X.to}),i.splice.apply(i,ne),V+=ne.length-3}return i}function Jn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=ct(r.from,i.from)||an(e)-an(t);if(S)return-S;var j=ct(r.to,i.to)||Sn(e)-Sn(t);return j||t.id-e.id}function sa(e,t){var n=mr&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Cn(e){return sa(e,!0)}function on(e){return sa(e,!1)}function _i(e,t){var n=mr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||wn(r,S.marker)<0)&&(r=S.marker)}return r}function qn(e,t,n,r,i){var S=ot(e,t),j=mr&&S.markedSpans;if(j)for(var G=0;G<j.length;++G){var V=j[G];if(!V.marker.collapsed)continue;var X=V.marker.find(0),ne=ct(X.from,n)||an(V.marker)-an(i),le=ct(X.to,r)||Sn(V.marker)-Sn(i);if(ne>=0&&le<=0||ne<=0&&le>=0)continue;if(ne<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||ne>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function Qt(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=ot(e,t),r=Qt(n);return n==r?t:Ct(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=ot(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return Ct(n)+1}function yr(e,t){var n=mr&&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&&Ln(e,t,r))return!0}}function Ln(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ln(e,r.line,Fr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ln(e,t,i))return!0}function lr(e){e=Qt(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 S=n.parent;S;n=S,S=n.parent)for(var j=0;j<S.children.length;++j){var G=S.children[j];if(G==n)break;t+=G.height}return t}function Dn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Cn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function kr(e){var t=e.display,n=e.doc;t.maxLine=ot(n,n.first),t.maxLineLength=Dn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Dn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return Ct(this)},ce(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ni(e,t){var n=E("span",null,null,P?"padding-right: .1px":null),r={pre:E("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ft,ht(e.display.measure)&&(j=Xe(S,e.doc.direction))&&(r.addToken=bt(r.addToken,j)),r.map=[];var G=t!=e.display.externalMeasured&&Ct(S);Rt(S,r,Yn(e,S,G)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=U(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=U(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ut(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(P){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ae(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=U(r.pre.className,r.textClass||"")),r}function at(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ft(e,t,n,r,i,S,j){if(!t)return;var G=e.splitSpaces?lt(t,e.trailingSpace):t,V=e.cm.state.specialChars,X=!1,ne;if(!V.test(t))e.col+=t.length,ne=document.createTextNode(G),e.map.push(e.pos,e.pos+t.length,ne),B&&N<9&&(X=!0),e.pos+=t.length;else{ne=document.createDocumentFragment();for(var le=0;;){V.lastIndex=le;var xe=V.exec(t),ye=xe?xe.index-le:t.length-le;if(ye){var Oe=document.createTextNode(G.slice(le,le+ye));B&&N<9?ne.appendChild(o("span",[Oe])):ne.appendChild(Oe),e.map.push(e.pos,e.pos+ye,Oe),e.col+=ye,e.pos+=ye}if(!xe)break;le+=ye+1;var Ie=void 0;if(xe[0]==" "){var je=e.cm.options.tabSize,He=je-e.col%je;Ie=ne.appendChild(o("span",pe(He),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=He}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ie=ne.appendChild(o("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",xe[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(xe[0]),Ie.setAttribute("cm-text",xe[0]),B&&N<9?ne.appendChild(o("span",[Ie])):ne.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,n||r||i||X||S||j){var Je=n||"";r&&(Je+=r),i&&(Je+=i);var Ke=o("span",[ne],Je,S);if(j)for(var tt in j)j.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ke.setAttribute(tt,j[tt]);return e.content.appendChild(Ke)}e.content.appendChild(ne)}function lt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function bt(e,t){return function(n,r,i,S,j,G,V){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ne=X+r.length;;){for(var le=void 0,xe=0;xe<t.length&&!(le=t[xe],le.to>X&&le.from<=X);xe++);if(le.to>=ne)return e(n,r,i,S,j,G,V);e(n,r.slice(0,le.to-X),i,S,null,G,V),S=null,r=r.slice(le.to-X),X=le.to}}}function wt(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 Rt(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(S,S=n[j]),da(n[j+1],t.cm.options));return}for(var G=i.length,V=0,X=1,ne="",le,xe,ye=0,Oe,Ie,je,He,Je;;){if(ye==V){Oe=Ie=je=xe="",Je=null,He=null,ye=Infinity;for(var Ke=[],tt=void 0,dt=0;dt<r.length;++dt){var st=r[dt],gt=st.marker;if(gt.type=="bookmark"&&st.from==V&>.widgetNode)Ke.push(gt);else if(st.from<=V&&(st.to==null||st.to>V||gt.collapsed&&st.to==V&&st.from==V)){if(st.to!=null&&st.to!=V&&ye>st.to&&(ye=st.to,Ie=""),gt.className&&(Oe+=" "+gt.className),gt.css&&(xe=(xe?xe+";":"")+gt.css),gt.startStyle&&st.from==V&&(je+=" "+gt.startStyle),gt.endStyle&&st.to==ye&&(tt||(tt=[])).push(gt.endStyle,st.to),gt.title&&((Je||(Je={})).title=gt.title),gt.attributes)for(var kt in gt.attributes)(Je||(Je={}))[kt]=gt.attributes[kt];gt.collapsed&&(!He||wn(He.marker,gt)<0)&&(He=st)}else st.from>V&&ye>st.from&&(ye=st.from)}if(tt)for(var Vt=0;Vt<tt.length;Vt+=2)tt[Vt+1]==ye&&(Ie+=" "+tt[Vt]);if(!He||He.from==V)for(var _t=0;_t<Ke.length;++_t)wt(t,0,Ke[_t]);if(He&&(He.from||0)==V){if(wt(t,(He.to==null?G+1:He.to)-V,He.marker,He.from==null),He.to==null)return;He.to==V&&(He=!1)}}if(V>=G)break;for(var dr=Math.min(G,ye);;){if(ne){var ir=V+ne.length;if(!He){var Bt=ir>dr?ne.slice(0,dr-V):ne;t.addToken(t,Bt,le?le+Oe:Oe,je,V+Bt.length==ye?Ie:"",xe,Je)}if(ir>=dr){ne=ne.slice(dr-V),V=dr;break}V=ir,je=""}ne=i.slice(S,S=n[X++]),le=da(n[X++],t.cm.options)}}}function Et(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?Ct($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,S=t;S<n;S=i){var j=new Et(e.doc,ot(e.doc,S),S);i=S+j.size,r.push(j)}return r}var Wt=null;function Tt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Pr(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Lt(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Wt=null,t(n)}}var qt=null;function Ot(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:qt?i=qt:(i=qt=[],setTimeout(gr,0));for(var S=function(G){i.push(function(){return n[G].apply(null,r)})},j=0;j<n.length;++j)S(j)}function gr(){var e=qt;qt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?_s(e,t):S=="gutter"?qa(e,t,n,r):S=="class"?ca(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ei(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&N<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ei(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ni(e,t)}function _s(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?ei(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ei(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var j=ei(t),G=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),j.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(o("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var V=0;V<e.display.gutterSpecs.length;++V){var X=e.display.gutterSpecs[V].className,ne=S.hasOwnProperty(X)&&S[X];ne&&G.appendChild(o("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=T("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Ns(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var S=ei(n),j=0,G=t.widgets;j<G.length;++j){var V=G[j],X=o("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Fs(V,X,n,r),e.display.input.setUneditable(X),i&&V.above?S.insertBefore(X,n.gutter||n.text):S.appendChild(X),Ot(V,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!m(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var n=Te(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 fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ar(e){return oe-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Ar(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Ar(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),G=0;G<j.length-1;G++){var V=j[G],X=j[G+1];Math.abs(V.bottom-X.bottom)>2&&S.push((V.bottom+X.top)/2-n.top)}}S.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Ct(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Qt(t);var n=Ct(t),r=e.display.externalMeasured=new Et(e.doc,t,n);r.lineN=n;var i=r.built=Ni(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Lr(e,On(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function On(e,t){var n=Ct(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,xa(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Lr(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),j;return t.cache.hasOwnProperty(S)?j=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[S]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,S,j,G,V,X=0;X<e.length;X+=3)if(G=e[X],V=e[X+1],t<G?(i=0,S=1,j="left"):t<V?(i=t-G,S=i+1):(X==e.length-3||t==V&&e[X+3]>t)&&(S=V-G,i=S-1,t>=V&&(j="right")),i!=null){if(r=e[X+2],G==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],j="left";if(n=="right"&&i==V-G)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],j="right";break}return{node:r,start:i,end:S,collapse:j,coverStart:G,coverEnd:V}}function js(e,t){var n=ao;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),S=i.node,j=i.start,G=i.end,V=i.collapse,X;if(S.nodeType==3){for(var ne=0;ne<4;ne++){for(;j&&Pe(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+G<i.coverEnd&&Pe(t.line.text.charAt(i.coverStart+G));)++G;if(B&&N<9&&j==0&&G==i.coverEnd-i.coverStart?X=S.parentNode.getBoundingClientRect():X=js(y(S,j,G).getClientRects(),r),X.left||X.right||j==0)break;G=j,j=j-1,V="right"}B&&N<11&&(X=Hs(e.display.measure,X))}else{j>0&&(V=r="right");var le;e.options.lineWrapping&&(le=S.getClientRects()).length>1?X=le[r=="right"?le.length-1:0]:X=S.getBoundingClientRect()}if(B&&N<9&&!j&&(!X||!X.left&&!X.right)){var xe=S.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+kn(e.display),top:xe.top,bottom:xe.bottom}:X=ao}for(var ye=X.top-t.rect.top,Oe=X.bottom-t.rect.top,Ie=(ye+Oe)/2,je=t.view.measure.heights,He=0;He<je.length-1&&!(Ie<je[He]);He++);var Je=He?je[He-1]:0,Ke=je[He],tt={left:(V=="right"?X.right:X.left)-t.rect.left,right:(V=="left"?X.left:X.right)-t.rect.left,top:Je,bottom:Ke};return!X.left&&!X.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=ye,tt.rbottom=Oe),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return c&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return c&&l?-(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+=ti(e.widgets[n]));return t}function Ui(e,t,n,r,i){if(!i){var S=ma(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var j=lr(t);if(r=="local"?j+=Fi(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var G=e.display.lineSpace.getBoundingClientRect();j+=G.top+(r=="window"?0:co());var V=G.left+(r=="window"?0:uo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=ot(e.doc,t.line)),Ui(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,S){r=r||ot(e.doc,t.line),i||(i=On(e,r));function j(Oe,Ie){var je=Lr(e,i,Oe,Ie?"right":"left",S);return Ie?je.left=je.right:je.right=je.left,Ui(e,r,je,n)}var G=Xe(r,e.doc.direction),V=t.ch,X=t.sticky;if(V>=r.text.length?(V=r.text.length,X="before"):V<=0&&(V=0,X="after"),!G)return j(X=="before"?V-1:V,X=="before");function ne(Oe,Ie,je){var He=G[Ie],Je=He.level==1;return j(je?Oe-1:Oe,Je!=je)}var le=We(G,V,X),xe=Ve,ye=ne(V,le,X=="before");return xe!=null&&(ye.other=ne(V,xe,X!="before")),ye}function ho(e,t){var n=0;t=pt(e.doc,t),e.options.lineWrapping||(n=kn(e.display)*t.ch);var r=ot(e.doc,t.line),i=lr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var S=Fe(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),S=r.first+r.size-1;if(i>S)return va(r.first+r.size-1,ot(r,S).text.length,null,1,1);t<0&&(t=0);for(var j=ot(r,i);;){var G=Ks(e,j,i,t,n),V=_i(j,G.ch+(G.xRel>0||G.outside>0?1:0));if(!V)return G;var X=V.find(1);if(X.line==i)return X;j=ot(r,i=X.line)}}function po(e,t,n,r){r-=ma(t);var i=t.text.length,S=Ze(function(j){return Lr(e,n,j-1).bottom<=r},i,0);return i=Ze(function(j){return Lr(e,n,j).top>r},S,i),{begin:S,end:i}}function mo(e,t,n,r){n||(n=On(e,t));var i=Ui(e,t,Lr(e,n,r),"line").top;return po(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=lr(t);var S=On(e,t),j=ma(t),G=0,V=t.text.length,X=!0,ne=Xe(t,e.doc.direction);if(ne){var le=(e.options.lineWrapping?zs:Gs)(e,t,n,S,ne,r,i);X=le.level!=1,G=X?le.from:le.to-1,V=X?le.to:le.from-1}var xe=null,ye=null,Oe=Ze(function(dt){var st=Lr(e,S,dt);return st.top+=j,st.bottom+=j,ba(st,r,i,!1)?(st.top<=i&&st.left<=r&&(xe=dt,ye=st),!0):!1},G,V),Ie,je,He=!1;if(ye){var Je=r-ye.left<ye.right-r,Ke=Je==X;Oe=xe+(Ke?0:1),je=Ke?"after":"before",Ie=Je?ye.left:ye.right}else{!X&&(Oe==V||Oe==G)&&Oe++,je=Oe==0?"after":Oe==t.text.length?"before":Lr(e,S,Oe-(X?1:0)).bottom+j<=i==X?"after":"before";var tt=br(e,Fe(n,Oe,je),"line",t,S);Ie=tt.left,He=i<tt.top?-1:i>=tt.bottom?1:0}return Oe=ke(t.text,Oe,1),va(n,Oe,je,He,r-Ie)}function Gs(e,t,n,r,i,S,j){var G=Ze(function(le){var xe=i[le],ye=xe.level!=1;return ba(br(e,Fe(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),S,j,!0)},0,i.length-1),V=i[G];if(G>0){var X=V.level!=1,ne=br(e,Fe(n,X?V.from:V.to,X?"after":"before"),"line",t,r);ba(ne,S,j,!0)&&ne.top>j&&(V=i[G-1])}return V}function zs(e,t,n,r,i,S,j){var G=po(e,t,r,j),V=G.begin,X=G.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ne=null,le=null,xe=0;xe<i.length;xe++){var ye=i[xe];if(ye.from>=X||ye.to<=V)continue;var Oe=ye.level!=1,Ie=Lr(e,r,Oe?Math.min(X,ye.to)-1:Math.max(V,ye.from)).right,je=Ie<S?S-Ie+1e9:Ie-S;(!ne||le>je)&&(ne=ye,le=je)}return ne||(ne=i[i.length-1]),ne.from<V&&(ne={from:V,to:ne.to,level:ne.level}),ne.to>X&&(ne={from:ne.from,to:X,level:ne.level}),ne}var ln;function Rn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(o("br"));ln.appendChild(document.createTextNode("x"))}d(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function kn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xa(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,j=0;S;S=S.nextSibling,++j){var G=e.display.gutterSpecs[j].className;n[G]=S.offsetLeft+S.clientLeft+i,r[G]=S.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Rn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/kn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var S=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(S+=i.widgets[j].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var S,j,G=i.lineSpace.getBoundingClientRect();try{S=t.clientX-G.left,j=t.clientY-G.top}catch(le){return null}var V=ya(e,S,j),X;if(r&&V.xRel>0&&(X=ot(e.doc,V.line).text).length==V.ch){var ne=K(X,X.length,e.options.tabSize)-X.length;V=Fe(V.line,Math.max(0,Math.round((S-ro(e.display).left)/kn(e.display))-ne))}return V}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function rr(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)mr&&Wr(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)mr&&Ii(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 S=Bi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):Gr(e)}else{var G=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);G&&V?(i.view=i.view.slice(0,G.index).concat(It(e,G.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):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 S=r.view[dn(e,t)];if(S.node==null)return;var j=S.changes||(S.changes=[]);q(j,n)==-1&&j.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),S,j=e.display.view;if(!mr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var G=e.display.viewFrom,V=0;V<i;V++)G+=j[V].size;if(G!=t){if(r>0){if(i==j.length-1)return null;S=G+j[i].size-t,i++}else S=G-t;t+=S,n+=S}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var G=n.sel.ranges[j];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var V=G.empty();(V||e.options.showCursorWhenSelecting)&&bo(e,G.head,i),V||Xs(e,G,S)}return r}function bo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,S=document.createDocumentFragment(),j=ro(e.display),G=j.left,V=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-j.right,X=i.direction=="ltr";function ne(Ke,tt,dt,st){tt<0&&(tt=0),tt=Math.round(tt),st=Math.round(st),S.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+Ke+`px;
|
|
top: `+tt+"px; width: "+(dt==null?V-Ke:dt)+`px;
|
|
height: `+(st-tt)+"px"))}function le(Ke,tt,dt){var st=ot(i,Ke),gt=st.text.length,kt,Vt;function _t(Bt,ar){return ga(e,Fe(Ke,Bt),"div",st,ar)}function dr(Bt,ar,$t){var Ht=mo(e,st,null,Bt),jt=ar=="ltr"==($t=="after")?"left":"right",Nt=$t=="after"?Ht.begin:Ht.end-(/\s/.test(st.text.charAt(Ht.end-1))?2:1);return _t(Nt,jt)[jt]}var ir=Xe(st,i.direction);return Ge(ir,tt||0,dt==null?gt:dt,function(Bt,ar,$t,Ht){var jt=$t=="ltr",Nt=_t(Bt,jt?"left":"right"),or=_t(ar-1,jt?"right":"left"),Gn=tt==null&&Bt==0,Qr=dt==null&&ar==gt,Zt=Ht==0,Dr=!ir||Ht==ir.length-1;if(or.top-Nt.top<=3){var Xt=(X?Gn:Qr)&&Zt,Xa=(X?Qr:Gn)&&Dr,Ir=Xt?G:(jt?Nt:or).left,mn=Xa?V:(jt?or:Nt).right;ne(Ir,Nt.top,mn-Ir,Nt.bottom)}else{var gn,tr,zn,Ya;jt?(gn=X&&Gn&&Zt?G:Nt.left,tr=X?V:dr(Bt,$t,"before"),zn=X?G:dr(ar,$t,"after"),Ya=X&&Qr&&Dr?V:or.right):(gn=X?dr(Bt,$t,"before"):G,tr=!X&&Gn&&Zt?V:Nt.right,zn=!X&&Qr&&Dr?G:or.left,Ya=X?dr(ar,$t,"after"):V),ne(gn,Nt.top,tr-gn,Nt.bottom),Nt.bottom<or.top&&ne(G,Nt.bottom,null,or.top),ne(zn,or.top,Ya-zn,or.bottom)}(!kt||ji(Nt,kt)<0)&&(kt=Nt),ji(or,kt)<0&&(kt=or),(!Vt||ji(Nt,Vt)<0)&&(Vt=Nt),ji(or,Vt)<0&&(Vt=or)}),{start:kt,end:Vt}}var xe=t.from(),ye=t.to();if(xe.line==ye.line)le(xe.line,xe.ch,ye.ch);else{var Oe=ot(i,xe.line),Ie=ot(i,ye.line),je=Qt(Oe)==Qt(Ie),He=le(xe.line,xe.ch,je?Oe.text.length+1:null).end,Je=le(ye.line,je?0:null,ye.ch).start;je&&(He.top<Je.top-2?(ne(He.right,He.top,null,He.bottom),ne(G,Je.top,Je.left,Je.bottom)):ne(He.right,He.top,Je.left-He.right,He.bottom)),He.bottom<Je.top&&ne(G,He.bottom,null,Je.top)}n.appendChild(S)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ae(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ae(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,j=void 0,G=0;if(i.hidden)continue;if(B&&N<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var X=i.node.getBoundingClientRect();j=X.bottom-X.top,!S&&i.text.firstChild&&(G=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ne=i.line.height-j;if((ne>.005||ne<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var le=0;le<i.rest.length;le++)To(i.rest[le]);if(G>e.display.sizerWidth){var xe=Math.ceil(G/kn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=wr(t,r),j=wr(t,i);if(n&&n.ensure){var G=n.ensure.from.line,V=n.ensure.to.line;G<S?(S=G,j=wr(t,lr(ot(t,G))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(S=wr(t,lr(ot(t,V))-e.wrapper.clientHeight),j=V)}return{from:S,to:Math.max(j,S+1)}}function Ys(e,t){if(Me(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&&!b){var S=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ar(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var j=!1,G=br(e,t),V=!n||n==t?G:br(e,n);i={left:Math.min(G.left,V.left),top:Math.min(G.top,V.top)-r,right:Math.max(G.left,V.left),bottom:Math.max(G.bottom,V.bottom)+r};var X=Ca(e,i),ne=e.doc.scrollTop,le=e.doc.scrollLeft;if(X.scrollTop!=null&&(ai(e,X.scrollTop),Math.abs(e.doc.scrollTop-ne)>1&&(j=!0)),X.scrollLeft!=null&&(cn(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-le)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=Rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),j={};t.bottom-t.top>S&&(t.bottom=t.top+S);var G=e.doc.height+fa(n),V=t.top<r,X=t.bottom>G-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+S){var ne=Math.min(t.top,(X?G:t.bottom)-S);ne!=i&&(j.scrollTop=ne)}var le=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-le,ye=sn(e)-n.gutters.offsetWidth,Oe=t.right-t.left>ye;return Oe&&(t.right=t.left+ye),t.left<10?j.scrollLeft=0:t.left<xe?j.scrollLeft=Math.max(0,t.left+le-(Oe?0:10)):t.right>ye+xe-3&&(j.scrollLeft=t.right+(Oe?0:10)-ye),j}function Aa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Mn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Da(e,{top:t}),wo(e,t,!0),L&&Da(e),li(e,100)}function wo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function cn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Oo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ar(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=s&&!w?"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},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function _n(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ao={native:fn,null:si};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),we(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Tt(e.curOp)}function pn(e){var t=e.curOp;t&&Lt(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 S=0;S<t.length;S++)nl(t[S]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&kr(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 Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ar(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==k();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&_n(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&xo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,pt(r,e.scrollToPos.from),pt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(S)for(var G=0;G<S.length;++G)S[G].lines.length||Ae(S[G],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&Ae(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ae(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{pn(e)}}function Gt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{pn(e)}}}function er(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{pn(this)}}}function zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{pn(t)}}}function li(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=Ue(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var j=S.styles,G=S.text.length>e.options.maxHighlightLength?pr(t.mode,r.state):null,V=Li(e,S,r,!0);G&&(r.state=G),S.styles=V.styles;var X=S.styleClasses,ne=V.classes;ne?S.styleClasses=ne:X&&(S.styleClasses=null);for(var le=!j||j.length!=S.styles.length||X!=ne&&(!X||!ne||X.bgClass!=ne.bgClass||X.textClass!=ne.textClass),xe=0;!le&&xe<j.length;++xe)le=j[xe]!=S.styles[xe];le&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&$n(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var S=0;S<i.length;S++)Kr(e,i[S],"text")})}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=xa(e),this.events=[]};Gi.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ae.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=Ar(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ar(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=k();if(!t||!m(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&m(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==k())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&m(document.body,e.anchorNode)&&m(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function La(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&&vo(e)==0)return!1;Ro(e)&&(Gr(e),t.dims=xa(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),mr&&(S=Wr(e.doc,S),j=Ii(e.doc,j));var G=S!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,j),n.viewOffset=lr(ot(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!G&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,G&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!La(e,t))break;Wi(e);var i=oi(e);ni(e),_n(e,i),Ra(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 Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),_n(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,j=S.firstChild;function G(Oe){var Ie=Oe.nextSibling;return P&&s&&e.display.currentWheelTarget==Oe?Oe.style.display="none":Oe.parentNode.removeChild(Oe),Ie}for(var V=r.view,X=r.viewFrom,ne=0;ne<V.length;ne++){var le=V[ne];if(!le.hidden)if(!le.node||le.node.parentNode!=S){var xe=Ns(e,le,X,n);S.insertBefore(xe,j)}else{for(;j!=le.node;)j=G(j);var ye=i&&t!=null&&t<=X&&le.lineNumber;le.changes&&(q(le.changes,"gutter")>-1&&(ye=!1),Ja(e,le,X,n)),ye&&(h(le.lineNumber),le.lineNumber.appendChild(document.createTextNode(yn(e.options,X)))),j=le.node.nextSibling}X+=le.size}for(;j;)j=G(j)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+Ar(e)+"px"}function Oo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=S),n[j].gutterBackground&&(n[j].gutterBackground.style.left=S));var G=n[j].alignable;if(G)for(var V=0;V<G.length;V++)G[V].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,j=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Oa(e.display),!0}return!1}function ka(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],j=null;if(typeof S!="string"&&(j=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ko(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],S=i.className,j=i.style,G=t.appendChild(o("div",null,"CodeMirror-gutter "+S));j&&(G.style.cssText=j),S=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Oa(e)}function ui(e){ko(e.display),rr(e),Oo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=E("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=E("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=E("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[S],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&N<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(L&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ka(r.gutters,r.lineNumbers),ko(i),n.init(i)}var zi=0,fr=null;B?fr=-.53:L?fr=15:c?fr=-.7:R&&(fr=-1/3);function Po(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Po(e);return t.x*=fr,t.y*=fr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,S=e.display,j=S.scroller,G=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&G||i&&V))return;if(i&&s&&P){e:for(var X=t.target,ne=S.view;X!=j;X=X.parentNode)for(var le=0;le<ne.length;le++)if(ne[le].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!p&&fr!=null){i&&V&&ai(e,Math.max(0,j.scrollTop+i*fr)),cn(e,Math.max(0,j.scrollLeft+r*fr)),(!i||i&&V)&&Q(t),S.wheelStartX=null;return}if(i&&fr!=null){var xe=i*fr,ye=e.doc.scrollTop,Oe=ye+S.wrapper.clientHeight;xe<0?ye=Math.max(0,ye+xe-50):Oe=Math.min(e.doc.height,Oe+xe+50),Da(e,{top:ye,bottom:Oe})}zi<20&&(S.wheelStartX==null?(S.wheelStartX=j.scrollLeft,S.wheelStartY=j.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Ie=j.scrollLeft-S.wheelStartX,je=j.scrollTop-S.wheelStartY,He=je&&S.wheelDY&&je/S.wheelDY||Ie&&S.wheelDX&&Ie/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!He)return;fr=(fr*zi+He)/(zi+1),++zi},200)):(S.wheelDX+=r,S.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return bn(this.anchor,this.head)},At.prototype.to=function(){return tn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function xr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return ct(xe.from(),ye.from())}),n=q(t,i);for(var S=1;S<t.length;S++){var j=t[S],G=t[S-1],V=ct(G.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var X=bn(G.from(),j.from()),ne=tn(G.to(),j.to()),le=G.empty()?j.from()==j.head:G.from()==G.head;S<=n&&--n,t.splice(--S,2,new At(le?ne:X,le?X:ne))}}return new hr(t,n)}function zr(e,t){return new hr([new At(e,t||e)],0)}function Vr(e){return e.text?Fe(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(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),Fe(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new At(_o(i.anchor,t),_o(i.head,t)))}return xr(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),S=i,j=0;j<t.length;j++){var G=t[j],V=Io(G.from,i,S),X=Io(Vr(G),i,S);if(i=G.to,S=X,n=="around"){var ne=e.sel.ranges[j],le=ct(ne.head,ne.anchor)<0;r[j]=new At(le?X:V,le?V:X)}else r[j]=new At(V,V)}return new hr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,li(e,100),e.state.modeGen++,e.curOp&&rr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function i(Je){return n?n[Je]:null}function S(Je,Ke,tt){la(Je,Ke,tt,r),Ot(Je,"change",Je,t)}function j(Je,Ke){for(var tt=[],dt=Je;dt<Ke;++dt)tt.push(new Hr(X[dt],i(dt),r));return tt}var G=t.from,V=t.to,X=t.text,ne=ot(e,G.line),le=ot(e,V.line),xe=$(X),ye=i(X.length-1),Oe=V.line-G.line;if(t.full)e.insert(0,j(0,X.length)),e.remove(X.length,e.size-X.length);else if(No(e,t)){var Ie=j(0,X.length-1);S(le,le.text,ye),Oe&&e.remove(G.line,Oe),Ie.length&&e.insert(G.line,Ie)}else if(ne==le)if(X.length==1)S(ne,ne.text.slice(0,G.ch)+xe+ne.text.slice(V.ch),ye);else{var je=j(1,X.length-1);je.push(new Hr(xe+ne.text.slice(V.ch),ye,r)),S(ne,ne.text.slice(0,G.ch)+X[0],i(0)),e.insert(G.line+1,je)}else if(X.length==1)S(ne,ne.text.slice(0,G.ch)+X[0]+le.text.slice(V.ch),i(0)),e.remove(G.line+1,Oe);else{S(ne,ne.text.slice(0,G.ch)+X[0],i(0)),S(le,xe+le.text.slice(V.ch),ye);var He=j(1,X.length-1);Oe>1&&e.remove(G.line+1,Oe-1),e.insert(G.line+1,He)}Ot(e,"change",e,t)}function Xr(e,t,n){function r(i,S,j){if(i.linked)for(var G=0;G<i.linked.length;++G){var V=i.linked[G];if(V.doc==S)continue;var X=j&&V.sharedHist;if(n&&!X)continue;t(V.doc,X),r(V.doc,i,X)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ma(e),Uo(e),e.options.lineWrapping||kr(e),e.options.mode=t.modeOption,rr(e)}function Uo(e){(e.doc.direction=="rtl"?I:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){Uo(e),rr(e)})}function Vi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Bo(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 jo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,j,G;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(i,i.lastOp==r)))G=$(j.changes),ct(t.from,t.to)==0&&ct(t.from,G.to)==0?G.to=Vr(t):j.changes.push(Ia(e,t));else{var V=$(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,G||Ae(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||ml(e,S,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=j.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ho(e,t){var n=yl(e,t),r=Rr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],j=r[i];if(S&&j){e:for(var G=0;G<j.length;++G){for(var V=j[G],X=0;X<S.length;++X)if(S[X].marker==V.marker)continue e;S.push(V)}}else j&&(n[i]=j)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?hr.prototype.deepCopy.call(S):S);continue}var j=S.changes,G=[];r.push({changes:G});for(var V=0;V<j.length;++V){var X=j[V],ne=void 0;if(G.push({from:X.from,to:X.to,text:X.text}),t)for(var le in X)(ne=le.match(/^spans_(\d+)$/))&&(q(t,Number(ne[1]))>-1&&($(G)[le]=X[le],delete X[le]))}}return r}function Na(e,t,n,r){if(r){var i=e.anchor;if(n){var S=ct(t,i)<0;S!=ct(n,i)<0?(i=t,t=n):S!=ct(t,n)<0&&(t=n)}return new At(i,t)}else return new At(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Jt(e,new hr([Na(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Na(e.sel.ranges[S],t[S],null,i);var j=xr(e.cm,r,e.sel.primIndex);Jt(e,j,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Jt(e,xr(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Jt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new At(pt(e,i[S].anchor),pt(e,i[S].head))},origin:n&&n.origin};return Ae(e,"beforeSelectionChange",e,r),e.cm&&Ae(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?xr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Jt(e,t,n)}function Jt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Mn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Ot(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var j=t.ranges[S],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],V=Qi(e,j.anchor,G&&G.anchor,n,r),X=Qi(e,j.head,G&&G.head,n,r);(i||V!=j.anchor||X!=j.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new At(V,X))}return i?xr(e.cm,i,t.primIndex):t}function Nn(e,t,n,r,i){var S=ot(e,t.line);if(S.markedSpans)for(var j=0;j<S.markedSpans.length;++j){var G=S.markedSpans[j],V=G.marker,X="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,ne="selectRight"in V?!V.selectRight:V.inclusiveRight;if((G.from==null||(X?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(ne?G.to>=t.ch:G.to>t.ch))){if(i&&(Ae(V,"beforeCursorEnter"),V.explicitlyCleared))if(S.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var le=V.find(r<0?1:-1),xe=void 0;if((r<0?ne:X)&&(le=$o(e,le,-r,le&&le.line==t.line?S:null)),le&&le.line==t.line&&(xe=ct(le,n))&&(r<0?xe<0:xe>0))return Nn(e,le,t,r,i)}var ye=V.find(r<0?-1:1);return(r<0?X:ne)&&(ye=$o(e,ye,r,ye.line==t.line?S:null)),ye?Nn(e,ye,t,r,i):null}}return t}function Qi(e,t,n,r,i){var S=r||1,j=Nn(e,t,n,S,i)||!i&&Nn(e,t,n,S,!0)||Nn(e,t,n,-S,i)||!i&&Nn(e,t,n,-S,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?pt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||ot(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Qo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),me)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,S,j,G){i&&(r.from=pt(e,i)),S&&(r.to=pt(e,S)),j&&(r.text=j),G!==void 0&&(r.origin=G)}),Ae(e,"beforeChange",e,r),e.cm&&Ae(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 Fn(e,t,n){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Fn)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=ki&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Rr(e,t));var r=[];Xr(e,function(i,S){!S&&q(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Rr(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,j=e.sel,G=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,X=0;X<G.length&&!(S=G[X],n?S.ranges&&!S.equals(e.sel):!S.ranges);X++);if(X==G.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=G.pop(),S.ranges){if(Xi(S,V),n&&!S.equals(e.sel)){Jt(e,S,{clearRedo:!1});return}j=S}else if(r){G.push(S);return}else break;var ne=[];Xi(j,V),V.push({changes:ne,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var le=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),xe=function(Ie){var je=S.changes[Ie];if(je.origin=t,le&&!Jo(e,je,!1))return G.length=0,{};ne.push(Ia(e,je));var He=Ie?Pa(e,je):$(G);ci(e,je,He,Ho(e,je)),!Ie&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Vr(je)});var Je=[];Xr(e,function(Ke,tt){!tt&&q(Je,Ke.history)==-1&&(rs(Ke.history,je),Je.push(Ke.history)),ci(Ke,je,null,Ho(Ke,je))})},ye=S.changes.length-1;ye>=0;--ye){var Oe=xe(ye);if(Oe)return Oe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(ae(e.sel.ranges,function(i){return new At(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){rr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,ci)(e,t,n,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);qo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Fe(S,ot(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?xl(e.cm,t,r):_a(e,t,r),$i(e,n,me),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,S=t.from,j=t.to,G=!1,V=S.line;e.options.lineWrapping||(V=Ct(Qt(ot(r,S.line))),r.iter(V,j.line+1,function(ye){if(ye==i.maxLine)return G=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),_a(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,S.line+t.text.length,function(ye){var Oe=Dn(ye);Oe>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Oe,i.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),Ri(r,S.line),li(e,400);var X=t.text.length-(j.line-S.line)-1;t.full?rr(e):S.line==j.line&&t.text.length==1&&!No(e.doc,t)?Kr(e,S.line,"text"):rr(e,S.line,j.line+1,X);var ne=de(e,"changes"),le=de(e,"change");if(le||ne){var xe={from:S,to:j,text:t.text,removed:t.removed,origin:t.origin};le&&Ot(e,"change",e,xe),ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Un(e,t,n,r,i){var S;r||(r=n),ct(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],j=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var G=0;G<S.ranges.length;G++)es(S.ranges[G].anchor,t,n,r),es(S.ranges[G].head,t,n,r);continue}for(var V=0;V<S.changes.length;++V){var X=S.changes[V];if(n<X.from.line)X.from=Fe(X.from.line+r,X.from.ch),X.to=Fe(X.to.line+r,X.to.ch);else if(t<=X.to.line){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=ot(e,Xn(e,t)):i=Ct(t),i==null?null:(r(S,i)&&e.cm&&Kr(e.cm,i,n),S)}function hi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),Ot(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 pi(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}pi.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 S=Math.min(t,i-e),j=r.height;if(r.removeInner(e,S),this.height-=j-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var G=[];this.collapse(G),this.children=[new hi(G)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,G=j;G<i.lines.length;){var V=new hi(i.lines.slice(G,G+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(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 pi(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],S=i.chunkSize();if(e<S){var j=Math.min(t,S-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=S}}};var mi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};mi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ct(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 S=ti(this);cr(n,Math.max(0,n.height-S)),e&&(ur(e,function(){ns(e,n,-S),Kr(e,r,"widget")}),Ot(e,"lineWidgetCleared",e,this,r))},mi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Ot(n,"lineWidgetChanged",n,e,Ct(r))})},ce(mi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function El(e,t,n,r){var i=new mi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),fi(e,t,"widget",function(j){var G=j.widgets||(j.widgets=[]);if(i.insertAt==null?G.push(i):G.splice(Math.min(G.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,S&&!yr(e,j)){var V=lr(j)<e.scrollTop;cr(j,j.height+ti(i)),V&&Aa(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Ot(S,"lineWidgetAdded",S,i,typeof t=="number"?t:Ct(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),de(this,"clear")){var n=this.find();n&&Ot(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var j=this.lines[S],G=Fr(j.markedSpans,this);e&&!this.collapsed?Kr(e,Ct(j),"text"):e&&(G.to!=null&&(i=Ct(j)),G.from!=null&&(r=Ct(j))),j.markedSpans=Ur(j.markedSpans,G),G.from==null&&this.collapsed&&!yr(this.doc,j)&&e&&cr(j,Rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var X=Qt(this.lines[V]),ne=Dn(X);ne>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ne,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Ot(e,"markerCleared",e,this,r,i),t&&pn(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 S=this.lines[i],j=Fr(S.markedSpans,this);if(j.from!=null&&(n=Fe(t?S:Ct(S),j.from),e==-1))return n;if(j.to!=null&&(r=Fe(t?S:Ct(S),j.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ur(r,function(){var i=t.line,S=Ct(t.line),j=pa(r,S);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var G=n.height;n.height=null;var V=ti(n)-G;V&&cr(i,i.height+V)}Ot(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)}},ce(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Gt(e.cm,Bn)(e,t,n,r,i);var S=new Yr(e,i),j=ct(t,n);if(r&&M(r,S,!1),j>0||j==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=E("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(qn(e,t.line,t,n,S)||t.line!=n.line&&qn(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}S.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var G=t.line,V=e.cm,X;if(e.iter(G,n.line+1,function(le){V&&S.collapsed&&!V.options.lineWrapping&&Qt(le)==V.display.maxLine&&(X=!0),S.collapsed&&G!=t.line&&cr(le,0),Br(le,new En(S,G==t.line?t.ch:null,G==n.line?n.ch:null)),++G}),S.collapsed&&e.iter(t.line,n.line+1,function(le){yr(e,le)&&cr(le,0)}),S.clearOnEnter&&we(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),V){if(X&&(V.curOp.updateMaxLine=!0),S.collapsed)rr(V,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ne=t.line;ne<=n.line;ne++)Kr(V,ne,"text");S.atomic&&Xo(V.doc),Ot(V,"markerAdded",V,S)}return S}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ot(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(gi);function Tl(e,t,n,r,i){r=M(r),r.shared=!1;var S=[Bn(e,t,n,r,i)],j=S[0],G=r.widgetNode;return Xr(e,function(V){G&&(r.widgetNode=G.cloneNode(!0)),S.push(Bn(V,pt(V,t),pt(V,n),r,i));for(var X=0;X<V.linked.length;++X)if(V.linked[X].isParent)return;j=$(S)}),new gi(S,j)}function as(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),S=e.clipPos(i.from),j=e.clipPos(i.to);if(ct(S,j)){var G=Bn(e,S,j,r.primary,r.primary.type);r.markers.push(G),G.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];Xr(i.primary.doc,function(V){return S.push(V)});for(var j=0;j<i.markers.length;j++){var G=i.markers[j];q(S,G.doc)==-1&&(G.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,nr=function(e,t,n,r,i){if(!(this instanceof nr))return new nr(e,t,n,r,i);n==null&&(n=0),pi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Fe(n,0);this.sel=zr(S),this.history=new Vi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),_a(this,{from:S,to:S,text:e}),Jt(this,zr(S),me)};nr.prototype=Ce(pi.prototype,{constructor:nr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:zt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Fn(this,{from:t,to:Fe(n,ot(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Jt(this,zr(t),me)}),replaceRange:function(e,t,n,r){t=pt(this,t),n=n?pt(this,n):t,Un(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,pt(this,e),pt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zr(this,e))return ot(this,e)},getLineNumber:function(e){return Ct(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ot(this,e)),Qt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pt(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:zt(function(e,t,n){Go(this,pt(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){Go(this,pt(this,e),pt(this,t||e),n)}),extendSelection:zt(function(e,t,n){Yi(this,pt(this,e),t&&pt(this,t),n)}),extendSelections:zt(function(e,t){Ko(this,Ai(this,e),t)}),extendSelectionsBy:zt(function(e,t){var n=ae(this.sel.ranges,e);Ko(this,Ai(this,n),t)}),setSelections:zt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new At(pt(this,e[i].anchor),pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Jt(this,xr(this.cm,r,t),n)}),addSelection:zt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new At(pt(this,e),pt(this,t||e))),Jt(this,xr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Sr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Sr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:zt(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var j=i.ranges[S];r[S]={from:j.from(),to:j.to(),text:this.splitLines(e[S]),origin:n}}for(var G=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Fn(this,r[V]);G?zo(this,G):this.cm&&Mn(this.cm)}),undo:zt(function(){Ji(this,"undo")}),redo:zt(function(){Ji(this,"redo")}),undoSelection:zt(function(){Ji(this,"undo",!0)}),redoSelection:zt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:zt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ne(i)&&(r.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=ot(this,e),!e)return null}else if(t=Ct(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:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var j=S.match(T(n));if(!j)return!1;var G=j.index+j[0].length;r[i]=S.slice(0,j.index)+(!j.index||G==S.length?"":" ")+S.slice(G)||null}else return!1;return!0})}),addLineWidget:zt(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(this,pt(this,e),pt(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=pt(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=pt(this,e);var t=[],n=ot(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=pt(this,e),t=pt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var j=S.markedSpans;if(j)for(var G=0;G<j.length;G++){var V=j[G];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),pt(this,Fe(n,t))},indexFromPos:function(e){e=pt(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 nr(Vn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new nr(Vn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):it(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:zt(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)})}),nr.prototype.eachLine=nr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),Me(t,e)||Mr(t.display,e))return;Q(e),B&&(os=+new Date);var n=un(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,S=Array(i),j=0,G=function(){++j==i&&Gt(t,function(){n=pt(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(S.filter(function(Oe){return Oe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,ye),zo(t.doc,zr(pt(t.doc,n),pt(t.doc,Vr(ye))))})()},V=function(ye,Oe){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,ye.type)==-1){G();return}var Ie=new FileReader;Ie.onerror=function(){return G()},Ie.onload=function(){var je=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){G();return}S[Oe]=je,G()},Ie.readAsText(ye)},X=0;X<r.length;X++)V(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 le;if(t.state.draggingText&&!t.state.draggingText.copy&&(le=t.listSelections()),$i(t.doc,zr(n,n)),le)for(var xe=0;xe<le.length;++xe)Un(t.doc,"",le[xe].anchor,le[xe].head,"drag");t.replaceSelection(ne,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-os<100)){se(t);return}if(Me(e,t)||Mr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var S=0;S<n.length;S++)e(n[S])})}var us=!1;function Ol(){if(us)return;Rl(),us=!0}function Rl(){var e;we(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(kl)},100))}),we(window,"blur",function(){return ls(Pn)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var _r={};_r.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"},_r.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"},_r.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"},_r.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"]},_r.default=s?_r.macDefault:_r.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,j=0;j<t.length-1;j++){var G=t[j];if(/^(cmd|meta|m)$/i.test(G))S=!0;else if(/^a(lt)?$/i.test(G))n=!0;else if(/^(c|ctrl|control)$/i.test(G))r=!0;else if(/^s(hift)?$/i.test(G))i=!0;else throw new Error("Unrecognized modifier name: "+G)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ae(n.split(" "),Pl),S=0;S<i.length;S++){var j=void 0,G=void 0;S==i.length-1?(G=i.join(" "),j=r):(G=i.slice(0,S+1).join(" "),j="...");var V=t[G];if(!V)t[G]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+G)}delete e[n]}for(var X in t)e[X]=t[X];return e}function jn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jn(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var j=jn(e,t.fallthrough[S],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(g?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(g?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(p&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?_r[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&ct(S.from,$(r).to)<=0;){var j=r.pop();if(ct(j.from,S.from)<0){S.from=j.from;break}}r.push(S)}ur(e,function(){for(var G=r.length-1;G>=0;G--)Un(e.doc,"",r[G].from,r[G].to,"+delete");Mn(e)})}function Ua(e,t,n){var r=ke(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Xe(n,t.doc.direction);if(S){var j=i<0?$(S):S[0],G=i<0==(j.level==1),V=G?"after":"before",X;if(j.level>0||t.doc.direction=="rtl"){var ne=On(t,n);X=i<0?n.text.length-1:0;var le=Lr(t,ne,X).top;X=Ze(function(xe){return Lr(t,ne,xe).top==le},i<0==(j.level==1)?j.from:j.to-1,X),V=="before"&&(X=Ua(n,X,1))}else X=i<0?j.to:j.from;return new Fe(r,X,V)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function _l(e,t,n,r){var i=Xe(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var S=We(i,n.ch,n.sticky),j=i[S];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var G=function(He,Je){return Ua(t,He instanceof Fe?He.ch:He,Je)},V,X=function(He){return e.options.lineWrapping?(V=V||On(e,t),mo(e,t,V,He)):{begin:0,end:t.text.length}},ne=X(n.sticky=="before"?G(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var le=j.level==1==r<0,xe=G(n,le?1:-1);if(xe!=null&&(le?xe<=j.to&&xe<=ne.end:xe>=j.from&&xe>=ne.begin)){var ye=le?"before":"after";return new Fe(n.line,xe,ye)}}var Oe=function(He,Je,Ke){for(var tt=function(kt,Vt){return Vt?new Fe(n.line,G(kt,1),"before"):new Fe(n.line,kt,"after")};He>=0&&He<i.length;He+=Je){var dt=i[He],st=Je>0==(dt.level!=1),gt=st?Ke.begin:G(Ke.end,-1);if(dt.from<=gt&><dt.to)return tt(gt,st);if(gt=st?dt.from:G(dt.to,-1),Ke.begin<=gt&><Ke.end)return tt(gt,st)}},Ie=Oe(S+r,r,ne);if(Ie)return Ie;var je=r>0?ne.end:G(ne.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ie=Oe(r>0?0:i.length-1,r,X(je)),Ie)?Ie:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=ot(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:pt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(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/)?ps(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 S=n[i].from(),j=K(e.getLine(S.line),S.ch,r);t.push(pe(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=ot(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=ot(e.doc,i.line-1).text;j&&(i=new Fe(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(i.line-1,j.length-1),i,"+transpose"))}}n.push(new At(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Mn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=ot(e.doc,t),r=Qt(n);return r!=n&&(t=Ct(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=ot(e.doc,t),r=jr(n);return r!=n&&(t=Ct(r)),ja(!0,e,n,t,-1)}function ps(e,t){var n=hs(e,t.line),r=ot(e.doc,n.line),i=Xe(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=S&&t.ch;return Fe(n.line,j?0:S,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=be}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Fl=new Y;function xi(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,i+" "+t,n,r))return!0}return ms(e,t,n,r)}function ms(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ot(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||xi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):xi(e,n,t,function(r){return ea(e,r)}):!1}function Ul(e,t,n){return xi(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=k(),Me(t,e))return;B&&N<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);p&&(Wa=r?n:null,!r&&n==88&&!vt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!s&&!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;I(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}we(document,"keyup",n),we(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Me(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Mr(t.display,e)||Me(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(p&&n==Wa){Wa=null,Q(e);return}if(p&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ct(t,this.pos)==0&&n==this.button};var Ei,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(Ei=Ti=null,"triple"):Ei&&Ei.compare(n,e,t)?(Ti=new Ha(n,e,t),Ei=null,"double"):(Ei=new Ha(n,e,t),Ti=null,"single")}function xs(e){var t=this,n=t.display;if(Me(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Mr(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=De(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):Te(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(D?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,xi(e,cs(S,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=j(e,n)!=be}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(_(xo,e),0):e.curOp.focus=k();var i=Kl(e,n,r),S=e.doc.sel,j;e.options.dragDrop&&Be&&!e.isReadOnly()&&n=="single"&&(j=S.contains(t))>-1&&(ct((j=S.ranges[j]).from(),t)<0||t.xRel>0)&&(ct(j.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,j=Gt(e,function(X){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",j),Ye(i.wrapper.ownerDocument,"mousemove",G),Ye(i.scroller,"dragstart",V),Ye(i.scroller,"drop",j),S||(Q(X),r.addNew||Yi(e.doc,n,null,null,r.extend),P&&!R||B&&N==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),G=function(X){S=S||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},V=function(){return S=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),we(i.wrapper.ownerDocument,"mouseup",j),we(i.wrapper.ownerDocument,"mousemove",G),we(i.scroller,"dragstart",V),we(i.scroller,"drop",j),Eo(e),setTimeout(function(){return i.input.focus()},20)}function Es(e,t,n){if(n=="char")return new At(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new At(Fe(t.line,0),pt(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new At(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;Q(t);var j,G,V=S.sel,X=V.ranges;if(r.addNew&&!r.extend?(G=S.sel.contains(n),G>-1?j=X[G]:j=new At(n,n)):(j=S.sel.primary(),G=S.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new At(n,n)),n=un(e,t,!0,!0),G=-1;else{var ne=Es(e,n,r.unit);r.extend?j=Na(j,ne.anchor,ne.head,r.extend):j=ne}r.addNew?G==-1?(G=X.length,Jt(S,xr(e,X.concat([j]),G),{scroll:!1,origin:"*mouse"})):X.length>1&&X[G].empty()&&r.unit=="char"&&!r.extend?(Jt(S,xr(e,X.slice(0,G).concat(X.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),V=S.sel):Fa(S,G,j,he):(G=0,Jt(S,new hr([j],0),he),V=S.sel);var le=n;function xe(Ke){if(ct(le,Ke)==0)return;if(le=Ke,r.unit=="rectangle"){for(var tt=[],dt=e.options.tabSize,st=K(ot(S,n.line).text,n.ch,dt),gt=K(ot(S,Ke.line).text,Ke.ch,dt),kt=Math.min(st,gt),Vt=Math.max(st,gt),_t=Math.min(n.line,Ke.line),dr=Math.min(e.lastLine(),Math.max(n.line,Ke.line));_t<=dr;_t++){var ir=ot(S,_t).text,Bt=ue(ir,kt,dt);kt==Vt?tt.push(new At(Fe(_t,Bt),Fe(_t,Bt))):ir.length>Bt&&tt.push(new At(Fe(_t,Bt),Fe(_t,ue(ir,Vt,dt))))}tt.length||tt.push(new At(n,n)),Jt(S,xr(e,V.ranges.slice(0,G).concat(tt),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ke)}else{var ar=j,$t=Es(e,Ke,r.unit),Ht=ar.anchor,jt;ct($t.anchor,Ht)>0?(jt=$t.head,Ht=bn(ar.from(),$t.anchor)):(jt=$t.anchor,Ht=tn(ar.to(),$t.head));var Nt=V.ranges.slice(0);Nt[G]=Xl(e,new At(pt(S,Ht),jt)),Jt(S,xr(e,Nt,G),he)}}var ye=i.wrapper.getBoundingClientRect(),Oe=0;function Ie(Ke){var tt=++Oe,dt=un(e,Ke,!0,r.unit=="rectangle");if(!dt)return;if(ct(dt,le)!=0){e.curOp.focus=k(),xe(dt);var st=Hi(i,S);(dt.line>=st.to||dt.line<st.from)&&setTimeout(Gt(e,function(){Oe==tt&&Ie(Ke)}),150)}else{var gt=Ke.clientY<ye.top?-20:Ke.clientY>ye.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Oe!=tt)return;i.scroller.scrollTop+=gt,Ie(Ke)}),50)}}function je(Ke){e.state.selectingText=!1,Oe=Infinity,Ke&&(Q(Ke),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",He),Ye(i.wrapper.ownerDocument,"mouseup",Je),S.history.lastSelOrigin=null}var He=Gt(e,function(Ke){Ke.buttons===0||!De(Ke)?je(Ke):Ie(Ke)}),Je=Gt(e,je);e.state.selectingText=Je,we(i.wrapper.ownerDocument,"mousemove",He),we(i.wrapper.ownerDocument,"mouseup",Je)}function Xl(e,t){var n=t.anchor,r=t.head,i=ot(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var S=Xe(i);if(!S)return t;var j=We(S,n.ch,n.sticky),G=S[j];if(G.from!=n.ch&&G.to!=n.ch)return t;var V=j+(G.from==n.ch==(G.level!=1)?0:1);if(V==0||V==S.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ne=We(S,r.ch,r.sticky),le=ne-j||(r.ch-n.ch)*(G.level==1?-1:1);ne==V-1||ne==V?X=le<0:X=le>0}var xe=S[V+(X?-1:0)],ye=X==(xe.level==1),Oe=ye?xe.from:xe.to,Ie=ye?"after":"before";return n.ch==Oe&&n.sticky==Ie?t:new At(new Fe(n.line,Oe,Ie),r)}function Ts(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,G=j.lineDiv.getBoundingClientRect();if(S>G.bottom||!de(e,n))return te(t);S-=G.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var X=j.gutters.childNodes[V];if(X&&X.getBoundingClientRect().right>=i){var ne=wr(e.doc,S),le=e.display.gutterSpecs[V];return Ae(e,n,e,ne,le.className,t),te(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(Mr(e.display,t)||Yl(e,t))return;if(Me(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,S,j){e.defaults[r]=i,S&&(t[r]=j?function(G,V,X){X!=Hn&&S(G,V,X)}:S)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),rr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],j=r.doc.first;r.doc.iter(function(V){for(var X=0;;){var ne=V.text.indexOf(i,X);if(ne==-1)break;X=ne+i.length,S.push(Fe(j,ne))}j++});for(var G=S.length-1;G>=0;G--)Un(r.doc,i,S[G],Fe(S[G].line,S[G].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Hn&&r.refresh()}),n("specialCharPlaceholder",at,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!A),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,S){var j=qi(i),G=S!=Hn&&qi(S);G&&G.detach&&G.detach(r,j),j.attach&&j.attach(r,G||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ka(i,r.options.lineNumbers),ui(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 _n(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),_n(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=ka(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,di,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,S=t?we:Ye;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),kr(e)),Ta(e),rr(e),ri(e),setTimeout(function(){return _n(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?M(t):{},M(Cs,t,!1);var r=t.value;typeof r=="string"?r=new nr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(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&&!a&&S.input.focus(),B&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),hn(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Ro(this),t.finishInit&&t.finishInit(this);for(var G=0;G<Ga.length;++G)Ga[G](this);pn(this),P&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Pt.defaults=Cs,Pt.optionHandlers=ta;function Zl(e){var t=e.display;we(t.scroller,"mousedown",Gt(e,xs)),B&&N<11?we(t.scroller,"dblclick",Gt(e,function(V){if(Me(e,V))return;var X=un(e,V);if(!X||Ka(e,V)||Mr(e.display,V))return;Q(V);var ne=e.findWordAt(X);Yi(e.doc,ne.anchor,ne.head)})):we(t.scroller,"dblclick",function(V){return Me(e,V)||Q(V)}),we(t.scroller,"contextmenu",function(V){return Ss(e,V)}),we(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ss(e,V)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(V){if(V.touches.length!=1)return!1;var X=V.touches[0];return X.radiusX<=1&&X.radiusY<=1}function j(V,X){if(X.left==null)return!0;var ne=X.left-V.left,le=X.top-V.top;return ne*ne+le*le>20*20}we(t.scroller,"touchstart",function(V){if(!Me(e,V)&&!S(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),we(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),we(t.scroller,"touchend",function(V){var X=t.activeTouch;if(X&&!Mr(t,V)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ne=e.coordsChar(t.activeTouch,"page"),le;!X.prev||j(X,X.prev)?le=new At(ne,ne):!X.prev.prev||j(X,X.prev.prev)?le=e.findWordAt(ne):le=new At(Fe(ne.line,0),pt(e.doc,Fe(ne.line+1,0))),e.setSelection(le.anchor,le.head),e.focus(),Q(V)}i()}),we(t.scroller,"touchcancel",i),we(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Ae(e,"scroll",e))}),we(t.scroller,"mousewheel",function(V){return Mo(e,V)}),we(t.scroller,"DOMMouseScroll",function(V){return Mo(e,V)}),we(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Me(e,V)||se(V)},over:function(V){Me(e,V)||(Dl(e,V),se(V))},start:function(V){return Ll(e,V)},drop:Gt(e,Al),leave:function(V){Me(e,V)||ss(e)}};var G=t.input.getField();we(G,"keyup",function(V){return ys.call(e,V)}),we(G,"keydown",Gt(e,vs)),we(G,"keypress",Gt(e,bs)),we(G,"focus",function(V){return wa(e,V)}),we(G,"blur",function(V){return Pn(e,V)})}var Ga=[];Pt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Ue(e,t).state:n="prev");var j=e.options.tabSize,G=ot(i,t),V=K(G.text,null,j);G.stateAfter&&(G.stateAfter=null);var X=G.text.match(/^\s*/)[0],ne;if(!r&&!/\S/.test(G.text))ne=0,n="not";else if(n=="smart"&&(ne=i.mode.indent(S,G.text.slice(X.length),G.text),ne==be||ne>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ne=K(ot(i,t-1).text,null,j):ne=0:n=="add"?ne=V+e.options.indentUnit:n=="subtract"?ne=V-e.options.indentUnit:typeof n=="number"&&(ne=V+n),ne=Math.max(0,ne);var le="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(ne/j);ye;--ye)xe+=j,le+=" ";if(xe<ne&&(le+=pe(ne-xe)),le!=X)return Un(i,le,Fe(t,0),Fe(t,X.length),"+input"),G.stateAfter=null,!0;for(var Oe=0;Oe<i.sel.ranges.length;Oe++){var Ie=i.sel.ranges[Oe];if(Ie.head.line==t&&Ie.head.ch<X.length){var je=Fe(t,X.length);Fa(i,Oe,new At(je,je));break}}}var Er=null;function ra(e){Er=e}function za(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var j=+new Date-200,G=i=="paste"||e.state.pasteIncoming>j,V=it(t),X=null;if(G&&r.ranges.length>1)if(Er&&Er.text.join(`
|
|
`)==t){if(r.ranges.length%Er.text.length==0){X=[];for(var ne=0;ne<Er.text.length;ne++)X.push(S.splitLines(Er.text[ne]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ae(V,function(He){return[He]}));for(var le=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ye=r.ranges[xe],Oe=ye.from(),Ie=ye.to();ye.empty()&&(n&&n>0?Oe=Fe(Oe.line,Oe.ch-n):e.state.overwrite&&!G?Ie=Fe(Ie.line,Math.min(ot(S,Ie.line).text.length,Ie.ch+$(V).length)):G&&Er&&Er.lineWise&&Er.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Oe=Ie=Fe(Oe.line,0)));var je={from:Oe,to:Ie,text:X?X[xe%X.length]:V,origin:i||(G?"paste":e.state.cutIncoming>j?"cut":"+input")};Fn(e.doc,je),Ot(e,"inputRead",e,je)}t&&!G&&Ls(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var S=e.getModeAt(i.head),j=!1;if(S.electricChars){for(var G=0;G<S.electricChars.length;G++)if(t.indexOf(S.electricChars.charAt(G))>-1){j=Si(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(ot(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Ot(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function Os(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),x&&(e.style.border="1px solid black"),Os(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 S=this.options,j=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&Gt(this,t[r])(this,i,j),Ae(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:er(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");ee(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,rr(this)}),removeOverlay:er(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var j=i[S].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(S,1),this.state.modeGen++,rr(this);return}}}),indentLine:er(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,S)}),indentSelection:er(function(r){for(var i=this.doc.sel.ranges,S=-1,j=0;j<i.length;j++){var G=i[j];if(G.empty())G.head.line>S&&(Si(this,G.head.line,r,!0),S=G.head.line,j==this.doc.sel.primIndex&&Mn(this));else{var V=G.from(),X=G.to(),ne=Math.max(S,V.line);S=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var le=ne;le<S;++le)Si(this,le,r);var xe=this.doc.sel.ranges;V.ch==0&&i.length==xe.length&&xe[j].from().ch>0&&Fa(this.doc,j,new At(V,xe[j].to()),me)}}}),getTokenAt:function(r,i){return Nr(this,r,i)},getLineTokens:function(r,i){return Nr(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=pt(this.doc,r);var i=Yn(this,ot(this.doc,r.line)),S=0,j=(i.length-1)/2,G=r.ch,V;if(G==0)V=i[2];else for(;;){var X=S+j>>1;if((X?i[X*2-1]:0)>=G)j=X;else if(i[X*2+1]<G)S=X+1;else{V=i[X*2+2];break}}var ne=V?V.indexOf("overlay "):-1;return ne<0?V:ne==0?null:V.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 S=[];if(!n.hasOwnProperty(i))return S;var j=n[i],G=this.getModeAt(r);if(typeof G[i]=="string")j[G[i]]&&S.push(j[G[i]]);else if(G[i])for(var V=0;V<G[i].length;V++){var X=j[G[i][V]];X&&S.push(X)}else G.helperType&&j[G.helperType]?S.push(j[G.helperType]):j[G.name]&&S.push(j[G.name]);for(var ne=0;ne<j._global.length;ne++){var le=j._global[ne];le.pred(G,this)&&q(S,le.val)==-1&&S.push(le.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Xn(S,r==null?S.first+S.size-1:r),Ue(this,r+1,i).state},cursorCoords:function(r,i){var S,j=this.doc.sel.primary();return r==null?S=j.head:typeof r=="object"?S=pt(this.doc,r):S=r?j.from():j.to(),br(this,S,i||"page")},charCoords:function(r,i){return ga(this,pt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var j=!1,G;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,j=!0),G=ot(this.doc,r)}else G=r;return Ui(this,G,{top:0,left:0},i||"page",S||j).top+(j?this.doc.height-lr(G):0)},defaultTextHeight:function(){return Rn(this.display)},defaultCharWidth:function(){return kn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,j,G){var V=this.display;r=br(this,pt(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),V.sizer.appendChild(i),j=="over")X=r.top;else if(j=="above"||j=="near"){var le=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>le)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=le&&(X=r.bottom),ne+i.offsetWidth>xe&&(ne=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",G=="right"?(ne=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(G=="left"?ne=0:G=="middle"&&(ne=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ne+"px"),S&&Qs(this,{left:ne,top:X,right:ne+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:er(vs),triggerOnKeyPress:er(bs),triggerOnKeyUp:ys,triggerOnMouseDown:er(xs),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:er(function(r){Ls(this,r)}),findPosH:function(r,i,S,j){var G=1;i<0&&(G=-1,i=-i);for(var V=pt(this.doc,r),X=0;X<i&&!(V=Va(this.doc,V,G,S,j),V.hitSide);++X);return V},moveH:er(function(r,i){var S=this;this.extendSelectionsBy(function(j){return S.display.shift||S.doc.extend||j.empty()?Va(S.doc,j.head,r,i,S.options.rtlMoveVisually):r<0?j.from():j.to()},fe)}),deleteH:er(function(r,i){var S=this.doc.sel,j=this.doc;S.somethingSelected()?j.replaceSelection("",null,"+delete"):Wn(this,function(G){var V=Va(j,G.head,r,i,!1);return r<0?{from:V,to:G.head}:{from:G.head,to:V}})}),findPosV:function(r,i,S,j){var G=1,V=j;i<0&&(G=-1,i=-i);for(var X=pt(this.doc,r),ne=0;ne<i;++ne){var le=br(this,X,"div");if(V==null?V=le.left:le.left=V,X=ks(this,le,G,S),X.hitSide)break}return X},moveV:er(function(r,i){var S=this,j=this.doc,G=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ne){if(V)return r<0?ne.from():ne.to();var le=br(S,ne.head,"div");ne.goalColumn!=null&&(le.left=ne.goalColumn),G.push(le.left);var xe=ks(S,le,r,i);return i=="page"&&ne==j.sel.primary()&&Aa(S,ga(S,xe,"div").top-le.top),xe},fe),G.length)for(var X=0;X<j.sel.ranges.length;X++)j.sel.ranges[X].goalColumn=G[X]}),findWordAt:function(r){var i=this.doc,S=ot(i,r.line).text,j=r.ch,G=r.ch;if(S){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||G==S.length)&&j?--j:++G;for(var X=S.charAt(j),ne=Re(X,V)?function(le){return Re(le,V)}:/\s/.test(X)?function(le){return/\s/.test(le)}:function(le){return!/\s/.test(le)&&!Re(le)};j>0&&ne(S.charAt(j-1));)--j;for(;G<S.length&&ne(S.charAt(G));)++G}return new At(Fe(r.line,j),Fe(r.line,G))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),Ae(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:er(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ar(this)-this.display.barHeight,width:r.scrollWidth-Ar(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(this)}},scrollIntoView:er(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:er(function(r,i){var S=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(V){if(V.widgets){for(var X=0;X<V.widgets.length;X++)if(V.widgets[X].noHScroll){Kr(S,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,Ae(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return pn(this)},refresh:er(function(){var r=this.display.cachedTextHeight;rr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(r==null||Math.abs(r-Rn(this.display))>.5||this.options.lineWrapping)&&Ta(this),Ae(this,"refresh",this)}),swapDoc:er(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ot(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}},ce(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,j){e.registerHelper(r,i,j),n[r]._global.push({pred:S,val:j})}}function Va(e,t,n,r,i){var S=t,j=n,G=ot(e,t.line),V=i&&e.direction=="rtl"?-n:n;function X(){var Je=t.line+V;return Je<e.first||Je>=e.first+e.size?!1:(t=new Fe(Je,t.ch,t.sticky),G=ot(e,Je))}function ne(Je){var Ke;if(r=="codepoint"){var tt=G.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ke=null:Ke=new Fe(t.line,Math.max(0,Math.min(G.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ke=_l(e.cm,G,t,n):Ke=Ba(G,t,n);if(Ke==null)if(!Je&&X())t=ja(i,e.cm,G,t.line,V);else return!1;else t=Ke;return!0}if(r=="char"||r=="codepoint")ne();else if(r=="column")ne(!0);else if(r=="word"||r=="group")for(var le=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Oe=!0;!(n<0&&!ne(!Oe));Oe=!1){var Ie=G.text.charAt(t.ch)||`
|
|
`,je=Re(Ie,ye)?"w":xe&&Ie==`
|
|
`?"n":!xe||/\s/.test(Ie)?null:"p";if(xe&&!Oe&&!je&&(je="s"),le&&le!=je){n<0&&(n=1,ne(),t.sticky="after");break}if(je&&(le=je),n>0&&!ne(!Oe))break}var He=Qi(e,t,S,j,!0);return qr(S,He)&&(He.hitSide=!0),He}function ks(e,t,n,r){var i=e.doc,S=t.left,j;if(r=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(G-.5*Rn(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var X;!(X=ya(e,S,j),!X.outside);){if(n<0?j<=0:j>=i.height){X.hitSide=!0;break}j+=n*5}return X}var Dt=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};Dt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Os(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(G){for(var V=G.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}we(i,"paste",function(G){if(!S(G)||Me(r,G)||As(G,r))return;N<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),we(i,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),we(i,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),we(i,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(i,"touchstart",function(){return n.forceCompositionEnd()}),we(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(G){if(!S(G)||Me(r,G))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),G.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ds(r);ra({lineWise:!0,text:V.text}),G.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var X=Er.text.join(`
|
|
`);if(G.clipboardData.setData("Text",X),G.clipboardData.getData("Text")==X){G.preventDefault();return}}var ne=Rs(),le=ne.firstChild;r.display.lineSpace.insertBefore(ne,r.display.lineSpace.firstChild),le.value=Er.text.join(`
|
|
`);var xe=document.activeElement;W(le),setTimeout(function(){r.display.lineSpace.removeChild(ne),xe.focus(),xe==i&&n.showPrimarySelection()},50)}we(i,"copy",j),we(i,"cut",j)},Dt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Dt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Dt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Dt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Dt.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 S=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&j&&!j.bad&&ct(bn(S,j),r)==0&&ct(tn(S,j),i)==0)return;var G=t.display.view,V=r.line>=t.display.viewFrom&&Ps(t,r)||{node:G[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Ps(t,i);if(!X){var ne=G[G.length-1].measure,le=ne.maps?ne.maps[ne.maps.length-1]:ne.map;X={node:le[le.length-1],offset:le[le.length-2]-le[le.length-3]}}if(!V||!X){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ye;try{ye=y(V.node,V.offset,X.offset,X.node)}catch(Oe){}ye&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},Dt.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)},Dt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Dt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Dt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return m(this.div,t)},Dt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Dt.prototype.blur=function(){this.div.blur()},Dt.prototype.getField=function(){return this.div},Dt.prototype.supportsTouch=function(){return!0},Dt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ur(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Dt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Dt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&c&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Jt(t.doc,zr(n,r),me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Dt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,ot(e.doc,r.line-1).length)),i.ch==ot(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,j,G;r.line==t.viewFrom||(S=dn(e,r.line))==0?(j=Ct(t.view[0].line),G=t.view[0].node):(j=Ct(t.view[S].line),G=t.view[S-1].node.nextSibling);var V=dn(e,i.line),X,ne;if(V==t.view.length-1?(X=t.viewTo-1,ne=t.lineDiv.lastChild):(X=Ct(t.view[V+1].line)-1,ne=t.view[V+1].node.previousSibling),!G)return!1;for(var le=e.doc.splitLines(tu(e,G,ne,j,X)),xe=Sr(e.doc,Fe(j,0),Fe(X,ot(e.doc,X).text.length));le.length>1&&xe.length>1;)if($(le)==$(xe))le.pop(),xe.pop(),X--;else if(le[0]==xe[0])le.shift(),xe.shift(),j++;else break;for(var ye=0,Oe=0,Ie=le[0],je=xe[0],He=Math.min(Ie.length,je.length);ye<He&&Ie.charCodeAt(ye)==je.charCodeAt(ye);)++ye;for(var Je=$(le),Ke=$(xe),tt=Math.min(Je.length-(le.length==1?ye:0),Ke.length-(xe.length==1?ye:0));Oe<tt&&Je.charCodeAt(Je.length-Oe-1)==Ke.charCodeAt(Ke.length-Oe-1);)++Oe;if(le.length==1&&xe.length==1&&j==r.line)for(;ye&&ye>r.ch&&Je.charCodeAt(Je.length-Oe-1)==Ke.charCodeAt(Ke.length-Oe-1);)ye--,Oe++;le[le.length-1]=Je.slice(0,Je.length-Oe).replace(/^\u200b+/,""),le[0]=le[0].slice(ye).replace(/\u200b+$/,"");var dt=Fe(j,ye),st=Fe(X,xe.length?$(xe).length-Oe:0);if(le.length>1||le[0]||ct(dt,st))return Un(e.doc,le,dt,st,"+input"),!0},Dt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Dt.prototype.reset=function(){this.forceCompositionEnd()},Dt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Dt.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)},Dt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return rr(e.cm)})},Dt.prototype.setUneditable=function(e){e.contentEditable="false"},Dt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Dt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Dt.prototype.onContextMenu=function(){},Dt.prototype.resetPosition=function(){},Dt.prototype.needsContentAttribute=!0;function Ps(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=ot(e.doc,t.line),i=no(n,r,t.line),S=Xe(r,e.doc.direction),j="left";if(S){var G=We(S,t.ch);j=G%2?"right":"left"}var V=oo(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",j=!1,G=e.doc.lineSeparator(),V=!1;function X(ye){return function(Oe){return Oe.id==ye}}function ne(){j&&(S+=G,V&&(S+=G),j=V=!1)}function le(ye){ye&&(ne(),S+=ye)}function xe(ye){if(ye.nodeType==1){var Oe=ye.getAttribute("cm-text");if(Oe){le(Oe);return}var Ie=ye.getAttribute("cm-marker"),je;if(Ie){var He=e.findMarks(Fe(r,0),Fe(i+1,0),X(+Ie));He.length&&(je=He[0].find(0))&&le(Sr(e.doc,je.from,je.to).join(G));return}if(ye.getAttribute("contenteditable")=="false")return;var Je=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Je&&ne();for(var Ke=0;Ke<ye.childNodes.length;Ke++)xe(ye.childNodes[Ke]);/^(pre|p)$/i.test(ye.nodeName)&&(V=!0),Je&&(j=!0)}else ye.nodeType==3&&le(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,V=!1;return S}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!m(r,t))return Kn(Fe(Ct(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?$(e.rest):e.line;return Kn(Fe(Ct(S),S.text.length),i)}var j=t.nodeType==3?t:null,G=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));G.parentNode!=r;)G=G.parentNode;var V=e.measure,X=V.maps;function ne(je,He,Je){for(var Ke=-1;Ke<(X?X.length:0);Ke++)for(var tt=Ke<0?V.map:X[Ke],dt=0;dt<tt.length;dt+=3){var st=tt[dt+2];if(st==je||st==He){var gt=Ct(Ke<0?e.line:e.rest[Ke]),kt=tt[dt]+Je;return(Je<0||st!=je)&&(kt=tt[dt+(Je?1:0)]),Fe(gt,kt)}}}var le=ne(j,G,n);if(le)return Kn(le,i);for(var xe=G.nextSibling,ye=j?j.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(le=ne(xe,xe.firstChild,0),le)return Kn(Fe(le.line,le.ch-ye),i);ye+=xe.textContent.length}for(var Oe=G.previousSibling,Ie=n;Oe;Oe=Oe.previousSibling){if(le=ne(Oe,Oe.firstChild,-1),le)return Kn(Fe(le.line,le.ch+Ie),i);Ie+=Oe.textContent.length}}var Ft=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Ft.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),x&&(i.style.width="0px"),we(i,"input",function(){B&&N>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),we(i,"paste",function(j){if(Me(r,j)||As(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(j){if(Me(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var G=Ds(r);ra({lineWise:!0,text:G.text}),j.type=="cut"?r.setSelections(G.ranges,null,me):(n.prevInput="",i.value=G.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}we(i,"cut",S),we(i,"copy",S),we(e.scroller,"paste",function(j){if(Mr(e,j)||Me(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var G=new Event("paste");G.clipboardData=j.clipboardData,i.dispatchEvent(G)}),we(e.lineSpace,"selectstart",function(j){Mr(e,j)||Q(j)}),we(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),we(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ft.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},Ft.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-S.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ft.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&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&N>=9&&(this.hasSelection=null))},Ft.prototype.getField=function(){return this.textarea},Ft.prototype.supportsTouch=function(){return!1},Ft.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ft.prototype.blur=function(){this.textarea.blur()},Ft.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ft.prototype.receivedFocus=function(){this.slowPoll()},Ft.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()})},Ft.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)},Ft.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(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&&N>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,G=Math.min(r.length,i.length);j<G&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return ur(t,function(){za(t,i.slice(j),r.length-j,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ft.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ft.prototype.onKeyPress=function(){B&&N>=9&&(this.hasSelection=null),this.fastPoll()},Ft.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=un(n,e),j=r.scroller.scrollTop;if(!S||p)return;var G=n.options.resetSelectionOnContextMenu;G&&n.doc.sel.contains(S)==-1&&Gt(n,Jt)(n.doc,zr(S),me);var V=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 le;P&&(le=window.scrollY),r.input.focus(),P&&window.scrollTo(null,le),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){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=V,B&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!B||B&&N<9)&&xe();var Ie=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ie++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(B&&N>=9&&xe(),D){se(e);var Oe=function(){Ye(window,"mouseup",Oe),setTimeout(ye,20)};we(window,"mouseup",Oe)}else setTimeout(ye,50)},Ft.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ft.prototype.setUneditable=function(){},Ft.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?M(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=k();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=G.getValue()}var i;if(e.form&&(we(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var j=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var G=Pt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return G}function iu(e){e.off=Ye,e.on=we,e.wheelEventPixels=cl,e.Doc=nr,e.splitLines=it,e.countColumn=K,e.findColumn=ue,e.isWordChar=Se,e.Pass=be,e.signal=Ae,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Ao,e.Pos=Fe,e.cmpPos=ct,e.modes=St,e.mimeModes=mt,e.resolveMode=Ut,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=pr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=_r,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=mi,e.e_preventDefault=Q,e.e_stopPropagation=Z,e.e_stop=se,e.addClass=I,e.contains=m,e.rmClass=f,e.keyNames=$r}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in nr.prototype)nr.prototype.hasOwnProperty(ia)&&q(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(nr.prototype[ia]));return ce(nr),Pt.inputStyles={textarea:Ft,contenteditable:Dt},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),Yt.apply(this,arguments)},Pt.defineMIME=Kt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){nr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(nt,ze,re){"use strict";re.r(ze),re.d(ze,"ResizableTextArea",function(){return q});var J=re("wx14"),H=re("1OyB"),L=re("vuIU"),z=re("Ji7U"),F=re("LK+K"),O=re("cDcd"),B=re("VTBJ"),N=re("rePB"),P=re("Zm9Q"),C=re("Kwbf"),c=re("c+Xe"),p=re("m+aA"),R=re("bdgK"),w=new Map;function b(me){me.forEach(function(he){var fe,ue=he.target;(fe=w.get(ue))===null||fe===void 0||fe.forEach(function(ie){return ie(ue)})})}var x=new R.default(b),l=null,a=null;function s(me,he){w.has(me)||(w.set(me,new Set),x.observe(me)),w.get(me).add(he)}function u(me,he){w.has(me)&&(w.get(me).delete(he),w.get(me).size||(x.unobserve(me),w.delete(me)))}var A=function(me){Object(z.a)(fe,me);var he=Object(F.a)(fe);function fe(){return Object(H.a)(this,fe),he.apply(this,arguments)}return Object(L.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(O.Component),v=O.createContext(null);function g(me){var he=me.children,fe=me.onBatchResize,ue=O.useRef(0),ie=O.useRef([]),pe=O.useContext(v),$=O.useCallback(function(ae,ee,Ee){ue.current+=1;var Ce=ue.current;ie.current.push({size:ae,element:ee,data:Ee}),Promise.resolve().then(function(){Ce===ue.current&&(fe==null||fe(ie.current),ie.current=[])}),pe==null||pe(ae,ee,Ee)},[fe,pe]);return O.createElement(v.Provider,{value:$},he)}function D(me){var he=me.children,fe=me.disabled,ue=O.useRef(null),ie=O.useRef(null),pe=O.useContext(v),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=O.isValidElement(he)&&Object(c.c)(he),ee=ae?he.ref:null,Ee=O.useMemo(function(){return Object(c.a)(ee,ue)},[ee,ue]),Ce=O.useRef(me);Ce.current=me;var ve=O.useCallback(function(Se){var Re=Ce.current,Ne=Re.onResize,_e=Re.data,Pe=Se.getBoundingClientRect(),ke=Pe.width,Ze=Pe.height,Ge=Se.offsetWidth,Ve=Se.offsetHeight,We=Math.floor(ke),rt=Math.floor(Ze);if($.current.width!==We||$.current.height!==rt||$.current.offsetWidth!==Ge||$.current.offsetHeight!==Ve){var Xe={width:We,height:rt,offsetWidth:Ge,offsetHeight:Ve};$.current=Xe;var $e=Ge===Math.round(ke)?ke:Ge,we=Ve===Math.round(Ze)?Ze:Ve,qe=Object(B.a)(Object(B.a)({},Xe),{},{offsetWidth:$e,offsetHeight:we});pe==null||pe(qe,Se,_e),Ne&&Promise.resolve().then(function(){Ne(qe,Se)})}},[]);return O.useEffect(function(){var Se=Object(p.a)(ue.current)||Object(p.a)(ie.current);return Se&&!fe&&s(Se,ve),function(){return u(Se,ve)}},[ue.current,fe]),O.createElement(A,{ref:ie},ae?O.cloneElement(he,{ref:Ee}):he)}var T="rc-observer-key";function f(me){var he=me.children,fe=Object(P.a)(he);return fe.map(function(ue,ie){var pe=(ue==null?void 0:ue.key)||"".concat(T,"-").concat(ie);return O.createElement(D,Object(J.a)({},me,{key:pe}),ue)})}f.Collection=g;var h=f,d=re("bT9E"),o=re("TSYQ"),E=re.n(o),y=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,m=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},I;function U(me){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(he&&k[fe])return k[fe];var ue=window.getComputedStyle(me),ie=ue.getPropertyValue("box-sizing")||ue.getPropertyValue("-moz-box-sizing")||ue.getPropertyValue("-webkit-box-sizing"),pe=parseFloat(ue.getPropertyValue("padding-bottom"))+parseFloat(ue.getPropertyValue("padding-top")),$=parseFloat(ue.getPropertyValue("border-bottom-width"))+parseFloat(ue.getPropertyValue("border-top-width")),ae=m.map(function(Ee){return"".concat(Ee,":").concat(ue.getPropertyValue(Ee))}).join(";"),ee={sizingStyle:ae,paddingSize:pe,borderSize:$,boxSizing:ie};return he&&fe&&(k[fe]=ee),ee}function W(me){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;I||(I=document.createElement("textarea"),I.setAttribute("tab-index","-1"),I.setAttribute("aria-hidden","true"),document.body.appendChild(I)),me.getAttribute("wrap")?I.setAttribute("wrap",me.getAttribute("wrap")):I.removeAttribute("wrap");var ie=U(me,he),pe=ie.paddingSize,$=ie.borderSize,ae=ie.boxSizing,ee=ie.sizingStyle;I.setAttribute("style","".concat(ee,";").concat(y)),I.value=me.value||me.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ve=I.scrollHeight,Se;if(ae==="border-box"?ve+=$:ae==="content-box"&&(ve-=pe),fe!==null||ue!==null){I.value=" ";var Re=I.scrollHeight-pe;fe!==null&&(Ee=Re*fe,ae==="border-box"&&(Ee=Ee+pe+$),ve=Math.max(Ee,ve)),ue!==null&&(Ce=Re*ue,ae==="border-box"&&(Ce=Ce+pe+$),Se=ve>Ce?"":"hidden",ve=Math.min(Ce,ve))}return{height:ve,minHeight:Ee,maxHeight:Ce,overflowY:Se,resize:"none"}}var _=re("Gytx"),M=re.n(_),K;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(K||(K={}));var Y=function(me){Object(z.a)(fe,me);var he=Object(F.a)(fe);function fe(ue){var ie;return Object(H.a)(this,fe),ie=he.call(this,ue),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(pe){ie.textArea=pe},ie.handleResize=function(pe){var $=ie.state.resizeStatus,ae=ie.props,ee=ae.autoSize,Ee=ae.onResize;if($!==K.NONE)return;typeof Ee=="function"&&Ee(pe),ee&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var pe=ie.props.autoSize;if(!pe||!ie.textArea)return;var $=pe.minRows,ae=pe.maxRows,ee=W(ie.textArea,!1,$,ae);ie.setState({textareaStyles:ee,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:K.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:K.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var pe=ie.props,$=pe.prefixCls,ae=$===void 0?"rc-textarea":$,ee=pe.autoSize,Ee=pe.onResize,Ce=pe.className,ve=pe.disabled,Se=ie.state,Re=Se.textareaStyles,Ne=Se.resizeStatus,_e=Object(d.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Pe=E()(ae,Ce,Object(N.a)({},"".concat(ae,"-disabled"),ve));"value"in _e&&(_e.value=_e.value||"");var ke=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),Re),Ne===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(h,{onResize:ie.handleResize,disabled:!(ee||Ee)},O.createElement("textarea",Object(J.a)({},_e,{className:Pe,style:ke,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:K.NONE},ie}return Object(L.a)(fe,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!M()(ie.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 ie=this.textArea.selectionStart,pe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,pe)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(O.Component),q=Y,oe=function(me){Object(z.a)(fe,me);var he=Object(F.a)(fe);function fe(ue){var ie;Object(H.a)(this,fe),ie=he.call(this,ue),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function($){ie.resizableTextArea=$},ie.handleChange=function($){var ae=ie.props.onChange;ie.setValue($.target.value,function(){ie.resizableTextArea.resizeTextarea()}),ae&&ae($)},ie.handleKeyDown=function($){var ae=ie.props,ee=ae.onPressEnter,Ee=ae.onKeyDown;$.keyCode===13&&ee&&ee($),Ee&&Ee($)};var pe=typeof ue.value=="undefined"||ue.value===null?ue.defaultValue:ue.value;return ie.state={value:pe},ie}return Object(L.a)(fe,[{key:"setValue",value:function(ie,pe){"value"in this.props||this.setState({value:ie},pe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(q,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),fe}(O.Component),be=ze.default=oe},ZpRC:function(nt,ze,re){"use strict";function J(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function H(c,p){return(!p||c!=="hidden")&&c!=="visible"&&c!=="clip"}function L(c,p){if(c.clientHeight<c.scrollHeight||c.clientWidth<c.scrollWidth){var R=getComputedStyle(c,null);return H(R.overflowY,p)||H(R.overflowX,p)||function(w){var b=function(x){if(!x.ownerDocument||!x.ownerDocument.defaultView)return null;try{return x.ownerDocument.defaultView.frameElement}catch(l){return null}}(w);return!!b&&(b.clientHeight<w.scrollHeight||b.clientWidth<w.scrollWidth)}(c)}return!1}function z(c,p,R,w,b,x,l,a){return x<c&&l>p||x>c&&l<p?0:x<=c&&a<=R||l>=p&&a>=R?x-c-w:l>p&&a<R||x<c&&a>R?l-p+b:0}var F=function(c,p){var R=window,w=p.scrollMode,b=p.block,x=p.inline,l=p.boundary,a=p.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Re){return Re!==l};if(!J(c))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,A=[],v=c;J(v)&&s(v);){if((v=v.parentElement)===u){A.push(v);break}v!=null&&v===document.body&&L(v)&&!L(document.documentElement)||v!=null&&L(v,a)&&A.push(v)}for(var g=R.visualViewport?R.visualViewport.width:innerWidth,D=R.visualViewport?R.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=c.getBoundingClientRect(),d=h.height,o=h.width,E=h.top,y=h.right,m=h.bottom,k=h.left,I=b==="start"||b==="nearest"?E:b==="end"?m:E+d/2,U=x==="center"?k+o/2:x==="end"?y:k,W=[],_=0;_<A.length;_++){var M=A[_],K=M.getBoundingClientRect(),Y=K.height,q=K.width,oe=K.top,be=K.right,me=K.bottom,he=K.left;if(w==="if-needed"&&E>=0&&k>=0&&m<=D&&y<=g&&E>=oe&&m<=me&&k>=he&&y<=be)return W;var fe=getComputedStyle(M),ue=parseInt(fe.borderLeftWidth,10),ie=parseInt(fe.borderTopWidth,10),pe=parseInt(fe.borderRightWidth,10),$=parseInt(fe.borderBottomWidth,10),ae=0,ee=0,Ee="offsetWidth"in M?M.offsetWidth-M.clientWidth-ue-pe:0,Ce="offsetHeight"in M?M.offsetHeight-M.clientHeight-ie-$:0;if(u===M)ae=b==="start"?I:b==="end"?I-D:b==="nearest"?z(f,f+D,D,ie,$,f+I,f+I+d,d):I-D/2,ee=x==="start"?U:x==="center"?U-g/2:x==="end"?U-g:z(T,T+g,g,ue,pe,T+U,T+U+o,o),ae=Math.max(0,ae+f),ee=Math.max(0,ee+T);else{ae=b==="start"?I-oe-ie:b==="end"?I-me+$+Ce:b==="nearest"?z(oe,me,Y,ie,$+Ce,I,I+d,d):I-(oe+Y/2)+Ce/2,ee=x==="start"?U-he-ue:x==="center"?U-(he+q/2)+Ee/2:x==="end"?U-be+pe+Ee:z(he,be,q,ue,pe+Ee,U,U+o,o);var ve=M.scrollLeft,Se=M.scrollTop;I+=Se-(ae=Math.max(0,Math.min(Se+ae,M.scrollHeight-Y+Ce))),U+=ve-(ee=Math.max(0,Math.min(ve+ee,M.scrollWidth-q+Ee)))}W.push({el:M,top:ae,left:ee})}return W};function O(c){return c===Object(c)&&Object.keys(c).length!==0}function B(c,p){p===void 0&&(p="auto");var R="scrollBehavior"in document.body.style;c.forEach(function(w){var b=w.el,x=w.top,l=w.left;b.scroll&&R?b.scroll({top:x,left:l,behavior:p}):(b.scrollTop=x,b.scrollLeft=l)})}function N(c){return c===!1?{block:"end",inline:"nearest"}:O(c)?c:{block:"start",inline:"nearest"}}function P(c,p){var R=!c.ownerDocument.documentElement.contains(c);if(O(p)&&typeof p.behavior=="function")return p.behavior(R?[]:F(c,p));if(R)return;var w=N(p);return B(F(c,w),w.behavior)}var C=ze.a=P},Zss7:function(nt,ze,re){var J;(function(H){var L=/^\s+/,z=/\s+$/,F=0,O=H.round,B=H.min,N=H.max,P=H.random;function C($,ae){if($=$||"",ae=ae||{},$ instanceof C)return $;if(!(this instanceof C))return new C($,ae);var ee=c($);this._originalInput=$,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=O(100*this._a)/100,this._format=ae.format||ee.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=ee.ok,this._tc_id=F++}C.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(),ae,ee,Ee,Ce,ve,Se;return ae=$.r/255,ee=$.g/255,Ee=$.b/255,ae<=.03928?Ce=ae/12.92:Ce=H.pow((ae+.055)/1.055,2.4),ee<=.03928?ve=ee/12.92:ve=H.pow((ee+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=H.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ve+.0722*Se},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=b(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=b(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.v*100);return this._a==1?"hsv("+ae+", "+ee+"%, "+Ee+"%)":"hsva("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=R(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=R(this._r,this._g,this._b),ae=O($.h*360),ee=O($.s*100),Ee=O($.l*100);return this._a==1?"hsl("+ae+", "+ee+"%, "+Ee+"%)":"hsla("+ae+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return l(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return a(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(_(this._r,255)*100)+"%",g:O(_(this._g,255)*100)+"%",b:O(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%)":"rgba("+O(_(this._r,255)*100)+"%, "+O(_(this._g,255)*100)+"%, "+O(_(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:I[l(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ae="#"+s(this._r,this._g,this._b,this._a),ee=ae,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ce=C($);ee="#"+s(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ae+",endColorstr="+ee+")"},toString:function($){var ae=!!$;$=$||this._format;var ee=!1,Ee=this._a<1&&this._a>=0,Ce=!ae&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(ee=this.toRgbString()),$==="prgb"&&(ee=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(ee=this.toHexString()),$==="hex3"&&(ee=this.toHexString(!0)),$==="hex4"&&(ee=this.toHex8String(!0)),$==="hex8"&&(ee=this.toHex8String()),$==="name"&&(ee=this.toName()),$==="hsl"&&(ee=this.toHslString()),$==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return C(this.toString())},_applyModification:function($,ae){var ee=$.apply(null,[this].concat([].slice.call(ae)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function($,ae){return $.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(h,arguments)},monochromatic:function(){return this._applyCombination(m,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},C.fromRatio=function($,ae){if(typeof $=="object"){var ee={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?ee[Ee]=$[Ee]:ee[Ee]=be($[Ee]));$=ee}return C($,ae)};function c($){var ae={r:0,g:0,b:0},ee=1,Ee=null,Ce=null,ve=null,Se=!1,Re=!1;return typeof $=="string"&&($=ie($)),typeof $=="object"&&(ue($.r)&&ue($.g)&&ue($.b)?(ae=p($.r,$.g,$.b),Se=!0,Re=String($.r).substr(-1)==="%"?"prgb":"rgb"):ue($.h)&&ue($.s)&&ue($.v)?(Ee=be($.s),Ce=be($.v),ae=x($.h,Ee,Ce),Se=!0,Re="hsv"):ue($.h)&&ue($.s)&&ue($.l)&&(Ee=be($.s),ve=be($.l),ae=w($.h,Ee,ve),Se=!0,Re="hsl"),$.hasOwnProperty("a")&&(ee=$.a)),ee=W(ee),{ok:Se,format:$.format||Re,r:B(255,N(ae.r,0)),g:B(255,N(ae.g,0)),b:B(255,N(ae.b,0)),a:ee}}function p($,ae,ee){return{r:_($,255)*255,g:_(ae,255)*255,b:_(ee,255)*255}}function R($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,Re=(Ee+Ce)/2;if(Ee==Ce)ve=Se=0;else{var Ne=Ee-Ce;Se=Re>.5?Ne/(2-Ee-Ce):Ne/(Ee+Ce);switch(Ee){case $:ve=(ae-ee)/Ne+(ae<ee?6:0);break;case ae:ve=(ee-$)/Ne+2;break;case ee:ve=($-ae)/Ne+4;break}ve/=6}return{h:ve,s:Se,l:Re}}function w($,ae,ee){var Ee,Ce,ve;$=_($,360),ae=_(ae,100),ee=_(ee,100);function Se(_e,Pe,ke){return ke<0&&(ke+=1),ke>1&&(ke-=1),ke<1/6?_e+(Pe-_e)*6*ke:ke<1/2?Pe:ke<2/3?_e+(Pe-_e)*(2/3-ke)*6:_e}if(ae===0)Ee=Ce=ve=ee;else{var Re=ee<.5?ee*(1+ae):ee+ae-ee*ae,Ne=2*ee-Re;Ee=Se(Ne,Re,$+1/3),Ce=Se(Ne,Re,$),ve=Se(Ne,Re,$-1/3)}return{r:Ee*255,g:Ce*255,b:ve*255}}function b($,ae,ee){$=_($,255),ae=_(ae,255),ee=_(ee,255);var Ee=N($,ae,ee),Ce=B($,ae,ee),ve,Se,Re=Ee,Ne=Ee-Ce;if(Se=Ee===0?0:Ne/Ee,Ee==Ce)ve=0;else{switch(Ee){case $:ve=(ae-ee)/Ne+(ae<ee?6:0);break;case ae:ve=(ee-$)/Ne+2;break;case ee:ve=($-ae)/Ne+4;break}ve/=6}return{h:ve,s:Se,v:Re}}function x($,ae,ee){$=_($,360)*6,ae=_(ae,100),ee=_(ee,100);var Ee=H.floor($),Ce=$-Ee,ve=ee*(1-ae),Se=ee*(1-Ce*ae),Re=ee*(1-(1-Ce)*ae),Ne=Ee%6,_e=[ee,Se,ve,ve,Re,ee][Ne],Pe=[Re,ee,ee,Se,ve,ve][Ne],ke=[ve,ve,Re,ee,ee,Se][Ne];return{r:_e*255,g:Pe*255,b:ke*255}}function l($,ae,ee,Ee){var Ce=[oe(O($).toString(16)),oe(O(ae).toString(16)),oe(O(ee).toString(16))];return Ee&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function a($,ae,ee,Ee,Ce){var ve=[oe(O($).toString(16)),oe(O(ae).toString(16)),oe(O(ee).toString(16)),oe(me(Ee))];return Ce&&ve[0].charAt(0)==ve[0].charAt(1)&&ve[1].charAt(0)==ve[1].charAt(1)&&ve[2].charAt(0)==ve[2].charAt(1)&&ve[3].charAt(0)==ve[3].charAt(1)?ve[0].charAt(0)+ve[1].charAt(0)+ve[2].charAt(0)+ve[3].charAt(0):ve.join("")}function s($,ae,ee,Ee){var Ce=[oe(me(Ee)),oe(O($).toString(16)),oe(O(ae).toString(16)),oe(O(ee).toString(16))];return Ce.join("")}C.equals=function($,ae){return!$||!ae?!1:C($).toRgbString()==C(ae).toRgbString()},C.random=function(){return C.fromRatio({r:P(),g:P(),b:P()})};function u($,ae){ae=ae===0?0:ae||10;var ee=C($).toHsl();return ee.s-=ae/100,ee.s=M(ee.s),C(ee)}function A($,ae){ae=ae===0?0:ae||10;var ee=C($).toHsl();return ee.s+=ae/100,ee.s=M(ee.s),C(ee)}function v($){return C($).desaturate(100)}function g($,ae){ae=ae===0?0:ae||10;var ee=C($).toHsl();return ee.l+=ae/100,ee.l=M(ee.l),C(ee)}function D($,ae){ae=ae===0?0:ae||10;var ee=C($).toRgb();return ee.r=N(0,B(255,ee.r-O(255*-(ae/100)))),ee.g=N(0,B(255,ee.g-O(255*-(ae/100)))),ee.b=N(0,B(255,ee.b-O(255*-(ae/100)))),C(ee)}function T($,ae){ae=ae===0?0:ae||10;var ee=C($).toHsl();return ee.l-=ae/100,ee.l=M(ee.l),C(ee)}function f($,ae){var ee=C($).toHsl(),Ee=(ee.h+ae)%360;return ee.h=Ee<0?360+Ee:Ee,C(ee)}function h($){var ae=C($).toHsl();return ae.h=(ae.h+180)%360,C(ae)}function d($){var ae=C($).toHsl(),ee=ae.h;return[C($),C({h:(ee+120)%360,s:ae.s,l:ae.l}),C({h:(ee+240)%360,s:ae.s,l:ae.l})]}function o($){var ae=C($).toHsl(),ee=ae.h;return[C($),C({h:(ee+90)%360,s:ae.s,l:ae.l}),C({h:(ee+180)%360,s:ae.s,l:ae.l}),C({h:(ee+270)%360,s:ae.s,l:ae.l})]}function E($){var ae=C($).toHsl(),ee=ae.h;return[C($),C({h:(ee+72)%360,s:ae.s,l:ae.l}),C({h:(ee+216)%360,s:ae.s,l:ae.l})]}function y($,ae,ee){ae=ae||6,ee=ee||30;var Ee=C($).toHsl(),Ce=360/ee,ve=[C($)];for(Ee.h=(Ee.h-(Ce*ae>>1)+720)%360;--ae;)Ee.h=(Ee.h+Ce)%360,ve.push(C(Ee));return ve}function m($,ae){ae=ae||6;for(var ee=C($).toHsv(),Ee=ee.h,Ce=ee.s,ve=ee.v,Se=[],Re=1/ae;ae--;)Se.push(C({h:Ee,s:Ce,v:ve})),ve=(ve+Re)%1;return Se}C.mix=function($,ae,ee){ee=ee===0?0:ee||50;var Ee=C($).toRgb(),Ce=C(ae).toRgb(),ve=ee/100,Se={r:(Ce.r-Ee.r)*ve+Ee.r,g:(Ce.g-Ee.g)*ve+Ee.g,b:(Ce.b-Ee.b)*ve+Ee.b,a:(Ce.a-Ee.a)*ve+Ee.a};return C(Se)},C.readability=function($,ae){var ee=C($),Ee=C(ae);return(H.max(ee.getLuminance(),Ee.getLuminance())+.05)/(H.min(ee.getLuminance(),Ee.getLuminance())+.05)},C.isReadable=function($,ae,ee){var Ee=C.readability($,ae),Ce,ve;ve=!1,Ce=pe(ee);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ve=Ee>=4.5;break;case"AAlarge":ve=Ee>=3;break;case"AAAsmall":ve=Ee>=7;break}return ve},C.mostReadable=function($,ae,ee){var Ee=null,Ce=0,ve,Se,Re,Ne;ee=ee||{},Se=ee.includeFallbackColors,Re=ee.level,Ne=ee.size;for(var _e=0;_e<ae.length;_e++)ve=C.readability($,ae[_e]),ve>Ce&&(Ce=ve,Ee=C(ae[_e]));return C.isReadable($,Ee,{level:Re,size:Ne})||!Se?Ee:(ee.includeFallbackColors=!1,C.mostReadable($,["#fff","#000"],ee))};var k=C.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"},I=C.hexNames=U(k);function U($){var ae={};for(var ee in $)$.hasOwnProperty(ee)&&(ae[$[ee]]=ee);return ae}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function _($,ae){Y($)&&($="100%");var ee=q($);return $=B(ae,N(0,parseFloat($))),ee&&($=parseInt($*ae,10)/100),H.abs($-ae)<1e-6?1:$%ae/parseFloat(ae)}function M($){return B(1,N(0,$))}function K($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function q($){return typeof $=="string"&&$.indexOf("%")!=-1}function oe($){return $.length==1?"0"+$:""+$}function be($){return $<=1&&($=$*100+"%"),$}function me($){return H.round(parseFloat($)*255).toString(16)}function he($){return K($)/255}var fe=function(){var $="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+ae+")|(?:"+$+")",Ee="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",Ce="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ue($){return!!fe.CSS_UNIT.exec($)}function ie($){$=$.replace(L,"").replace(z,"").toLowerCase();var ae=!1;if(k[$])$=k[$],ae=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=fe.rgb.exec($))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=fe.rgba.exec($))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=fe.hsl.exec($))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=fe.hsla.exec($))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=fe.hsv.exec($))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=fe.hsva.exec($))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=fe.hex8.exec($))?{r:K(ee[1]),g:K(ee[2]),b:K(ee[3]),a:he(ee[4]),format:ae?"name":"hex8"}:(ee=fe.hex6.exec($))?{r:K(ee[1]),g:K(ee[2]),b:K(ee[3]),format:ae?"name":"hex"}:(ee=fe.hex4.exec($))?{r:K(ee[1]+""+ee[1]),g:K(ee[2]+""+ee[2]),b:K(ee[3]+""+ee[3]),a:he(ee[4]+""+ee[4]),format:ae?"name":"hex8"}:(ee=fe.hex3.exec($))?{r:K(ee[1]+""+ee[1]),g:K(ee[2]+""+ee[2]),b:K(ee[3]+""+ee[3]),format:ae?"name":"hex"}:!1}function pe($){var ae,ee;return $=$||{level:"AA",size:"small"},ae=($.level||"AA").toUpperCase(),ee=($.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:ae,size:ee}}nt.exports?nt.exports=C:!(J=function(){return C}.call(ze,re,ze,nt),J!==void 0&&(nt.exports=J))})(Math)},aRTE:function(nt,ze){nt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(nt,ze,re){"use strict";re.d(ze,"a",function(){return H});var J=re("VTBJ");function H(L,z){var F=Object(J.a)({},L);return Array.isArray(z)&&z.forEach(function(O){delete F[O]}),F}},c5Ni:function(nt,ze,re){},dQei:function(nt,ze){for(var re={glog:function(H){if(H<1)throw new Error("glog("+H+")");return re.LOG_TABLE[H]},gexp:function(H){for(;H<0;)H+=255;for(;H>=256;)H-=255;return re.EXP_TABLE[H]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)re.EXP_TABLE[J]=1<<J;for(var J=8;J<256;J++)re.EXP_TABLE[J]=re.EXP_TABLE[J-4]^re.EXP_TABLE[J-5]^re.EXP_TABLE[J-6]^re.EXP_TABLE[J-8];for(var J=0;J<255;J++)re.LOG_TABLE[re.EXP_TABLE[J]]=J;nt.exports=re},dWSS:function(nt,ze,re){var J=re("dQei");function H(L,z){if(L.length==null)throw new Error(L.length+"/"+z);for(var F=0;F<L.length&&L[F]==0;)F++;this.num=new Array(L.length-F+z);for(var O=0;O<L.length-F;O++)this.num[O]=L[O+F]}H.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var z=new Array(this.getLength()+L.getLength()-1),F=0;F<this.getLength();F++)for(var O=0;O<L.getLength();O++)z[F+O]^=J.gexp(J.glog(this.get(F))+J.glog(L.get(O)));return new H(z,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var z=J.glog(this.get(0))-J.glog(L.get(0)),F=new Array(this.getLength()),O=0;O<this.getLength();O++)F[O]=this.get(O);for(var O=0;O<L.getLength();O++)F[O]^=J.gexp(J.glog(L.get(O))+z);return new H(F,0).mod(L)}},nt.exports=H},dejd:function(nt,ze,re){},dmUQ:function(nt,ze,re){"use strict";var J=re("Ff2n"),H=re("rePB"),L=re("1OyB"),z=re("vuIU"),F=re("Ji7U"),O=re("md7G"),B=re("foSv"),N=re("cDcd"),P=re.n(N),C=re("TSYQ"),c=re.n(C),p=re("4IlW");function R(d,o){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);o&&(y=y.filter(function(m){return Object.getOwnPropertyDescriptor(d,m).enumerable})),E.push.apply(E,y)}return E}function w(d){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?R(Object(E),!0).forEach(function(y){Object(H.a)(d,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):R(Object(E)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(E,y))})}return d}function b(d){var o=x();return function(){var y=Object(B.a)(d),m;if(o){var k=Object(B.a)(this).constructor;m=Reflect.construct(y,arguments,k)}else m=y.apply(this,arguments);return Object(O.a)(this,m)}}function x(){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(d){return!1}}function l(){}function a(d){d.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},u=200,A=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(o){return o!=null},D=function(o,E){return E===o||typeof E=="number"&&typeof o=="number"&&isNaN(E)&&isNaN(o)},T=function(d){Object(F.a)(E,d);var o=b(E);function E(y){var m;Object(L.a)(this,E),m=o.call(this,y),m.onKeyDown=function(U){var W=m.props,_=W.onKeyDown,M=W.onPressEnter;if(U.keyCode===p.a.UP){var K=m.getRatio(U);m.up(U,K,null),m.stop()}else if(U.keyCode===p.a.DOWN){var Y=m.getRatio(U);m.down(U,Y,null),m.stop()}else U.keyCode===p.a.ENTER&&M&&M(U);if(m.recordCursorPosition(),m.lastKeyCode=U.keyCode,_){for(var q=arguments.length,oe=new Array(q>1?q-1:0),be=1;be<q;be++)oe[be-1]=arguments[be];_.apply(void 0,[U].concat(oe))}},m.onKeyUp=function(U){var W=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),W){for(var _=arguments.length,M=new Array(_>1?_-1:0),K=1;K<_;K++)M[K-1]=arguments[K];W.apply(void 0,[U].concat(M))}},m.onChange=function(U){var W=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(U)),m.setState({inputValue:m.rawInput}),W(m.toNumber(m.rawInput))},m.onMouseUp=function(){var U=m.props.onMouseUp;m.recordCursorPosition(),U&&U.apply(void 0,arguments)},m.onFocus=function(){var U;m.setState({focused:!0}),(U=m.props).onFocus.apply(U,arguments)},m.onBlur=function(){var U=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var W=m.getCurrentValidValue(m.state.inputValue),_=m.setValue(W,l);if(U){var M=m.input.value,K=m.getInputDisplayValue({focus:!1,value:_});m.input.value=K&&Number(K),U.apply(void 0,arguments),m.input.value=M}},m.getRatio=function(U){var W=1;return U.metaKey||U.ctrlKey?W=.1:U.shiftKey&&(W=10),W},m.getFullNum=function(U){return isNaN(U)?U:/e/i.test(String(U))?Number(U).toFixed(18).replace(/\.?0+$/,""):U},m.getPrecision=function(U){if(g(m.props.precision))return m.props.precision;var W=String(U);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),_},m.getInputDisplayValue=function(U){var W=U||m.state,_=W.focused,M=W.inputValue,K=W.value,Y;_?Y=M:Y=m.toPrecisionAsStep(K),Y==null&&(Y="");var q=m.formatWrapper(Y);return g(m.props.decimalSeparator)&&(q=q.toString().replace(".",m.props.decimalSeparator)),q},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(U){}},m.restoreByAfter=function(U){if(U===void 0)return!1;var W=m.input.value,_=W.lastIndexOf(U);if(_===-1)return!1;var M=m.cursorBefore.length;return m.lastKeyCode===p.a.DELETE&&m.cursorBefore.charAt(M-1)===U[0]?(m.fixCaret(M,M),!0):_+U.length===W.length?(m.fixCaret(_,_),!0):!1},m.partRestoreByAfter=function(U){return U===void 0?!1:Array.prototype.some.call(U,function(W,_){var M=U.substring(_);return m.restoreByAfter(M)})},m.isNotCompleteNumber=function(U){return isNaN(U)||U===""||U===null||U&&U.toString().indexOf(".")===U.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(U,W,_){m.pressingUpOrDown=!0,m.step("down",U,W,_)},m.up=function(U,W,_){m.pressingUpOrDown=!0,m.step("up",U,W,_)},m.saveInput=function(U){m.input=U};var k=y.value;k===void 0&&(k=y.defaultValue),m.state={focused:y.autoFocus};var I=m.getValidValue(m.toNumber(k));return m.state=w(w({},m.state),{},{inputValue:m.toPrecisionAsStep(I),value:I}),m}return Object(z.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var k=this.props,I=k.value,U=k.onChange,W=k.max,_=k.min,M=this.state.focused;if(m){if(!D(m.value,I)||!D(m.max,W)||!D(m.min,_)){var K=M?I:this.getValidValue(I),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?I:this.state.value;"max"in this.props&&m.max!==W&&typeof q=="number"&&q>W&&U&&U(W),"min"in this.props&&m.min!==_&&typeof q=="number"&&q<_&&U&&U(_)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(m){var k=m;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(m){var k=m.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(m){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,U=parseFloat(m);return isNaN(U)?m:(U<k&&(U=k),U>I&&(U=I),U)}},{key:"setValue",value:function(m,k){var I=this.props.precision,U=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),W=this.state.value,_=W===void 0?null:W,M=this.state.inputValue,K=M===void 0?null:M,Y=typeof U=="number"?U.toFixed(I):"".concat(U),q=U!==_||Y!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},k)):this.setState({value:U,inputValue:this.toPrecisionAsStep(m)},k),q&&this.props.onChange(U),U}},{key:"getMaxPrecision",value:function(m){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.props,U=I.precision,W=I.step;if(g(U))return U;var _=this.getPrecision(k),M=this.getPrecision(W),K=this.getPrecision(m);return m?Math.max(K,_+M):_+M}},{key:"getPrecisionFactor",value:function(m){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.getMaxPrecision(m,k);return Math.pow(10,I)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var k=Math.abs(this.getMaxPrecision(m));return isNaN(k)?m.toString():Number(m).toFixed(k)}},{key:"toNumber",value:function(m){var k=this.props.precision,I=this.state.focused,U=m&&m.length>16&&I;return this.isNotCompleteNumber(m)||U?m:g(k)?Math.round(m*Math.pow(10,k))/Math.pow(10,k):Number(m)}},{key:"upStep",value:function(m,k){var I=this.props.step,U=this.getPrecisionFactor(m,k),W=Math.abs(this.getMaxPrecision(m,k)),_=((U*m+U*I*k)/U).toFixed(W);return this.toNumber(_)}},{key:"downStep",value:function(m,k){var I=this.props.step,U=this.getPrecisionFactor(m,k),W=Math.abs(this.getMaxPrecision(m,k)),_=((U*m-U*I*k)/U).toFixed(W);return this.toNumber(_)}},{key:"step",value:function(m,k){var I=this,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var _=this.props;if(_.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var K=this["".concat(m,"Step")](M,U),Y=K>_.max||K<_.min;if(K>_.max?K=_.max:K<_.min&&(K=_.min),this.setValue(K,null),this.setState({focused:!0},function(){I.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){I[m](k,U,!0)},W?u:A)}},{key:"fixCaret",value:function(m,k){if(m===void 0||k===void 0||!this.input||!this.input.value)return;try{var I=this.input.selectionStart,U=this.input.selectionEnd;(m!==I||k!==U)&&this.input.setSelectionRange(m,k)}catch(W){}}},{key:"render",value:function(){var m,k=this.props,I=k.prefixCls,U=k.disabled,W=k.readOnly,_=k.useTouch,M=k.autoComplete,K=k.upHandler,Y=k.downHandler,q=k.className,oe=k.max,be=k.min,me=k.style,he=k.title,fe=k.onMouseEnter,ue=k.onMouseLeave,ie=k.onMouseOver,pe=k.onMouseOut,$=k.required,ae=k.onClick,ee=k.tabIndex,Ee=k.type,Ce=k.placeholder,ve=k.id,Se=k.inputMode,Re=k.pattern,Ne=k.step,_e=k.maxLength,Pe=k.autoFocus,ke=k.name,Ze=k.onPaste,Ge=k.onInput,Ve=Object(J.a)(k,["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"]),We=this.state,rt=We.value,Xe=We.focused,$e=c()(I,(m={},Object(H.a)(m,q,!!q),Object(H.a)(m,"".concat(I,"-disabled"),U),Object(H.a)(m,"".concat(I,"-focused"),Xe),m)),we={};Object.keys(Ve).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(we[se]=Ve[se])});var qe=!W&&!U,Ye=this.getInputDisplayValue(null),Ae=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=oe),Me=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=be),ge=Ae||U||W,de=Me||U||W,ce=c()("".concat(I,"-handler"),"".concat(I,"-handler-up"),Object(H.a)({},"".concat(I,"-handler-up-disabled"),ge)),Q=c()("".concat(I,"-handler"),"".concat(I,"-handler-down"),Object(H.a)({},"".concat(I,"-handler-down-disabled"),de)),Z=_?{onTouchStart:ge?l:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=_?{onTouchStart:de?l:this.down,onTouchEnd:this.stop}:{onMouseDown:de?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:$e,style:me,title:he,onMouseEnter:fe,onMouseLeave:ue,onMouseOver:ie,onMouseOut:pe,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(I,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),K||P.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:Q}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(I,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":oe,"aria-valuenow":rt,required:$,type:Ee,placeholder:Ce,onPaste:Ze,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(I,"-input"),tabIndex:ee,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:l,onKeyUp:qe?this.onKeyUp:l,autoFocus:Pe,maxLength:_e,readOnly:W,disabled:U,max:oe,min:be,step:Ne,name:ke,title:he,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:Re,inputMode:Se,onInput:Ge},we))))}}]),E}(P.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var f=T,h=ze.a=f},f4xo:function(nt,ze,re){var J=re("nVVt");function H(L){this.mode=J.MODE_8BIT_BYTE,this.data=L}H.prototype={getLength:function(L){return this.data.length},write:function(L){for(var z=0;z<this.data.length;z++)L.put(this.data.charCodeAt(z),8)}},nt.exports=H},gkVt:function(nt,ze,re){"use strict";re.r(ze);var J=re("DZo9"),H=re("8z0m"),L=re("+L6B"),z=re("2/Rp"),F=re("miYZ"),O=re("tsqr"),B=re("9og8"),N=re("tJVT"),P=re("WmNS"),C=re.n(P),c=re("cDcd"),p=re.n(c),R=re("5NDa"),w=re("5rEg"),b=re("Ot1p"),x=re("ErOA");function l(d){var o=d.setIscreate,E=d.init,y=d.UpdateItem,m=Object(c.useState)(""),k=Object(N.a)(m,2),I=k[0],U=k[1],W=Object(c.useState)(""),_=Object(N.a)(W,2),M=_[0],K=_[1];Object(c.useEffect)(function(){if(!y)return;U(y&&y.name),K(y&&y.description)},[y]);function Y(){return q.apply(this,arguments)}function q(){return q=Object(B.a)(C.a.mark(function me(){var he;return C.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:if(I){ue.next=3;break}return O.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),ue.abrupt("return");case 3:if(M){ue.next=6;break}return O.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),ue.abrupt("return");case 6:if(!y){ue.next=9;break}return oe(),ue.abrupt("return");case 9:return ue.next=11,Object(x.a)("/api/hpc_courses.json",{method:"post",body:{name:I,description:M,container_type:window.location.pathname.split("/")[1]}});case 11:he=ue.sent,he&&(O.b.info("\u521B\u5EFA\u6210\u529F"),o(!1),E("add"));case 13:case"end":return ue.stop()}},me)})),q.apply(this,arguments)}function oe(){return be.apply(this,arguments)}function be(){return be=Object(B.a)(C.a.mark(function me(){var he;return C.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return ue.next=2,Object(x.a)("/api/hpc_courses/".concat(y.id,".json"),{method:"put",body:{name:I,description:M,container_type:window.location.pathname.split("/")[1]}});case 2:he=ue.sent,he&&(O.b.info("\u7F16\u8F91\u6210\u529F"),o(!1),E(""));case 4:case"end":return ue.stop()}},me)})),be.apply(this,arguments)}return p.a.createElement("div",null,p.a.createElement(w.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:I,maxLength:60,addonAfter:String(I.length)+"/60",onChange:function(he){return U(he.target.value)}}),p.a.createElement(b.a,{id:"courseContentMD",defaultValue:M,onChange:function(he){return K(he)}}),p.a.createElement("div",{className:"clearfix mt30 mb30"},p.a.createElement(z.a,{type:"primary",onClick:function(){return Y()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),p.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return o(!1)}},"\u53D6\u6D88")))}var a=l,s=re("9Bee");function u(d){var o=d.CourseItem,E=d.userId,y=d.init,m=d.ItemUpdate,k=d.setSee,I=d.UserInfo;function U(){return W.apply(this,arguments)}function W(){return W=Object(B.a)(C.a.mark(function M(){var K;return C.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,Object(x.a)("/api/hpc_courses/".concat(o.id,".json"),{method:"delete"});case 2:K=q.sent,K&&(O.b.info("\u5220\u9664\u6210\u529F"),y("delete"),k(!1));case 4:case"end":return q.stop()}},M)})),W.apply(this,arguments)}function _(){m(o)}return p.a.createElement("div",null,E===299635||E===301458||I!=null&&I.admin||I!=null&&I.business?p.a.createElement("div",{style:{textAlign:"right"}},p.a.createElement(z.a,{onClick:function(){return _()}},"\u7F16\u8F91"),p.a.createElement(z.a,{onClick:function(){return U()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,p.a.createElement("h1",null,o==null?void 0:o.name),p.a.createElement(s.a,{value:o==null?void 0:o.description}))}var A=u,v=re("9ivq"),g=re("m3rI"),D=re("Ty5D"),T=re("9kvl");function f(d){var o,E,y,m,k,I,U,W,_,M=d.user,K=d.dispatch,Y=Object(c.useState)(1),q=Object(N.a)(Y,2),oe=q[0],be=q[1],me=Object(c.useState)(100),he=Object(N.a)(me,2),fe=he[0],ue=he[1],ie=Object(c.useState)([]),pe=Object(N.a)(ie,2),$=pe[0],ae=pe[1],ee=Object(c.useState)(!1),Ee=Object(N.a)(ee,2),Ce=Ee[0],ve=Ee[1],Se=Object(c.useState)(!1),Re=Object(N.a)(Se,2),Ne=Re[0],_e=Re[1],Pe=Object(c.useState)(""),ke=Object(N.a)(Pe,2),Ze=ke[0],Ge=ke[1],Ve=Object(c.useState)(""),We=Object(N.a)(Ve,2),rt=We[0],Xe=We[1],$e=Object(c.useState)(""),we=Object(N.a)($e,2),qe=we[0],Ye=we[1],Ae=Object(D.i)(),Me=Ae.itemname,ge=Object(c.useState)(""),de=Object(N.a)(ge,2),ce=de[0],Q=de[1];Object(c.useEffect)(function(){K({type:"globalSetting/headerToggle",payload:!1}),oe&&Z("")},[oe]);function Z(et){return te.apply(this,arguments)}function te(){return te=Object(B.a)(C.a.mark(function et(ut){var Le,ht,it,Qe,vt;return C.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return yt.next=2,Object(x.a)("/api/hpc_courses.json",{method:"get",params:{page:oe,per_page:fe,container_type:window.location.pathname.split("/")[1]}});case 2:if(Le=yt.sent,!Le){yt.next=24;break}if(ht=Le.data.hpc_courses.length,ae(Le.data.hpc_courses),Ye(Le.data.file_url),Xe(""),ht){yt.next=10;break}return yt.abrupt("return");case 10:if(ce){yt.next=14;break}Me?(vt=0,Le==null||((it=Le.data)===null||it===void 0||((Qe=it.hpc_courses)===null||Qe===void 0))||Qe.map(function(St,mt){var Yt;(Me==null?void 0:Me.toLocaleLowerCase())===(St==null||((Yt=St.name)===null||Yt===void 0)?void 0:Yt.toLocaleLowerCase())&&(vt=mt)}),Ge(Le.data.hpc_courses[vt]),_e(!0),Q(Le.data.hpc_courses[vt].id),(Me==null?void 0:Me.toLocaleLowerCase())==="resources"&&(Ge(Le.data.hpc_courses.filter(function(St){return St.id===15})[0]),_e(!0),Q(15))):(Ge(Le.data.hpc_courses[0]),_e(!0),Q(Le.data.hpc_courses[0].id)),yt.next=24;break;case 14:if(!(ut==="delete")){yt.next=23;break}if(!(ht===0)){yt.next=18;break}return _e(!1),yt.abrupt("return");case 18:Ge(Le.data.hpc_courses[0]),_e(!0),Q(Le.data.hpc_courses[0].id),yt.next=24;break;case 23:ut==="add"?(Ge(Le.data.hpc_courses[ht-1]),_e(!0),Q(Le.data.hpc_courses[ht-1].id)):(Ge(Le.data.hpc_courses.filter(function(St){return St.id===ce})[0]),_e(!0),Q(ce));case 24:case"end":return yt.stop()}},et)})),te.apply(this,arguments)}function se(et){ve(!1),_e(!0),Ge(et),Q(et.id)}function Te(et){Xe(et),ve(!0),_e(!1)}function De(){Xe(""),ve(!0),_e(!1)}var Be={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(ut){var Le=ut.file.status;Le!=="uploading",Le==="done"?(O.b.success("".concat(ut.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),Z("")):Le==="error"&&O.b.error("".concat(ut.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(ut){var Le=ut.size/1024/1024<150;return Le||O.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Le}};return p.a.createElement("div",{style:{marginBottom:"40px"}},p.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(g.a.IMG_SERVER+"/".concat(qe),")")}}),p.a.createElement("img",{style:{width:"100%"},src:g.a.IMG_SERVER+"/".concat(qe)}),p.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},p.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},$&&$.map(function(et,ut){return p.a.createElement("p",{key:ut,onClick:function(){return se(et)},className:ce===et.id?"menuitemselect":"menuitem task-hide"},et.name)}),(M==null||((o=M.userInfo)===null||o===void 0)?void 0:o.user_id)===299635||(M==null||((E=M.userInfo)===null||E===void 0)?void 0:E.user_id)===301458||M!=null&&(y=M.userInfo)!==null&&y!==void 0&&y.admin||M!=null&&(m=M.userInfo)!==null&&m!==void 0&&m.business?p.a.createElement("p",{onClick:function(){return De()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},p.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),p.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},Ce?p.a.createElement(a,{UpdateItem:rt,setIscreate:ve,init:Z}):null,Ne?p.a.createElement(A,{UserInfo:M==null?void 0:M.userInfo,setSee:_e,userId:M==null||((k=M.userInfo)===null||k===void 0)?void 0:k.user_id,ItemUpdate:Te,CourseItem:Ze,init:Z}):null)),(M==null||((I=M.userInfo)===null||I===void 0)?void 0:I.user_id)===299635||(M==null||((U=M.userInfo)===null||U===void 0)?void 0:U.user_id)===301458||M!=null&&(W=M.userInfo)!==null&&W!==void 0&&W.admin||M!=null&&(_=M.userInfo)!==null&&_!==void 0&&_.business?p.a.createElement(H.a,Be,p.a.createElement(z.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var h=ze.default=Object(T.a)(function(d){var o=d.user;return{user:o}})(f)},h78n:function(nt,ze,re){"use strict";re.d(ze,"a",function(){return m});var J=re("cDcd"),H=re.n(J),L=re("TSYQ"),z=re.n(L),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(U){var W=U.map(function(){return Object(J.useRef)()}),_=Object(J.useRef)();return Object(J.useEffect)(function(){var M=Date.now(),K=!1;Object.keys(W).forEach(function(Y){var q=W[Y].current;if(!q)return;K=!0;var oe=q.style;oe.transitionDuration=".3s, .3s, .3s, .06s",_.current&&M-_.current<100&&(oe.transitionDuration="0s, 0s")}),K&&(_.current=Date.now())}),[W]};function B(){return B=Object.assign||function(I){for(var U=1;U<arguments.length;U++){var W=arguments[U];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(I[_]=W[_])}return I},B.apply(this,arguments)}function N(I,U){return R(I)||p(I,U)||C(I,U)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(I,U){if(!I)return;if(typeof I=="string")return c(I,U);var W=Object.prototype.toString.call(I).slice(8,-1);if(W==="Object"&&I.constructor&&(W=I.constructor.name),W==="Map"||W==="Set")return Array.from(I);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return c(I,U)}function c(I,U){(U==null||U>I.length)&&(U=I.length);for(var W=0,_=new Array(U);W<U;W++)_[W]=I[W];return _}function p(I,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var W=[],_=!0,M=!1,K=void 0;try{for(var Y=I[Symbol.iterator](),q;!(_=(q=Y.next()).done)&&!(W.push(q.value),U&&W.length===U);_=!0);}catch(oe){M=!0,K=oe}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(M)throw K}}return W}function R(I){if(Array.isArray(I))return I}function w(I,U){if(I==null)return{};var W=b(I,U),_,M;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(I);for(M=0;M<K.length;M++){if(_=K[M],U.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,_))continue;W[_]=I[_]}}return W}function b(I,U){if(I==null)return{};var W={},_=Object.keys(I),M,K;for(K=0;K<_.length;K++){if(M=_[K],U.indexOf(M)>=0)continue;W[M]=I[M]}return W}var x=function(U){var W=U.className,_=U.percent,M=U.prefixCls,K=U.strokeColor,Y=U.strokeLinecap,q=U.strokeWidth,oe=U.style,be=U.trailColor,me=U.trailWidth,he=U.transition,fe=w(U,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete fe.gapPosition;var ue=Array.isArray(_)?_:[_],ie=Array.isArray(K)?K:[K],pe=O(ue),$=N(pe,1),ae=$[0],ee=q/2,Ee=100-q/2,Ce="M ".concat(Y==="round"?ee:0,",").concat(ee,`
|
|
L `).concat(Y==="round"?Ee:100,",").concat(ee),ve="0 0 100 ".concat(q),Se=0;return H.a.createElement("svg",B({className:z()("".concat(M,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:oe},fe),H.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:be,strokeWidth:me||q,fillOpacity:"0"}),ue.map(function(Re,Ne){var _e={strokeDasharray:"".concat(Re,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Pe=ie[Ne]||ie[ie.length-1];return Se+=Re,H.a.createElement("path",{key:Ne,className:"".concat(M,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Pe,strokeWidth:q,fillOpacity:"0",ref:ae[Ne],style:_e})}))};x.defaultProps=F;var l=x;function a(){return a=Object.assign||function(I){for(var U=1;U<arguments.length;U++){var W=arguments[U];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(I[_]=W[_])}return I},a.apply(this,arguments)}function s(I,U){return D(I)||g(I,U)||A(I,U)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(I,U){if(!I)return;if(typeof I=="string")return v(I,U);var W=Object.prototype.toString.call(I).slice(8,-1);if(W==="Object"&&I.constructor&&(W=I.constructor.name),W==="Map"||W==="Set")return Array.from(I);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return v(I,U)}function v(I,U){(U==null||U>I.length)&&(U=I.length);for(var W=0,_=new Array(U);W<U;W++)_[W]=I[W];return _}function g(I,U){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(I)))return;var W=[],_=!0,M=!1,K=void 0;try{for(var Y=I[Symbol.iterator](),q;!(_=(q=Y.next()).done)&&!(W.push(q.value),U&&W.length===U);_=!0);}catch(oe){M=!0,K=oe}finally{try{!_&&Y.return!=null&&Y.return()}finally{if(M)throw K}}return W}function D(I){if(Array.isArray(I))return I}function T(I,U){if(I==null)return{};var W=f(I,U),_,M;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(I);for(M=0;M<K.length;M++){if(_=K[M],U.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(I,_))continue;W[_]=I[_]}}return W}function f(I,U){if(I==null)return{};var W={},_=Object.keys(I),M,K;for(K=0;K<_.length;K++){if(M=_[K],U.indexOf(M)>=0)continue;W[M]=I[M]}return W}var h=0;function d(I){return+I.replace("%","")}function o(I){return Array.isArray(I)?I:[I]}function E(I,U,W,_){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,Y=50-_/2,q=0,oe=-Y,be=0,me=-2*Y;switch(K){case"left":q=-Y,oe=0,be=2*Y,me=0;break;case"right":q=Y,oe=0,be=-2*Y,me=0;break;case"bottom":oe=Y,me=2*Y;break;default:}var he="M 50,50 m ".concat(q,",").concat(oe,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(be,",").concat(-me,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-be,",").concat(me),fe=Math.PI*2*Y,ue={stroke:W,strokeDasharray:"".concat(U/100*(fe-M),"px ").concat(fe,"px"),strokeDashoffset:"-".concat(M/2+I/100*(fe-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:ue}}var y=function(U){var W=U.prefixCls,_=U.strokeWidth,M=U.trailWidth,K=U.gapDegree,Y=U.gapPosition,q=U.trailColor,oe=U.strokeLinecap,be=U.style,me=U.className,he=U.strokeColor,fe=U.percent,ue=T(U,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(J.useMemo)(function(){return h+=1,h},[]),pe=E(0,100,q,_,K,Y),$=pe.pathString,ae=pe.pathStyle,ee=o(fe),Ee=o(he),Ce=Ee.find(function(_e){return Object.prototype.toString.call(_e)==="[object Object]"}),ve=O(ee),Se=s(ve,1),Re=Se[0],Ne=function(){var Pe=0;return ee.map(function(ke,Ze){var Ge=Ee[Ze]||Ee[Ee.length-1],Ve=Object.prototype.toString.call(Ge)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",We=E(Pe,ke,Ge,_,K,Y);return Pe+=ke,H.a.createElement("path",{key:Ze,className:"".concat(W,"-circle-path"),d:We.pathString,stroke:Ve,strokeLinecap:oe,strokeWidth:_,opacity:ke===0?0:1,fillOpacity:"0",style:We.pathStyle,ref:Re[Ze]})})};return H.a.createElement("svg",a({className:z()("".concat(W,"-circle"),me),viewBox:"0 0 100 100",style:be},ue),Ce&&H.a.createElement("defs",null,H.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(_e,Pe){return d(_e)-d(Pe)}).map(function(_e,Pe){return H.a.createElement("stop",{key:Pe,offset:_e,stopColor:Ce[_e]})}))),H.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:q,strokeLinecap:oe,strokeWidth:M||_,fillOpacity:"0",style:ae}),Ne().reverse())};y.defaultProps=F;var m=y,k={Line:l,Circle:m}},kSUc:function(nt,ze,re){},lZu9:function(nt,ze,re){(function(J){J(re("VrN/"),re("1eCo"),re("8EBN"))})(function(J){"use strict";J.defineMode("markdown",function(H,L){var z=J.getMode(H,"text/html"),F=z.name=="null";function O(_){if(J.findModeByName){var M=J.findModeByName(_);M&&(_=M.mime||M.mimes[0])}var K=J.getMode(H,_);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 N in B)B.hasOwnProperty(N)&&L.tokenTypeOverrides[N]&&(B[N]=L.tokenTypeOverrides[N]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,C=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,p=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,x=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function s(_,M,K){return M.f=M.inline=K,K(_,M)}function u(_,M,K){return M.f=M.block=K,K(_,M)}function A(_){return!_||!/\S/.test(_.string)}function v(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==D){var M=F;if(!M){var K=J.innerMode(z,_.htmlState);M=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}M&&(_.f=d,_.block=g,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function g(_,M){var K=_.column()===M.indentation,Y=A(M.prevLine.stream),q=M.indentedCode,oe=M.prevLine.hr,be=M.list!==!1,me=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var he=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,be)){for(M.list=null;he<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=he-M.listStack[M.listStack.length-1])}var fe=!Y&&!oe&&!M.prevLine.header&&(!be||!q)&&!M.prevLine.fencedCodeEnd,ue=(M.list===!1||oe||Y)&&M.indentation<=me&&_.match(P),ie=null;if(M.indentationDiff>=4&&(q||M.prevLine.fencedCodeEnd||M.prevLine.header||Y))return _.skipToEnd(),M.indentedCode=!0,B.code;if(_.eatSpace())return null;if(K&&M.indentation<=me&&(ie=_.match(p))&&ie[1].length<=6)return M.quote=0,M.header=ie[1].length,M.thisLine.header=!0,L.highlightFormatting&&(M.formatting="header"),M.f=M.inline,f(M);if(M.indentation<=me&&_.eat(">"))return M.quote=K?1:M.quote+1,L.highlightFormatting&&(M.formatting="quote"),_.eatSpace(),f(M);if(!ue&&!M.setext&&K&&M.indentation<=me&&(ie=_.match(C))){var pe=ie[1]?"ol":"ul";return M.indentation=he+_.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,L.taskLists&&_.match(c,!1)&&(M.taskList=!0),M.f=M.inline,L.highlightFormatting&&(M.formatting=["list","list-"+pe]),f(M)}else{if(K&&M.indentation<=me&&(ie=_.match(b,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ie[1]+"+ *$"),M.localMode=L.fencedCodeBlockHighlighting&&O(ie[2]||L.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=J.startState(M.localMode)),M.f=M.block=T,L.highlightFormatting&&(M.formatting="code-block"),M.code=-1,f(M);if(M.setext||(!fe||!be)&&!M.quote&&M.list===!1&&!M.code&&!ue&&!x.test(_.string)&&(ie=_.lookAhead(1))&&(ie=ie.match(R)))return M.setext?(M.header=M.setext,M.setext=0,_.skipToEnd(),L.highlightFormatting&&(M.formatting="header")):(M.header=ie[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,f(M);if(ue)return _.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,B.hr;if(_.peek()==="[")return s(_,M,k)}return s(_,M,M.inline)}function D(_,M){var K=z.token(_,M.htmlState);if(!F){var Y=J.innerMode(z,M.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||M.md_inside&&_.current().indexOf(">")>-1)&&(M.f=d,M.block=g,M.htmlState=null)}return K}function T(_,M){var K=M.listStack[M.listStack.length-1]||0,Y=M.indentation<K,q=K+3;if(M.fencedEndRE&&M.indentation<=q&&(Y||_.match(M.fencedEndRE))){L.highlightFormatting&&(M.formatting="code-block");var oe;return Y||(oe=f(M)),M.localMode=M.localState=null,M.block=g,M.f=d,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,Y?u(_,M,M.block):oe}else return M.localMode?M.localMode.token(_,M.localState):(_.skipToEnd(),B.code)}function f(_){var M=[];if(_.formatting){M.push(B.formatting),typeof _.formatting=="string"&&(_.formatting=[_.formatting]);for(var K=0;K<_.formatting.length;K++)M.push(B.formatting+"-"+_.formatting[K]),_.formatting[K]==="header"&&M.push(B.formatting+"-"+_.formatting[K]+"-"+_.header),_.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?M.push(B.formatting+"-"+_.formatting[K]+"-"+_.quote):M.push("error"))}if(_.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(_.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(_.linkHref?M.push(B.linkHref,"url"):(_.strong&&M.push(B.strong),_.em&&M.push(B.em),_.strikethrough&&M.push(B.strikethrough),_.emoji&&M.push(B.emoji),_.linkText&&M.push(B.linkText),_.code&&M.push(B.code),_.image&&M.push(B.image),_.imageAltText&&M.push(B.imageAltText,"link"),_.imageMarker&&M.push(B.imageMarker)),_.header&&M.push(B.header,B.header+"-"+_.header),_.quote&&(M.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?M.push(B.quote+"-"+_.quote):M.push(B.quote+"-"+L.maxBlockquoteDepth)),_.list!==!1){var Y=(_.listStack.length-1)%3;Y?Y===1?M.push(B.list2):M.push(B.list3):M.push(B.list1)}return _.trailingSpaceNewLine?M.push("trailing-space-new-line"):_.trailingSpace&&M.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function h(_,M){return _.match(w,!0)?f(M):void 0}function d(_,M){var K=M.text(_,M);if(typeof K!="undefined")return K;if(M.list)return M.list=null,f(M);if(M.taskList){var Y=_.match(c,!0)[1]===" ";return Y?M.taskOpen=!0:M.taskClosed=!0,L.highlightFormatting&&(M.formatting="task"),M.taskList=!1,f(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&_.match(/^#+$/,!0))return L.highlightFormatting&&(M.formatting="header"),f(M);var q=_.next();if(M.linkTitle){M.linkTitle=!1;var oe=q;q==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(_.match(new RegExp(be),!0))return B.linkHref}if(q==="`"){var me=M.formatting;L.highlightFormatting&&(M.formatting="code"),_.eatWhile("`");var he=_.current().length;if(M.code==0&&(!M.quote||he==1))return M.code=he,f(M);if(he==M.code){var fe=f(M);return M.code=0,fe}else return M.formatting=me,f(M)}else if(M.code)return f(M);if(q==="\\"&&(_.next(),L.highlightFormatting)){var ue=f(M),ie=B.formatting+"-escape";return ue?ue+" "+ie:ie}if(q==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,L.highlightFormatting&&(M.formatting="image"),f(M);if(q==="["&&M.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,L.highlightFormatting&&(M.formatting="image"),f(M);if(q==="]"&&M.imageAltText){L.highlightFormatting&&(M.formatting="image");var ue=f(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=E,ue}if(q==="["&&!M.image)return M.linkText&&_.match(/^.*?\]/)||(M.linkText=!0,L.highlightFormatting&&(M.formatting="link")),f(M);if(q==="]"&&M.linkText){L.highlightFormatting&&(M.formatting="link");var ue=f(M);return M.linkText=!1,M.inline=M.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?E:d,ue}if(q==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=o,L.highlightFormatting&&(M.formatting="link");var ue=f(M);return ue?ue+=" ":ue="",ue+B.linkInline}if(q==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=o,L.highlightFormatting&&(M.formatting="link");var ue=f(M);return ue?ue+=" ":ue="",ue+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($)&&(M.md_inside=!0)}return _.backUp(1),M.htmlState=J.startState(z),u(_,M,D)}if(L.xml&&q==="<"&&_.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ae=1,ee=_.pos==1?" ":_.string.charAt(_.pos-2);ae<3&&_.eat(q);)ae++;var Ee=_.peek()||" ",Ce=!/\s/.test(Ee)&&(!l.test(Ee)||/\s/.test(ee)||l.test(ee)),ve=!/\s/.test(ee)&&(!l.test(ee)||/\s/.test(Ee)||l.test(Ee)),Se=null,Re=null;if(ae%2&&(!M.em&&Ce&&(q==="*"||!ve||l.test(ee))?Se=!0:M.em==q&&ve&&(q==="*"||!Ce||l.test(Ee))&&(Se=!1)),ae>1&&(!M.strong&&Ce&&(q==="*"||!ve||l.test(ee))?Re=!0:M.strong==q&&ve&&(q==="*"||!Ce||l.test(Ee))&&(Re=!1)),Re!=null||Se!=null){L.highlightFormatting&&(M.formatting=Se==null?"strong":Re==null?"em":"strong em"),Se===!0&&(M.em=q),Re===!0&&(M.strong=q);var fe=f(M);return Se===!1&&(M.em=!1),Re===!1&&(M.strong=!1),fe}}else if(q===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return f(M);_.backUp(1)}if(L.strikethrough){if(q==="~"&&_.eatWhile(q)){if(M.strikethrough){L.highlightFormatting&&(M.formatting="strikethrough");var fe=f(M);return M.strikethrough=!1,fe}else if(_.match(/^[^\s]/,!1))return M.strikethrough=!0,L.highlightFormatting&&(M.formatting="strikethrough"),f(M)}else if(q===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return f(M);_.backUp(2)}}if(L.emoji&&q===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,L.highlightFormatting&&(M.formatting="emoji");var Ne=f(M);return M.emoji=!1,Ne}return q===" "&&(_.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),f(M)}function o(_,M){var K=_.next();if(K===">"){M.f=M.inline=d,L.highlightFormatting&&(M.formatting="link");var Y=f(M);return Y?Y+=" ":Y="",Y+B.linkInline}return _.match(/^[^>]+/,!0),B.linkInline}function E(_,M){if(_.eatSpace())return null;var K=_.next();return K==="("||K==="["?(M.f=M.inline=m(K==="("?")":"]"),L.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,f(M)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function m(_){return function(M,K){var Y=M.next();if(Y===_){K.f=K.inline=d,L.highlightFormatting&&(K.formatting="link-string");var q=f(K);return K.linkHref=!1,q}return M.match(y[_]),K.linkHref=!0,f(K)}}function k(_,M){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=I,_.next(),L.highlightFormatting&&(M.formatting="link"),M.linkText=!0,f(M)):s(_,M,d)}function I(_,M){if(_.match(/^\]:/,!0)){M.f=M.inline=U,L.highlightFormatting&&(M.formatting="link");var K=f(M);return M.linkText=!1,K}return _.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function U(_,M){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?M.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=d,B.linkHref+" url")}var W={startState:function(){return{f:g,prevLine:{stream:null},thisLine:{stream:null},block:g,htmlState:null,indentation:0,inline:d,text:h,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&&J.copyState(z,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?J.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(_,M){if(M.formatting=!1,_!=M.thisLine.stream){if(M.header=0,M.hr=!1,_.match(/^\s*$/,!0))return v(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:_},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=D)){var K=_.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(M.indentation=K,M.indentationDiff=null,K>0)return null}}return M.f(_,M)},innerMode:function(_){return _.block==D?{state:_.htmlState,mode:z}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:W}},indent:function(_,M,K){return _.block==D&&z.indent?z.indent(_.htmlState,M,K):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,M,K):J.Pass},blankLine:v,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},nVVt:function(nt,ze){nt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(nt,ze,re){(function(J){J(re("VrN/"))})(function(J){"use strict";var H=J.Pos;function L(l,a){return l.line-a.line||l.ch-a.ch}var z="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",F=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+z+"]["+F+"]*)","g");function B(l,a,s,u){this.line=a,this.ch=s,this.cm=l,this.text=l.getLine(a),this.min=u?Math.max(u.from,l.firstLine()):l.firstLine(),this.max=u?Math.min(u.to-1,l.lastLine()):l.lastLine()}function N(l,a){var s=l.cm.getTokenTypeAt(H(l.line,a));return s&&/\btag\b/.test(s)}function P(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function C(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function c(l){for(;;){var a=l.text.indexOf(">",l.ch);if(a==-1){if(P(l))continue;return}if(!N(l,a+1)){l.ch=a+1;continue}var s=l.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(l.text.slice(s+1,a));return l.ch=a+1,u?"selfClose":"regular"}}function p(l){for(;;){var a=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(a==-1){if(C(l))continue;return}if(!N(l,a+1)){l.ch=a;continue}O.lastIndex=a,l.ch=a;var s=O.exec(l.text);if(s&&s.index==a)return s}}function R(l){for(;;){O.lastIndex=l.ch;var a=O.exec(l.text);if(!a){if(P(l))continue;return}if(!N(l,a.index+1)){l.ch=a.index+1;continue}return l.ch=a.index+a[0].length,a}}function w(l){for(;;){var a=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(a==-1){if(C(l))continue;return}if(!N(l,a+1)){l.ch=a;continue}var s=l.text.lastIndexOf("/",a),u=s>-1&&!/\S/.test(l.text.slice(s+1,a));return l.ch=a+1,u?"selfClose":"regular"}}function b(l,a){for(var s=[];;){var u=R(l),A,v=l.line,g=l.ch-(u?u[0].length:0);if(!u||!(A=c(l)))return;if(A=="selfClose")continue;if(u[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==u[2]){s.length=D;break}if(D<0&&(!a||a==u[2]))return{tag:u[2],from:H(v,g),to:H(l.line,l.ch)}}else s.push(u[2])}}function x(l,a){for(var s=[];;){var u=w(l);if(!u)return;if(u=="selfClose"){p(l);continue}var A=l.line,v=l.ch,g=p(l);if(!g)return;if(g[1])s.push(g[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==g[2]){s.length=D;break}if(D<0&&(!a||a==g[2]))return{tag:g[2],from:H(l.line,l.ch),to:H(A,v)}}}}J.registerHelper("fold","xml",function(l,a){for(var s=new B(l,a.line,0);;){var u=R(s);if(!u||s.line!=a.line)return;var A=c(s);if(!A)return;if(!u[1]&&A!="selfClose"){var v=H(s.line,s.ch),g=b(s,u[2]);return g&&L(g.from,v)>0?{from:v,to:g.from}:null}}}),J.findMatchingTag=function(l,a,s){var u=new B(l,a.line,a.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var A=c(u),v=A&&H(u.line,u.ch),g=A&&p(u);if(!A||!g||L(u,a)>0)return;var D={from:H(u.line,u.ch),to:v,tag:g[2]};return A=="selfClose"?{open:D,close:null,at:"open"}:g[1]?{open:x(u,g[2]),close:D,at:"close"}:(u=new B(l,v.line,v.ch,s),{open:D,close:b(u,g[2]),at:"open"})},J.findEnclosingTag=function(l,a,s,u){for(var A=new B(l,a.line,a.ch,s);;){var v=x(A,u);if(!v)break;var g=new B(l,a.line,a.ch,s),D=b(g,v.tag);if(D)return{open:v,close:D}}},J.scanForClosingTag=function(l,a,s,u){var A=new B(l,a.line,a.ch,u?{from:0,to:u}:null);return b(A,s)}})},"p77/":function(nt,ze,re){},rUJ1:function(nt,ze){const re=/[&<>"']/,J=/[&<>"']/g,H=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},F=T=>z[T];function O(T,f){if(f){if(re.test(T))return T.replace(J,F)}else if(H.test(T))return T.replace(L,F);return T}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(T){return T.replace(B,(f,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const P=/(^|[^\[])\^/g;function C(T,f){T=T.source||T,f=f||"";const h={replace:(d,o)=>(o=o.source||o,o=o.replace(P,"$1"),T=T.replace(d,o),h),getRegex:()=>new RegExp(T,f)};return h}const c=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(T,f,h){if(T){let d;try{d=decodeURIComponent(N(h)).replace(c,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!p.test(h)&&(h=a(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(d){return null}return h}const w={},b=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,f){w[" "+T]||(b.test(T)?w[" "+T]=T+"/":w[" "+T]=v(T,"/",!0)),T=w[" "+T];const h=T.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:T.replace(x,"$1")+f:f.charAt(0)==="/"?h?f:T.replace(l,"$1")+f:T+f}const s={exec:function(){}};function u(T){let f=1,h,d;for(;f<arguments.length;f++){h=arguments[f];for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(T[d]=h[d])}return T}function A(T,f){const h=T.replace(/\|/g,(E,y,m)=>{let k=!1,I=y;for(;--I>=0&&m[I]==="\\";)k=!k;return k?"|":" |"}),d=h.split(/ \|/);let o=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function v(T,f,h){const d=T.length;if(d===0)return"";let o=0;for(;o<d;){const E=T.charAt(d-o-1);if(E===f&&!h)o++;else if(E!==f&&h)o++;else break}return T.substr(0,d-o)}function g(T,f){if(T.indexOf(f[1])===-1)return-1;const h=T.length;let d=0,o=0;for(;o<h;o++)if(T[o]==="\\")o++;else if(T[o]===f[0])d++;else if(T[o]===f[1]&&(d--,d<0))return o;return-1}function D(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}nt.exports={escape:O,unescape:N,edit:C,cleanUrl:R,resolveUrl:a,noopTest:s,merge:u,splitCells:A,rtrim:v,findClosingBracket:g,checkSanitizeDeprecation:D}},rcnY:function(nt,ze,re){var J=re("aRTE");function H(L,z){this.totalCount=L,this.dataCount=z}H.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],H.getRSBlocks=function(L,z){var F=H.getRsBlockTable(L,z);if(F==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+z);for(var O=F.length/3,B=new Array,N=0;N<O;N++)for(var P=F[N*3+0],C=F[N*3+1],c=F[N*3+2],p=0;p<P;p++)B.push(new H(C,c));return B},H.getRsBlockTable=function(L,z){switch(z){case J.L:return H.RS_BLOCK_TABLE[(L-1)*4+0];case J.M:return H.RS_BLOCK_TABLE[(L-1)*4+1];case J.Q:return H.RS_BLOCK_TABLE[(L-1)*4+2];case J.H:return H.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},nt.exports=H},ulZh:function(nt,ze,re){typeof window!="undefined"&&function(H,L){nt.exports=L()}(this,function(){return function(J){var H={};function L(z){if(H[z])return H[z].exports;var F=H[z]={i:z,l:!1,exports:{}};return J[z].call(F.exports,F,F.exports,L),F.l=!0,F.exports}return L.m=J,L.c=H,L.d=function(z,F,O){L.o(z,F)||Object.defineProperty(z,F,{enumerable:!0,get:O})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,F){if(F&1&&(z=L(z)),F&8)return z;if(F&4&&typeof z=="object"&&z&&z.__esModule)return z;var O=Object.create(null);if(L.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:z}),F&2&&typeof z!="string")for(var B in z)L.d(O,B,function(N){return z[N]}.bind(null,B));return O},L.n=function(z){var F=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(F,"a",F),F},L.o=function(z,F){return Object.prototype.hasOwnProperty.call(z,F)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(J,H,L){"use strict";var z=Object.prototype.hasOwnProperty,F="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(F=!1));function B(c,p,R){this.fn=c,this.context=p,this.once=R||!1}function N(c,p,R,w,b){if(typeof R!="function")throw new TypeError("The listener must be a function");var x=new B(R,w||c,b),l=F?F+p:p;return c._events[l]?c._events[l].fn?c._events[l]=[c._events[l],x]:c._events[l].push(x):(c._events[l]=x,c._eventsCount++),c}function P(c,p){--c._eventsCount===0?c._events=new O:delete c._events[p]}function C(){this._events=new O,this._eventsCount=0}C.prototype.eventNames=function(){var p=[],R,w;if(this._eventsCount===0)return p;for(w in R=this._events)z.call(R,w)&&p.push(F?w.slice(1):w);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(R)):p},C.prototype.listeners=function(p){var R=F?F+p:p,w=this._events[R];if(!w)return[];if(w.fn)return[w.fn];for(var b=0,x=w.length,l=new Array(x);b<x;b++)l[b]=w[b].fn;return l},C.prototype.listenerCount=function(p){var R=F?F+p:p,w=this._events[R];return w?w.fn?1:w.length:0},C.prototype.emit=function(p,R,w,b,x,l){var a=F?F+p:p;if(!this._events[a])return!1;var s=this._events[a],u=arguments.length,A,v;if(s.fn){s.once&&this.removeListener(p,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,R),!0;case 3:return s.fn.call(s.context,R,w),!0;case 4:return s.fn.call(s.context,R,w,b),!0;case 5:return s.fn.call(s.context,R,w,b,x),!0;case 6:return s.fn.call(s.context,R,w,b,x,l),!0}for(v=1,A=new Array(u-1);v<u;v++)A[v-1]=arguments[v];s.fn.apply(s.context,A)}else{var g=s.length,D;for(v=0;v<g;v++){s[v].once&&this.removeListener(p,s[v].fn,void 0,!0);switch(u){case 1:s[v].fn.call(s[v].context);break;case 2:s[v].fn.call(s[v].context,R);break;case 3:s[v].fn.call(s[v].context,R,w);break;case 4:s[v].fn.call(s[v].context,R,w,b);break;default:if(!A)for(D=1,A=new Array(u-1);D<u;D++)A[D-1]=arguments[D];s[v].fn.apply(s[v].context,A)}}}return!0},C.prototype.on=function(p,R,w){return N(this,p,R,w,!1)},C.prototype.once=function(p,R,w){return N(this,p,R,w,!0)},C.prototype.removeListener=function(p,R,w,b){var x=F?F+p:p;if(!this._events[x])return this;if(!R)return P(this,x),this;var l=this._events[x];if(l.fn)l.fn===R&&(!b||l.once)&&(!w||l.context===w)&&P(this,x);else{for(var a=0,s=[],u=l.length;a<u;a++)(l[a].fn!==R||b&&!l[a].once||w&&l[a].context!==w)&&s.push(l[a]);s.length?this._events[x]=s.length===1?s[0]:s:P(this,x)}return this},C.prototype.removeAllListeners=function(p){var R;return p?(R=F?F+p:p,this._events[R]&&P(this,R)):(this._events=new O,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=F,C.EventEmitter=C,J.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(J,H,L){(function(z){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(C,c,p){if(p=p||{},C=C.trim(),c=c.trim(),!c){if(!p.alwaysNormalize)return C;var R=P.parseURL(C);if(!R)throw new Error("Error trying to parse base URL.");return R.path=P.normalizePath(R.path),P.buildURLFromParts(R)}var w=P.parseURL(c);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return p.alwaysNormalize?(w.path=P.normalizePath(w.path),P.buildURLFromParts(w)):c;var b=P.parseURL(C);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var x=O.exec(b.path);b.netLoc=x[1],b.path=x[2]}b.netLoc&&!b.path&&(b.path="/");var l={scheme:b.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(l.netLoc=b.netLoc,w.path[0]!=="/"))if(!w.path)l.path=b.path,w.params||(l.params=b.params,w.query||(l.query=b.query));else{var a=b.path,s=a.substring(0,a.lastIndexOf("/")+1)+w.path;l.path=P.normalizePath(s)}return l.path===null&&(l.path=p.alwaysNormalize?P.normalizePath(w.path):w.path),P.buildURLFromParts(l)},parseURL:function(C){var c=F.exec(C);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(B,"");C.length!==(C=C.replace(N,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};J.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(J,H,L){function z(p){var R={};function w(x){if(R[x])return R[x].exports;var l=R[x]={i:x,l:!1,exports:{}};return p[x].call(l.exports,l,l.exports,w),l.l=!0,l.exports}w.m=p,w.c=R,w.i=function(x){return x},w.d=function(x,l,a){w.o(x,l)||Object.defineProperty(x,l,{configurable:!1,enumerable:!0,get:a})},w.r=function(x){Object.defineProperty(x,"__esModule",{value:!0})},w.n=function(x){var l=x&&x.__esModule?function(){return x.default}:function(){return x};return w.d(l,"a",l),l},w.o=function(x,l){return Object.prototype.hasOwnProperty.call(x,l)},w.p="/",w.oe=function(x){throw console.error(x),x};var b=w(w.s=ENTRY_MODULE);return b.default||b}var F="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function B(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(p){return!isNaN(1*p)}function P(p,R,w){var b={};b[w]=[];var x=R.toString(),l=x.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return b;for(var a=l[1],s=new RegExp("(\\\\n|\\W)"+B(a)+O,"g"),u;u=s.exec(x);){if(u[3]==="dll-reference")continue;b[w].push(u[3])}for(s=new RegExp("\\("+B(a)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+O,"g");u=s.exec(x);)p[u[2]]||(b[w].push(u[1]),p[u[2]]=L(u[1]).m),b[u[2]]=b[u[2]]||[],b[u[2]].push(u[4]);for(var A=Object.keys(b),v=0;v<A.length;v++)for(var g=0;g<b[A[v]].length;g++)N(b[A[v]][g])&&(b[A[v]][g]=1*b[A[v]][g]);return b}function C(p){var R=Object.keys(p);return R.reduce(function(w,b){return w||p[b].length>0},!1)}function c(p,R){for(var w={main:[R]},b={main:[]},x={main:{}};C(w);)for(var l=Object.keys(w),a=0;a<l.length;a++){var s=l[a],u=w[s],A=u.pop();if(x[s]=x[s]||{},x[s][A]||!p[s][A])continue;x[s][A]=!0,b[s]=b[s]||[],b[s].push(A);for(var v=P(p,p[s][A],s),g=Object.keys(v),D=0;D<g.length;D++)w[g[D]]=w[g[D]]||[],w[g[D]]=w[g[D]].concat(v[g[D]])}return b}J.exports=function(p,R){R=R||{};var w={main:L.m},b=R.all?{main:Object.keys(w.main)}:c(w,p),x="";Object.keys(b).filter(function(A){return A!=="main"}).forEach(function(A){for(var v=0;b[A][v];)v++;b[A].push(v),w[A][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",x=x+"var "+A+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+b[A].map(function(g){return""+JSON.stringify(g)+": "+w[A][g].toString()}).join(",")+`});
|
|
`}),x=x+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+b.main.map(function(A){return""+JSON.stringify(A)+": "+w.main[A].toString()}).join(",")+"}))(self);";var l=new window.Blob([x],{type:"text/javascript"});if(R.bare)return l;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(l),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"hlsDefaultConfig",function(){return D}),L.d(H,"mergeConfig",function(){return f}),L.d(H,"enableStreamingMode",function(){return h});var z=L("./src/controller/abr-controller.ts"),F=L("./src/controller/audio-stream-controller.ts"),O=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),N=L("./src/controller/subtitle-track-controller.ts"),P=L("./src/controller/buffer-controller.ts"),C=L("./src/controller/timeline-controller.ts"),c=L("./src/controller/cap-level-controller.ts"),p=L("./src/controller/fps-controller.ts"),R=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),b=L("./src/utils/xhr-loader.ts"),x=L("./src/utils/fetch-loader.ts"),l=L("./src/utils/cues.ts"),a=L("./src/utils/mediakeys-helper.ts"),s=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var E=arguments[o];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(d[y]=E[y])}return d},u.apply(this,arguments)}function A(d,o){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);o&&(y=y.filter(function(m){return Object.getOwnPropertyDescriptor(d,m).enumerable})),E.push.apply(E,y)}return E}function v(d){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?A(Object(E),!0).forEach(function(y){g(d,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):A(Object(E)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(E,y))})}return d}function g(d,o,E){return o in d?Object.defineProperty(d,o,{value:E,enumerable:!0,configurable:!0,writable:!0}):d[o]=E,d}var D=v(v({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:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:P.default,capLevelController:c.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:N.default,timelineController:C.TimelineController,audioStreamController:F.default,audioTrackController:O.default,emeController:R.default,cmcdController:w.default});function T(){return{cueHandler:l.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 f(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,o)}function h(d){var o=d.loader;if(o!==x.default&&o!==b.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var E=Object(x.fetchSupported)();E&&(d.loader=x.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/polyfills/number.ts"),F=L("./src/utils/ewma-bandwidth-estimator.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),P=L("./src/types/loader.ts"),C=L("./src/utils/logger.ts");function c(w,b){for(var x=0;x<b.length;x++){var l=b[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function p(w,b,x){return b&&c(w.prototype,b),x&&c(w,x),w}var R=function(){function w(x){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=x;var l=x.config;this.bwEstimator=new F.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var b=w.prototype;return b.registerListeners=function(){var l=this.hls;l.on(O.Events.FRAG_LOADING,this.onFragLoading,this),l.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(O.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(O.Events.FRAG_LOADING,this.onFragLoading,this),l.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(O.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(l,a){var s=a.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(l,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,A=s.config,v=s.media;if(!l||!v)return;var g=a?a.stats:l.stats,D=a?a.duration:l.duration;if(g.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||v.paused||!v.playbackRate||!v.readyState)return;var T=performance.now()-g.loading.start,f=Math.abs(v.playbackRate);if(T<=500*D/f)return;var h=s.levels,d=s.minAutoLevel,o=h[l.level],E=g.total||Math.max(g.loaded,Math.round(D*o.maxBitrate/8)),y=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/T),m=(E-g.loaded)/y,k=v.currentTime,I=(B.BufferHelper.bufferInfo(v,k,A.maxBufferHole).end-k)/f;if(I>=2*D/f||m<=I)return;var U=Number.POSITIVE_INFINITY,W;for(W=l.level-1;W>d;W--){var _=h[W].maxBitrate;if(U=D*_/(8*.8*y),U<I)break}if(U>=m)return;var M=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+l.sn+(a?" part "+a.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+m.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+U.toFixed(3)+` s
|
|
Time to underbuffer: `+I.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(T,g.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:a,stats:g})},b.onFragLoaded=function(l,a){var s=a.frag,u=a.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var A=u?u.stats:s.stats,v=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[s.level],D=(g.loaded?g.loaded.bytes:0)+A.loaded,T=(g.loaded?g.loaded.duration:0)+v;g.loaded={bytes:D,duration:T},g.realBitrate=Math.round(8*D/T)}if(s.bitrateTest){var f={stats:A,frag:s,part:u,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,f),s.bitrateTest=!1}}},b.onFragBuffered=function(l,a){var s=a.frag,u=a.part,A=u?u.stats:s.stats;if(A.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var v=A.parsing.end-A.loading.start;this.bwEstimator.sample(v,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},b.onError=function(l,a){switch(a.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.maxAutoLevel,A=s.config,v=s.minAutoLevel,g=s.media,D=a?a.duration:l?l.duration:0,T=g?g.currentTime:0,f=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,d=(B.BufferHelper.bufferInfo(g,T,A.maxBufferHole).end-T)/f,o=this.findBestLevel(h,v,u,d,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(o>=0)return o;C.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=D?Math.min(D,A.maxStarvationDelay):A.maxStarvationDelay,y=A.abrBandWidthFactor,m=A.abrBandWidthUpFactor;if(!d){var k=this.bitrateTestDelay;if(k){var I=D?Math.min(D,A.maxLoadingDelay):A.maxLoadingDelay;E=I-k,C.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),y=m=1}}return o=this.findBestLevel(h,v,u,d+E,y,m),Math.max(o,0)},b.findBestLevel=function(l,a,s,u,A,v){for(var g,D=this.fragCurrent,T=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,d=h[f],o=!!(d!=null&&(g=d.details)!==null&&g!==void 0&&g.live),E=d==null?void 0:d.codecSet,y=T?T.duration:D?D.duration:0,m=s;m>=a;m--){var k=h[m];if(!k||E&&k.codecSet!==E)continue;var I=k.details,U=(T?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||y,W=void 0;m<=f?W=A*l:W=v*l;var _=h[m].maxBitrate,M=_*U/W;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(W)+"/"+_+"/"+U+"/"+u+"/"+M),W>_&&(!M||o&&!this.bitrateTestDelay||M<u))return m}return-1},p(w,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,a=this.bwEstimator;if(l!==-1&&(!a||!a.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),w}();H.default=R},"./src/controller/audio-stream-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/polyfills/number.ts"),F=L("./src/controller/base-stream-controller.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/controller/fragment-tracker.ts"),P=L("./src/types/level.ts"),C=L("./src/types/loader.ts"),c=L("./src/loader/fragment.ts"),p=L("./src/demux/chunk-cache.ts"),R=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),b=L("./src/controller/fragment-finders.ts"),x=L("./src/utils/discontinuities.ts"),l=L("./src/errors.ts"),a=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(D[h]=f[h])}return D},s.apply(this,arguments)}function u(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,A(D,T)}function A(D,T){return A=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},A(D,T)}var v=100,g=function(D){u(T,D);function T(h,d){var o;return o=D.call(this,h,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var f=T.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(O.Events.ERROR,this.onError,this),d.on(O.Events.BUFFER_RESET,this.onBufferReset,this),d.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(O.Events.ERROR,this.onError,this),d.off(O.Events.BUFFER_RESET,this.onBufferReset,this),d.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,o){var E=o.frag,y=o.id,m=o.initPTS;if(y==="main"){var k=E.cc;this.initPTS[E.cc]=m,this.log("InitPTS for cc: "+k+" found from main: "+m),this.videoTrackCC=k,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=F.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var d,o=this.levels,E=this.trackId,y=o==null||((d=o[E])===null||d===void 0)?void 0:d.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var m,k=performance.now(),I=this.retryDate;(!I||k>=I||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var W=U.frag,_=U.part,M=U.cache,K=U.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var Y=M.flush(),q={frag:W,part:_,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(q),K&&D.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),me=Object(b.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);me<0&&(a.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,E=o.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,o,E=this.hls,y=this.levels,m=this.media,k=this.trackId,I=E.config;if(!y||!y[k])return;if(!m&&(this.startFragRequested||!I.startFragPrefetch))return;var U=y[k],W=U.details;if(!W||W.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(W)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(_===null)return;var M=_.len,K=this.getMaxBufferLength(),Y=this.audioSwitch;if(M>=K&&!Y)return;if(!Y&&this._streamEnded(_,W)){E.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var q=W.fragments,oe=q[0].start,be=_.end;if(Y){var me=this.getLoadPosition();be=me,W.PTSKnown&&me<oe&&((_.end>oe||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=oe+.05))}var he=this.getNextFragment(be,W);if(!he){this.bufferFlushed=!0;return}((d=he.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,W):this.loadFragment(he,W,be)},f.getMaxBufferLength=function(){var d=D.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},f.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,o){var E=o.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(y){return new P.Level(y)})},f.onAudioTrackSwitching=function(d,o){var E=!!o.url;this.trackId=o.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(v):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(d,o){this.mainDetails=o.details},f.onAudioTrackLoaded=function(d,o){var E,y=this.levels,m=o.details,k=o.id;if(!y){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var I=y[k],U=0;if(m.live||(E=I.details)!==null&&E!==void 0&&E.live){var W=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!W)return;!I.details&&m.hasProgramDateTime&&W.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(m,W),U=m.fragments[0].start):U=this.alignPlaylists(m,I.details)}I.details=m,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(I.details,U),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=F.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var o,E=d.frag,y=d.part,m=d.payload,k=this.config,I=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var W=U[I];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 M=k.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new R.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[E.cc],q=(o=E.initSegment)===null||o===void 0?void 0:o.data;if(Y!==void 0){var oe=!1,be=y?y.index:-1,me=be!==-1,he=new w.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,m.byteLength,be,me);K.push(m,q,M,"",E,y,_.totalduration,oe,he,Y)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+I);var fe=this.waitingData=this.waitingData||{frag:E,part:y,cache:new p.default,complete:!1},ue=fe.cache;ue.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,o){var E=o.tracks.audio;E&&(this.mediaBuffer=E.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},f.onFragBuffered=function(d,o){var E=o.frag,y=o.part;if(E.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(y?" p: "+y.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,y)},f.onError=function(d,o){switch(o.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.AUDIO,o);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=o.fatal?F.State.ERROR:F.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var E=!0,y=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);y&&y.len>.5&&(E=!this.reduceMaxBufferLength(y.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,o){var E=o.type;E===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var o,E="audio",y=this.hls,m=d.remuxResult,k=d.chunkMeta,I=this.getCurrentContext(k);if(!I){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var U=I.frag,W=I.part,_=m.audio,M=m.text,K=m.id3,Y=m.initSegment;if(this.fragContextChanged(U))return;if(this.state=F.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,U,k),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:E,tracks:Y.tracks})),_){var q=_.startPTS,oe=_.endPTS,be=_.startDTS,me=_.endDTS;W&&(W.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:oe,startDTS:be,endDTS:me}),U.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,q,oe,be,me),this.bufferFragmentData(_,U,W,k)}if(K!=null&&(o=K.samples)!==null&&o!==void 0&&o.length){var he=s({frag:U,id:E},K);y.trigger(O.Events.FRAG_PARSING_METADATA,he)}if(M){var fe=s({frag:U,id:E},M);y.trigger(O.Events.FRAG_PARSING_USERDATA,fe)}},f._bufferInitSegment=function(d,o,E){if(this.state!==F.State.PARSING)return;d.video&&delete d.video;var y=d.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,d);var m=y.initSegment;if(m!=null&&m.byteLength){var k={type:"audio",frag:o,part:null,chunkMeta:E,parent:o.type,data:m};this.hls.trigger(O.Events.BUFFER_APPENDING,k)}this.tick()},f.loadFragment=function(d,o,E){var y=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||y===N.FragmentState.NOT_LOADED||y===N.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(z.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,d,o,E)))},f.completeAudioSwitch=function(){var d=this.hls,o=this.media,E=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:E})},T}(F.default);H.default=g},"./src/controller/audio-track-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(R,w){for(var b=0;b<w.length;b++){var x=w[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(R,x.key,x)}}function P(R,w,b){return w&&N(R.prototype,w),b&&N(R,b),R}function C(R,w){R.prototype=Object.create(w.prototype),R.prototype.constructor=R,c(R,w)}function c(R,w){return c=Object.setPrototypeOf||function(x,l){return x.__proto__=l,x},c(R,w)}var p=function(R){C(w,R);function w(x){var l;return l=R.call(this,x,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var b=w.prototype;return b.registerListeners=function(){var l=this.hls;l.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(z.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(z.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(l,a){this.tracks=a.audioTracks||[]},b.onAudioTrackLoaded=function(l,a){var s=a.id,u=a.details,A=this.tracksInGroup[s];if(!A){this.warn("Invalid audio track id "+s);return}var v=A.details;A.details=a.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,v))},b.onLevelLoading=function(l,a){this.switchLevel(a.level)},b.onLevelSwitching=function(l,a){this.switchLevel(a.level)},b.switchLevel=function(l){var a=this.hls.levels[l];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(v){return!s||v.groupId===s});this.selectDefaultTrack&&!u.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var A={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},b.onError=function(l,a){if(R.prototype.onError.call(this,l,a),a.fatal||!a.context)return;a.context.type===B.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},b.setAudioTrack=function(l){var a=this.tracksInGroup;if(l<0||l>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+l);var u=a[l],A=u.id,v=u.groupId,g=v===void 0?"":v,D=u.name,T=u.type,f=u.url;if(this.trackId=l,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:g,name:D,type:T,url:f}),u.details&&!u.details.live)return;var h=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(h)},b.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(l){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var u=a[s];if((!this.selectDefaultTrack||u.default)&&(!l||l===u.name))return u.id}return-1},b.loadPlaylist=function(l){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,u=a.groupId,A=a.url;if(l)try{A=l.addDirectives(A)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:A,id:s,groupId:u,deliveryDirectives:l||null})}},P(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),w}(O.default);H.default=p},"./src/controller/base-playlist-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return P});var z=L("./src/polyfills/number.ts"),F=L("./src/types/level.ts"),O=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),P=function(){function C(p,R){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,R+":"),this.warn=B.logger.warn.bind(B.logger,R+":"),this.hls=p}var c=C.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(R,w){w.fatal&&w.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(R,w){var b=w==null?void 0:w.renditionReports;if(b)for(var x=0;x<b.length;x++){var l=b[x],a=""+l.URI;if(a===R.substr(-a.length)){var s=parseInt(l["LAST-MSN"]),u=parseInt(l["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var A=Math.min(w.age-w.partTarget,w.targetduration);u!==void 0&&A>w.partTarget&&(u+=1)}if(Object(z.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(z.isFiniteNumber)(u)?u:void 0,F.HlsSkip.No)}}},c.loadPlaylist=function(R){},c.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},c.playlistLoaded=function(R,w,b){var x=this,l=w.details,a=w.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||b!=null&&b.live){if(l.reloaded(b),b&&this.log("live playlist "+R+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),b&&l.fragments.length>0&&Object(O.mergeDetails)(b,l),!this.canLoad||!l.live)return;var u,A=void 0,v=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var g=this.hls.config.lowLatencyMode,D=l.lastPartSn,T=l.endSN,f=l.lastPartIndex,h=f!==-1,d=D===T,o=g?0:f;h?(A=d?T+1:D,v=d?o:f+1):A=T+1;var E=l.age,y=E+l.ageHeader,m=Math.min(y-l.partTarget,l.targetduration*1.5);if(m>0){if(b&&m>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+m+" with playlist age: "+l.age),m=0;else{var k=Math.floor(m/l.targetduration);if(A+=k,v!==void 0){var I=Math.round(m%l.targetduration/l.partTarget);v+=I}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+m+" skip sn "+k+" to part "+v)}l.tuneInGoal=m}if(u=this.getDeliveryDirectives(l,w.deliveryDirectives,A,v),g||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(l,w.deliveryDirectives,A,v);var U=Object(O.computeReloadInterval)(l,a);A!==void 0&&l.canBlockReload&&(U-=l.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(u)},U)}else this.clearTimer()},c.getDeliveryDirectives=function(R,w,b,x){var l=Object(F.getSkipValue)(R,b);return w!=null&&w.skip&&R.deltaUpdateFailed&&(b=w.msn,x=w.part,l=F.HlsSkip.No),new F.HlsUrlParameters(b,x,l)},c.retryLoadingOrFail=function(R){var w=this,b=this.hls.config,x=this.retryCount<b.levelLoadingMaxRetry;if(x){var l;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(l=R.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return x},C}()},"./src/controller/base-stream-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"State",function(){return T}),L.d(H,"default",function(){return f});var z=L("./src/polyfills/number.ts"),F=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts"),P=L("./src/events.ts"),C=L("./src/errors.ts"),c=L("./src/types/transmuxer.ts"),p=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),b=L("./src/controller/level-helper.ts"),x=L("./src/loader/fragment-loader.ts"),l=L("./src/crypt/decrypter.ts"),a=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function u(h,d){for(var o=0;o<d.length;o++){var E=d[o];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(h,E.key,E)}}function A(h,d,o){return d&&u(h.prototype,d),o&&u(h,o),h}function v(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function g(h,d){h.prototype=Object.create(d.prototype),h.prototype.constructor=h,D(h,d)}function D(h,d){return D=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},D(h,d)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(h){g(d,h);function d(E,y,m){var k;return k=h.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=T.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=m,k.log=N.logger.log.bind(N.logger,m+":"),k.warn=N.logger.warn.bind(N.logger,m+":"),k.hls=E,k.fragmentLoader=new x.default(E.config),k.fragmentTracker=y,k.config=E.config,k.decrypter=new l.default(E,E.config),E.on(P.Events.KEY_LOADED,k.onKeyLoaded,v(k)),k}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(y){},o.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(y,m){var k=this.fragCurrent,I=this.fragmentTracker;if(!m.live&&k&&k.sn===m.endSN&&!y.nextStart){var U=I.getState(k);return U===O.FragmentState.PARTIAL||U===O.FragmentState.OK}return!1},o.onMediaAttached=function(y,m){var k=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(I.startPosition)},o.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var y=this.config,m=this.fragCurrent,k=this.media,I=this.mediaBuffer,U=this.state,W=k?k.currentTime:0,_=B.BufferHelper.bufferInfo(I||k,W,y.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+U),U===T.ENDED)this.resetLoadingState();else if(m&&!_.len){var M=y.maxFragLookUpTolerance,K=m.start-M,Y=m.start+m.duration+M,q=W>Y;(W<K||q)&&(q&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=W),!this.loadedmetadata&&!_.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(y,m){if(this.state!==T.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var k=this.levels[m.frag.level].details;k&&this.loadFragment(m.frag,k,m.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(P.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,h.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(y,m){this.log("Loading key for "+y.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=T.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(P.Events.KEY_LOADING,{frag:y})},o.loadFragment=function(y,m,k){this._loadFragForPlayback(y,m,k)},o._loadFragForPlayback=function(y,m,k){var I=this,U=function(_){if(I.fragContextChanged(y)){I.warn("Fragment "+y.sn+(_.part?" p: "+_.part.index:"")+" of level "+y.level+" was dropped during download."),I.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,I._handleFragmentLoadProgress(_)};this._doFragLoad(y,m,k,U).then(function(W){if(!W)return;I.fragLoadError=0;var _=I.state;if(I.fragContextChanged(y)){(_===T.FRAG_LOADING||_===T.BACKTRACKING||!I.fragCurrent&&_===T.PARSING)&&(I.fragmentTracker.removeFragment(y),I.state=T.IDLE);return}if("payload"in W&&(I.log("Loaded fragment "+y.sn+" of level "+y.level),I.hls.trigger(P.Events.FRAG_LOADED,W),I.state===T.BACKTRACKING)){I.fragmentTracker.backtrack(y,W),I.resetFragmentLoading(y);return}I._handleFragmentLoadComplete(W)}).catch(function(W){I.warn(W),I.resetFragmentLoading(y)})},o.flushMainBuffer=function(y,m,k){if(k===void 0&&(k=null),!(y-m))return;var I={startOffset:y,endOffset:m,type:k};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,I)},o._loadInitSegment=function(y){var m=this;this._doFragLoad(y).then(function(k){if(!k||m.fragContextChanged(y)||!m.levels)throw new Error("init load aborted");return k}).then(function(k){var I=m.hls,U=k.payload,W=y.decryptdata;if(U&&U.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var _=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(U),W.key.buffer,W.iv.buffer).then(function(M){var K=self.performance.now();return I.trigger(P.Events.FRAG_DECRYPTED,{frag:y,payload:M,stats:{tstart:_,tdecrypt:K}}),k.payload=M,k})}return k}).then(function(k){var I=m.fragCurrent,U=m.hls,W=m.levels;if(!W)throw new Error("init load aborted, missing levels");var _=W[y.level].details;console.assert(_,"Level details are defined when init segment is loaded");var M=y.stats;m.state=T.IDLE,m.fragLoadError=0,y.data=new Uint8Array(k.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),k.frag===I&&U.trigger(P.Events.FRAG_BUFFERED,{stats:M,frag:I,part:null,id:y.type}),m.tick()}).catch(function(k){m.warn(k),m.resetFragmentLoading(y)})},o.fragContextChanged=function(y){var m=this.fragCurrent;return!y||!m||y.level!==m.level||y.sn!==m.sn||y.urlId!==m.urlId},o.fragBufferedComplete=function(y,m){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(B.BufferHelper.getBuffered(k))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(y){var m=this.transmuxer;if(!m)return;var k=y.frag,I=y.part,U=y.partsLoaded,W=!U||U.length===0||U.some(function(M){return!M}),_=new c.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,I?I.index:-1,!W);m.flush(_)},o._handleFragmentLoadProgress=function(y){},o._doFragLoad=function(y,m,k,I){var U=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(y.start,k||0),this.config.lowLatencyMode&&m){var W=m.partList;if(W&&I){k>y.end&&m.fragmentHint&&(y=m.fragmentHint);var _=this.getNextPart(W,y,k);if(_>-1){var M=W[_];return this.log("Loading part sn: "+y.sn+" p: "+M.index+" cc: "+y.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+_+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:y,part:W[_],targetBufferTime:k}),this.doFragPartsLoad(y,W,_,I).catch(function(K){return U.handleFragLoadError(K)})}else if(!y.url||this.loadedEndOfParts(W,k))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(k.toFixed(3))),Object(z.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:y,targetBufferTime:k}),this.fragmentLoader.load(y,I).catch(function(K){return U.handleFragLoadError(K)})},o.doFragPartsLoad=function(y,m,k,I){var U=this;return new Promise(function(W,_){var M=[],K=function Y(q){var oe=m[q];U.fragmentLoader.loadPart(y,oe,I).then(function(be){M[oe.index]=be;var me=be.part;U.hls.trigger(P.Events.FRAG_LOADED,be);var he=m[q+1];if(he&&he.fragment===y)Y(q+1);else return W({frag:y,part:me,partsLoaded:M})}).catch(_)};K(k)})},o.handleFragLoadError=function(y){var m=y.data;return m&&m.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(P.Events.ERROR,m),null},o._handleTransmuxerFlush=function(y){var m=this.getCurrentContext(y);if(!m||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var k=m.frag,I=m.part,U=m.level,W=self.performance.now();k.stats.parsing.end=W,I&&(I.stats.parsing.end=W),this.updateLevelTiming(k,I,U,y.partial)},o.getCurrentContext=function(y){var m=this.levels,k=y.level,I=y.sn,U=y.part;if(!m||!m[k])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+k+". The current chunk will not be buffered."),null;var W=m[k],_=U>-1?Object(b.getPartWith)(W,I,U):null,M=_?_.fragment:Object(b.getFragmentWithSN)(W,I,this.fragCurrent);return M?{frag:M,part:_,level:W}:null},o.bufferFragmentData=function(y,m,k,I){if(!y||this.state!==T.PARSING)return;var U=y.data1,W=y.data2,_=U;if(U&&W&&(_=Object(p.appendUint8Array)(U,W)),!_||!_.length)return;var M={type:y.type,frag:m,part:k,chunkMeta:I,parent:m.type,data:_};this.hls.trigger(P.Events.BUFFER_APPENDING,M),y.dropped&&y.independent&&!k&&this.flushBufferGap(m)},o.flushBufferGap=function(y){var m=this.media;if(!m)return;if(!B.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,y.start);return}var k=m.currentTime,I=B.BufferHelper.bufferInfo(m,k,0),U=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),_=Math.max(Math.min(y.start-W,I.end-W),k+W);y.start-_>W&&this.flushMainBuffer(_,y.start)},o.getFwdBufferInfo=function(y,m){var k=this.config,I=this.getLoadPosition();if(!Object(z.isFiniteNumber)(I))return null;var U=B.BufferHelper.bufferInfo(y,I,k.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(I,m);if(W&&U.nextStart<W.end)return B.BufferHelper.bufferInfo(y,I,Math.max(U.nextStart,k.maxBufferHole))}return U},o.getMaxBufferLength=function(y){var m=this.config,k;return y?k=Math.max(8*m.maxBufferSize/y,m.maxBufferLength):k=m.maxBufferLength,Math.min(k,m.maxMaxBufferLength)},o.reduceMaxBufferLength=function(y){var m=this.config,k=y||m.maxBufferLength;return m.maxMaxBufferLength>=k?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(y,m){var k,I,U=m.fragments,W=U.length;if(!W)return null;var _=this.config,M=U[0].start,K;if(m.live){var Y=_.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(m,U),this.startPosition=K?this.hls.liveSyncPosition||K.start:y)}else y<=M&&(K=U[0]);if(!K){var q=_.lowLatencyMode?m.partEnd:m.fragmentEnd;K=this.getFragmentAtPosition(y,q,m)}return(k=K)!==null&&k!==void 0&&k.initSegment&&!((I=K)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},o.getNextPart=function(y,m,k){for(var I=-1,U=!1,W=!0,_=0,M=y.length;_<M;_++){var K=y[_];if(W=W&&!K.independent,I>-1&&k<K.start)break;var Y=K.loaded;!Y&&(U||K.independent||W)&&K.fragment===m&&(I=_),U=Y}return I},o.loadedEndOfParts=function(y,m){var k=y[y.length-1];return k&&m>k.start&&k.loaded},o.getInitialLiveFragment=function(y,m){var k=this.fragPrevious,I=null;if(k){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),I=Object(w.findFragmentByPDT)(m,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var U=k.sn+1;if(U>=y.startSN&&U<=y.endSN){var W=m[U-y.startSN];k.cc===W.cc&&(I=W,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(w.findFragWithCC)(m,k.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var _=this.hls.liveSyncPosition;_!==null&&(I=this.getFragmentAtPosition(_,this.bitrateTest?y.fragmentEnd:y.edge,y))}return I},o.getFragmentAtPosition=function(y,m,k){var I=this.config,U=this.fragPrevious,W=k.fragments,_=k.endSN,M=k.fragmentHint,K=I.maxFragLookUpTolerance,Y=!!(I.lowLatencyMode&&k.partList&&M);Y&&M&&!this.bitrateTest&&(W=W.concat(M),_=M.sn);var q;if(y<m){var oe=y>m-K?0:K;q=Object(w.findFragmentByPTS)(U,W,y,oe)}else q=W[W.length-1];if(q){var be=q.sn-k.startSN,me=U&&q.level===U.level,he=W[be+1],fe=this.fragmentTracker.getState(q);if(fe===O.FragmentState.BACKTRACKED){q=null;for(var ue=be;W[ue]&&this.fragmentTracker.getState(W[ue])===O.FragmentState.BACKTRACKED;)U?q=W[ue--]:q=W[--ue];q||(q=he)}else U&&q.sn===U.sn&&!Y&&(me&&(q.sn<_&&this.fragmentTracker.getState(he)!==O.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+he.sn),q=he):q=null))}return q},o.synchronizeToLiveEdge=function(y){var m=this.config,k=this.media;if(!k)return;var I=this.hls.liveSyncPosition,U=k.currentTime,W=y.fragments[0].start,_=y.edge,M=U>=W-m.maxFragLookUpTolerance&&U<=_;if(I!==null&&k.duration>I&&(U<I||!M)){var K=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*y.targetduration;(!M&&k.readyState<4||U<_-K)&&(this.loadedmetadata||(this.nextLoadPosition=I),k.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+_+", reset currentTime to : "+I.toFixed(3)),k.currentTime=I))}},o.alignPlaylists=function(y,m){var k=this.levels,I=this.levelLastLoaded,U=this.fragPrevious,W=I!==null?k[I]:null,_=y.fragments.length;if(!_)return this.warn("No fragments in live playlist"),0;var M=y.fragments[0].start,K=!m,Y=y.alignedSliding&&Object(z.isFiniteNumber)(M);if(K||!Y&&!M){Object(R.alignStream)(U,W,y);var q=y.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+y.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+_),q}return M},o.waitForCdnTuneIn=function(y){var m=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*m)},o.setStartPosition=function(y,m){var k=this.startPosition;if(k<m&&(k=-1),k===-1||this.lastCurrentTime===-1){var I=y.startTimeOffset;Object(z.isFiniteNumber)(I)?(k=m+I,I<0&&(k+=y.totalduration),k=Math.min(Math.max(m,k),m+y.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+k),this.startPosition=k):y.live?k=this.hls.liveSyncPosition||m:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},o.getLoadPosition=function(){var y=this.media,m=0;return this.loadedmetadata&&y?m=y.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},o.handleFragLoadAborted=function(y,m){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(m?" part"+m.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},o.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(y,m){if(m.fatal)return;var k=m.frag;if(!k||k.type!==y)return;var I=this.fragCurrent;console.assert(I&&k.sn===I.sn&&k.level===I.level&&k.urlId===I.urlId,"Frag load error must match current frag to retry");var U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+y+" "+k.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(y===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(N.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(y,m,k){if(!y)return;var I=B.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(m,I,k),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[y].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(y,m,k,I){var U=this,W=k.details;console.assert(!!W,"level.details must be defined");var _=Object.keys(y.elementaryStreams).reduce(function(M,K){var Y=y.elementaryStreams[K];if(Y){var q=Y.endPTS-Y.startPTS;if(q<=0)return U.warn("Could not parse fragment "+y.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),M||!1;var oe=I?0:Object(b.updateFragPTSDTS)(W,y,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return U.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:W,level:k,drift:oe,type:K,frag:y,start:Y.startPTS,end:Y.endPTS}),!0}return M},!1);_?(this.state=T.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:y,part:m})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(d,[{key:"state",get:function(){return this._state},set:function(y){var m=this._state;m!==y&&(this._state=y,this.log(m+"->"+y))}}]),d}(F.default)},"./src/controller/buffer-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return w});var z=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),N=L("./src/utils/buffer-helper.ts"),P=L("./src/utils/mediasource-helper.ts"),C=L("./src/loader/fragment.ts"),c=L("./src/controller/buffer-operation-queue.ts"),p=Object(P.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function b(l){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,u=a.media,A=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:u})),A&&A.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var x=b.prototype;return x.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},x.destroy=function(){this.unregisterListeners(),this.details=null},x.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.BUFFER_RESET,this.onBufferReset,this),a.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(F.Events.BUFFER_EOS,this.onBufferEos,this),a.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(F.Events.FRAG_PARSED,this.onFragParsed,this),a.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.BUFFER_RESET,this.onBufferReset,this),a.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(F.Events.BUFFER_EOS,this.onBufferEos,this),a.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(F.Events.FRAG_PARSED,this.onFragParsed,this),a.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(a,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(a,s){var u=this.media=s.media;if(u&&p){var A=this.mediaSource=new p;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(A),this._objectUrl=u.src}},x.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(A){O.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(u&&self.URL.revokeObjectURL(u),a.src===u?(a.removeAttribute("src"),a.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(F.Events.MEDIA_DETACHED,void 0)},x.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var u=a.sourceBuffer[s];try{u&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(u),a.sourceBuffer[s]=void 0)}catch(A){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",A)}}),this._initSourceBuffer()},x.onBufferCodecs=function(a,s){var u=this,A=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(v){if(A){var g=u.tracks[v];if(g&&typeof g.buffer.changeType=="function"){var D=s[v],T=D.codec,f=D.levelCodec,h=D.container,d=(g.levelCodec||g.codec).replace(R,"$1"),o=(f||T).replace(R,"$1");if(d!==o){var E=h+";codecs="+(f||T);u.appendChangeType(v,E)}}}else u.pendingTracks[v]=s[v]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},x.appendChangeType=function(a,s){var u=this,A=this.operationQueue,v={execute:function(){var D=u.sourceBuffer[a];D&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),D.changeType(s)),A.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};A.append(v,a)},x.onBufferAppending=function(a,s){var u=this,A=this.hls,v=this.operationQueue,g=this.tracks,D=s.data,T=s.type,f=s.frag,h=s.part,d=s.chunkMeta,o=d.buffering[T],E=self.performance.now();o.start=E;var y=f.stats.buffering,m=h?h.stats.buffering:null;y.start===0&&(y.start=E),m&&m.start===0&&(m.start=E);var k=g.audio,I=T==="audio"&&d.id===1&&(k==null?void 0:k.container)==="audio/mpeg",U={execute:function(){if(o.executeStart=self.performance.now(),I){var _=u.sourceBuffer[T];if(_){var M=f.start-_.timestampOffset;Math.abs(M)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+M+") sn: "+f.sn+")"),_.timestampOffset=f.start)}}u.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var _=self.performance.now();o.executeEnd=o.end=_,y.first===0&&(y.first=_),m&&m.first===0&&(m.first=_);var M=u.sourceBuffer,K={};for(var Y in M)K[Y]=N.BufferHelper.getBuffered(M[Y]);u.appendError=0,u.hls.trigger(F.Events.BUFFER_APPENDED,{type:T,frag:f,part:h,chunkMeta:d,parent:f.type,timeRanges:K})},onError:function(_){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",_);var M={type:B.ErrorTypes.MEDIA_ERROR,parent:f.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,M.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>A.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),A.trigger(F.Events.ERROR,M)}};v.append(U,T)},x.onBufferFlushing=function(a,s){var u=this,A=this.operationQueue,v=function(D){return{execute:u.removeExecutor.bind(u,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(F.Events.BUFFER_FLUSHED,{type:D})},onError:function(f){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",f)}}};s.type?A.append(v(s.type),s.type):this.getSourceBufferTypes().forEach(function(g){A.append(v(g),g)})},x.onFragParsed=function(a,s){var u=this,A=s.frag,v=s.part,g=[],D=v?v.elementaryStreams:A.elementaryStreams;D[C.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(D[C.ElementaryStreamTypes.AUDIO]&&g.push("audio"),D[C.ElementaryStreamTypes.VIDEO]&&g.push("video"));var T=function(){var h=self.performance.now();A.stats.buffering.end=h,v&&(v.stats.buffering.end=h);var d=v?v.stats:A.stats;u.hls.trigger(F.Events.FRAG_BUFFERED,{frag:A,part:v,stats:d,id:A.type})};g.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(T,g)},x.onFragChanged=function(a,s){this.flushBackBuffer()},x.onBufferEos=function(a,s){var u=this,A=this.getSourceBufferTypes().reduce(function(v,g){var D=u.sourceBuffer[g];return(!s.type||s.type===g)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),v&&!!(!D||D.ended)},!0);A&&this.blockBuffers(function(){var v=u.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},x.onLevelUpdated=function(a,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},x.flushBackBuffer=function(){var a=this.hls,s=this.details,u=this.media,A=this.sourceBuffer;if(!u||s===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var g=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(g)||g<0)return;var D=u.currentTime,T=s.levelTargetDuration,f=Math.max(g,T),h=Math.floor(D/T)*T-f;v.forEach(function(d){var o=A[d];if(o){var E=N.BufferHelper.getBuffered(o);E.length>0&&h>E.start(0)&&(a.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),s.live&&a.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),a.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:d}))}})},x.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,u=this.media,A=this.mediaSource,v=a.fragments[0].start+a.totalduration,g=u.duration,D=Object(z.isFiniteNumber)(A.duration)?A.duration:0;a.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(a)):(v>D&&v>g||!Object(z.isFiniteNumber)(g))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),A.duration=v)},x.updateSeekableRange=function(a){var s=this.mediaSource,u=a.fragments,A=u.length;if(A&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var v=Math.max(0,u[0].start),g=Math.max(v,v+a.totalduration);s.setLiveSeekableRange(v,g)}},x.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,A=Object.keys(u).length;if(A&&!a||A===2){this.createSourceBuffers(u),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(F.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}v.forEach(function(g){s.executeNext(g)})}},x.createSourceBuffers=function(a){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var v in a)if(!s[v]){var g=a[v];if(!g)throw Error("source buffer exists for track "+v+", however track does not");var D=g.levelCodec||g.codec,T=g.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var f=s[v]=u.addSourceBuffer(T),h=v;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[v]={buffer:f,codec:D,container:g.container,levelCodec:g.levelCodec,id:g.id},A++}catch(d){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:T})}}A&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},x._onSBUpdateStart=function(a){var s=this.operationQueue,u=s.current(a);u.onStart()},x._onSBUpdateEnd=function(a){var s=this.operationQueue,u=s.current(a);u.onComplete(),s.shiftAndExecuteNext(a)},x._onSBUpdateError=function(a,s){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(s)},x.removeExecutor=function(a,s,u){var A=this.media,v=this.mediaSource,g=this.operationQueue,D=this.sourceBuffer,T=D[a];if(!A||!v||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(a);return}var f=Object(z.isFiniteNumber)(A.duration)?A.duration:Infinity,h=Object(z.isFiniteNumber)(v.duration)?v.duration:Infinity,d=Math.max(0,s),o=Math.min(u,f,h);o>d?(O.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(d,o)):g.shiftAndExecuteNext(a)},x.appendExecutor=function(a,s){var u=this.operationQueue,A=this.sourceBuffer,v=A[s];if(!v){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}v.ended=!1,console.assert(!v.updating,s+" sourceBuffer must not be updating"),v.appendBuffer(a)},x.blockBuffers=function(a,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var A=this.operationQueue,v=s.map(function(g){return A.appendBlocker(g)});Promise.all(v).then(function(){a(),s.forEach(function(g){var D=u.sourceBuffer[g];(!D||!D.updating)&&A.shiftAndExecuteNext(g)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(a,s,u){var A=this.sourceBuffer[a];if(!A)return;var v=u.bind(this,a);this.listeners[a].push({event:s,listener:v}),A.addEventListener(s,v)},x.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(u){s.removeEventListener(u.event,u.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return F});var z=L("./src/utils/logger.ts"),F=function(){function O(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var B=O.prototype;return B.append=function(P,C){var c=this.queues[C];c.push(P),c.length===1&&this.buffers[C]&&this.executeNext(C)},B.insertAbort=function(P,C){var c=this.queues[C];c.unshift(P),this.executeNext(C)},B.appendBlocker=function(P){var C,c=new Promise(function(R){C=R}),p={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,P),c},B.executeNext=function(P){var C=this.buffers,c=this.queues,p=C[P],R=c[P];if(R.length){var w=R[0];try{w.execute()}catch(b){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(b),(!p||!p.updating)&&(R.shift(),this.executeNext(P))}}},B.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},B.current=function(P){return this.queues[P][0]},O}()},"./src/controller/cap-level-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts");function F(N,P){for(var C=0;C<P.length;C++){var c=P[C];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(N,c.key,c)}}function O(N,P,C){return P&&F(N.prototype,P),C&&F(N,C),N}var B=function(){function N(C){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=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=N.prototype;return P.setStreamController=function(c){this.streamController=c},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var c=this.hls;c.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var c=this.hls;c.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(c,p){N.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},P.onMediaAttaching=function(c,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},P.onManifestParsed=function(c,p){var R=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,R.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onBufferCodecs=function(c,p){var R=this.hls;R.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(c.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},P.getMaxLevel=function(c){var p=this,R=this.hls.levels;if(!R.length)return-1;var w=R.filter(function(b,x){return N.isLevelAllowed(x,p.restrictedLevels)&&x<=c});return this.clientRect=null,N.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var c=this.media,p={width:0,height:0};if(c){var R=c.getBoundingClientRect();p.width=R.width,p.height=R.height,!p.width&&!p.height&&(p.width=R.right-R.left||c.width||0,p.height=R.bottom-R.top||c.height||0)}return this.clientRect=p,p},N.isLevelAllowed=function(c,p){return p===void 0&&(p=[]),p.indexOf(c)===-1},N.getMaxLevelByMediaSize=function(c,p,R){if(!c||!c.length)return-1;for(var w=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},b=c.length-1,x=0;x<c.length;x+=1){var l=c[x];if((l.width>=p||l.height>=R)&&w(l,c[x+1])){b=x;break}}return b},O(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(p){}return c}}]),N}();H.default=B},"./src/controller/cmcd-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return w});var z=L("./src/events.ts"),F=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function N(b,x){for(var l=0;l<x.length;l++){var a=x[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(b,a.key,a)}}function P(b,x,l){return x&&N(b.prototype,x),l&&N(b,l),b}function C(b,x){var l=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(l)return(l=l.call(b)).next.bind(l);if(Array.isArray(b)||(l=c(b))||x&&b&&typeof b.length=="number"){l&&(b=l);var a=0;return function(){return a>=b.length?{done:!0}:{done:!1,value:b[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(b,x){if(!b)return;if(typeof b=="string")return p(b,x);var l=Object.prototype.toString.call(b).slice(8,-1);if(l==="Object"&&b.constructor&&(l=b.constructor.name),l==="Map"||l==="Set")return Array.from(b);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return p(b,x)}function p(b,x){(x==null||x>b.length)&&(x=b.length);for(var l=0,a=new Array(x);l<x;l++)a[l]=b[l];return a}function R(){return R=Object.assign||function(b){for(var x=1;x<arguments.length;x++){var l=arguments[x];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(b[a]=l[a])}return b},R.apply(this,arguments)}var w=function(){function b(l){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(A){try{a.apply(A,{ot:F.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(v){B.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(A){try{var v=A.frag,g=a.hls.levels[v.level],D=a.getObjectType(v),T={d:v.duration*1e3,ot:D};(D===F.CMCDObjectType.VIDEO||D===F.CMCDObjectType.AUDIO||D==F.CMCDObjectType.MUXED)&&(T.br=g.bitrate/1e3,T.tb=a.getTopBandwidth(D),T.bl=a.getBufferLength(D)),a.apply(A,T)}catch(f){B.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=l;var s=this.config=l.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||b.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var x=b.prototype;return x.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},x.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},x.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},x.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},x.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},x.onBufferCreated=function(a,s){var u,A;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(A=s.tracks.video)===null||A===void 0?void 0:A.buffer},x.createData=function(){var a;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},x.apply=function(a,s){s===void 0&&(s={}),R(s,this.createData());var u=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var A=b.toHeaders(s);if(!Object.keys(A).length)return;a.headers||(a.headers={}),R(a.headers,A)}else{var v=b.toQuery(s);if(!v)return;a.url=b.appendQueryToUri(a.url,v)}},x.getObjectType=function(a){var s=a.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},x.getTopBandwidth=function(a){for(var s=0,u=a===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=C(u),v;!(v=A()).done;){var g=v.value;g.bitrate>s&&(s=g.bitrate)}return s>0?s:NaN},x.getBufferLength=function(a){var s=this.hls.media,u=a===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var A=O.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return A.len*1e3},x.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,u=a||this.config.loader;return function(){function A(g){this.loader=void 0,this.loader=new u(g)}var v=A.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(D,T,f){s(D),this.loader.load(D,T,f)},P(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},x.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,u=a||this.config.loader;return function(){function A(g){this.loader=void 0,this.loader=new u(g)}var v=A.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(D,T,f){s(D),this.loader.load(D,T,f)},P(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},b.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(a){for(var s=[],u=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},A=function(I){return Math.round(I)},v=function(I){return A(I/100)*100},g=function(I){return encodeURIComponent(I)},D={br:A,d:A,bl:v,dl:v,mtp:v,nor:g,rtp:v,tb:A},T=Object.keys(a||{}).sort(),f=C(T),h;!(h=f()).done;){var d=h.value,o=a[d];if(!u(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var E=D[d];E&&(o=E(o));var y=typeof o,m=void 0;d==="ot"||d==="sf"||d==="st"?m=d+"="+o:y==="boolean"?m=d:y==="number"?m=d+"="+o:m=d+"="+JSON.stringify(o),s.push(m)}return s.join(",")},b.toHeaders=function(a){for(var s=Object.keys(a),u={},A=["Object","Request","Session","Status"],v=[{},{},{},{}],g={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,T=s;D<T.length;D++){var f=T[D],h=g[f]!=null?g[f]:1;v[h][f]=a[f]}for(var d=0;d<v.length;d++){var o=b.serialize(v[d]);o&&(u["CMCD-"+A[d]]=o)}return u},b.toQuery=function(a){return"CMCD="+encodeURIComponent(b.serialize(a))},b.appendQueryToUri=function(a,s){if(!s)return a;var u=a.includes("?")?"&":"?";return""+a+u+s},b}()},"./src/controller/eme-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function N(w,b){for(var x=0;x<b.length;x++){var l=b[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function P(w,b,x){return b&&N(w.prototype,b),x&&N(w,x),w}var C=3,c=function(b,x,l){var a={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),x.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[a]},p=function(b,x,l,a){switch(b){case B.KeySystems.WIDEVINE:return c(x,l,a);default:throw new Error("Unknown key-system: "+b)}},R=function(){function w(x){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=x,this._config=x.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 b=w.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(l){switch(l){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},b._attemptKeySystemAccess=function(l,a,s){var u=this,A=p(l,a,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(l,A);this.mediaKeysPromise=v.then(function(g){return u._onMediaKeySystemAccessObtained(l,g)}),v.catch(function(g){O.logger.error('Failed to obtain key-system "'+l+'" access:',g)})},b._onMediaKeySystemAccessObtained=function(l,a){var s=this;O.logger.log('Access for key-system "'+l+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:l};this._mediaKeysList.push(u);var A=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(v){return u.mediaKeys=v,O.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),v});return A.catch(function(v){O.logger.error("Failed to create media-keys:",v)}),A},b._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),l._onNewMediaKeySession(a.mediaKeysSession))})},b._onNewMediaKeySession=function(l){var a=this;O.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){a._onKeySessionMessage(l,s.message)},!1)},b._onKeySessionMessage=function(l,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},b.onMediaEncrypted=function(l){var a=this;if(O.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(A){if(!a._media)return;a._attemptSetMediaKeys(A),a._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},b._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(l,a){var s=this,u=this._mediaKeysList[0];if(!u){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var A=u.mediaKeysSession;if(!A){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+l+'" init data type'),u.mediaKeysSessionInitialized=!0,A.generateRequest(l,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(v){O.logger.error("Error generating key-session request:",v),s.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(l,a,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,l,a,s);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,u,l),A=void 0}catch(v){O.logger.error(v)}try{u.readyState||u.open("POST",l,!0),A&&A.call(this.hls,u,l)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return u},b._onLicenseRequestReadyStageChange=function(l,a,s,u){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var A=l.response,v=this._licenseResponseCallback;if(v)try{A=v.call(this.hls,l,a)}catch(D){O.logger.error(D)}u(A)}else{if(O.logger.error("License Request XHR failed ("+a+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=C-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(s,u)}break}},b._generateLicenseRequestChallenge=function(l,a){switch(l.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},b._requestLicense=function(l,a){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),A=this._createLicenseXhr(u,l,a);O.logger.log("Sending license request to URL: "+u);var v=this._generateLicenseRequestChallenge(s,l);A.send(v)}catch(g){O.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(l,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var l=this._media,a=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(l,a){if(!this._emeEnabled)return;var s=a.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),u=a.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,u)},P(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();H.default=R},"./src/controller/fps-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts"),F=L("./src/utils/logger.ts"),O=function(){function B(P){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=P,this.registerListeners()}var N=B.prototype;return N.setStreamController=function(C){this.streamController=C},N.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(C,c){var p=this.hls.config;if(p.capLevelOnFPSDrop){var R=c.media instanceof self.HTMLVideoElement?c.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(C,c,p){var R=performance.now();if(c){if(this.lastTime){var w=R-this.lastTime,b=p-this.lastDroppedFrames,x=c-this.lastDecodedFrames,l=1e3*b/w,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:b,currentDecoded:x,totalDroppedFrames:p}),l>0&&b>a.config.fpsDroppedMonitoringThreshold*x){var s=a.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=p,this.lastDecodedFrames=c}},N.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var c=C.getVideoPlaybackQuality();this.checkFPS(C,c.totalVideoFrames,c.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},B}();H.default=O},"./src/controller/fragment-finders.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"findFragmentByPDT",function(){return O}),L.d(H,"findFragmentByPTS",function(){return B}),L.d(H,"fragmentWithinToleranceTest",function(){return N}),L.d(H,"pdtWithinToleranceTest",function(){return P}),L.d(H,"findFragWithCC",function(){return C});var z=L("./src/polyfills/number.ts"),F=L("./src/utils/binary-search.ts");function O(c,p,R){if(p===null||!Array.isArray(c)||!c.length||!Object(z.isFiniteNumber)(p))return null;var w=c[0].programDateTime;if(p<(w||0))return null;var b=c[c.length-1].endProgramDateTime;if(p>=(b||0))return null;R=R||0;for(var x=0;x<c.length;++x){var l=c[x];if(P(p,R,l))return l}return null}function B(c,p,R,w){R===void 0&&(R=0),w===void 0&&(w=0);var b=null;if(c?b=p[c.sn-p[0].sn+1]||null:R===0&&p[0].start===0&&(b=p[0]),b&&N(R,w,b)===0)return b;var x=F.default.search(p,N.bind(null,R,w));return x||b}function N(c,p,R){c===void 0&&(c=0),p===void 0&&(p=0);var w=Math.min(p,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-w<=c?1:R.start-w>c&&R.start?-1:0}function P(c,p,R){var w=Math.min(p,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,b=R.endProgramDateTime||0;return b-w>c}function C(c,p){return F.default.search(c,function(R){return R.cc<p?1:R.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"FragmentState",function(){return O}),L.d(H,"FragmentTracker",function(){return B});var z=L("./src/events.ts"),F=L("./src/types/loader.ts"),O;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(O||(O={}));var B=function(){function C(p){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=p,this._registerListeners()}var c=C.prototype;return c._registerListeners=function(){var R=this.hls;R.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var R=this.hls;R.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(R,w){if(w===F.PlaylistLevelType.MAIN){var b=this.activeFragment,x=this.activeParts;if(!b)return null;if(x)for(var l=x.length;l--;){var a=x[l],s=a?a.end:b.appendedPTS;if(a.start<=R&&s!==void 0&&R<=s)return l>9&&(this.activeParts=x.slice(l-9)),a}else if(b.start<=R&&b.appendedPTS!==void 0&&R<=b.appendedPTS)return b}return this.getBufferedFrag(R,w)},c.getBufferedFrag=function(R,w){for(var b=this.fragments,x=Object.keys(b),l=x.length;l--;){var a=b[x[l]];if((a==null?void 0:a.body.type)===w&&a.buffered){var s=a.body;if(s.start<=R&&R<=s.end)return s}}return null},c.detectEvictedFragments=function(R,w,b){var x=this;Object.keys(this.fragments).forEach(function(l){var a=x.fragments[l];if(!a)return;if(!a.buffered){a.body.type===b&&x.removeFragment(a.body);return}var s=a.range[R];if(!s)return;s.time.some(function(u){var A=!x.isTimeBuffered(u.startPTS,u.endPTS,w);return A&&x.removeFragment(a.body),A})})},c.detectPartialFragments=function(R){var w=this,b=this.timeRanges,x=R.frag,l=R.part;if(!b||x.sn==="initSegment")return;var a=P(x),s=this.fragments[a];if(!s)return;Object.keys(b).forEach(function(u){var A=x.elementaryStreams[u];if(!A)return;var v=b[u],g=l!==null||A.partial===!0;s.range[u]=w.getBufferedTimes(x,l,g,v)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},c.fragBuffered=function(R){var w=P(R),b=this.fragments[w];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},c.getBufferedTimes=function(R,w,b,x){for(var l={time:[],partial:b},a=w?w.start:R.start,s=w?w.end:R.end,u=R.minEndPTS||s,A=R.maxStartPTS||a,v=0;v<x.length;v++){var g=x.start(v)-this.bufferPadding,D=x.end(v)+this.bufferPadding;if(A>=g&&u<=D){l.time.push({startPTS:Math.max(a,x.start(v)),endPTS:Math.min(s,x.end(v))});break}else if(a<D&&s>g)l.partial=!0,l.time.push({startPTS:Math.max(a,x.start(v)),endPTS:Math.min(s,x.end(v))});else if(s<=g)break}return l},c.getPartialFragment=function(R){var w=null,b,x,l,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(A){var v=u[A];if(!v)return;N(v)&&(x=v.body.start-s,l=v.body.end+s,R>=x&&R<=l&&(b=Math.min(R-x,l-R),a<=b&&(w=v.body,a=b)))}),w},c.getState=function(R){var w=P(R),b=this.fragments[w];return b?b.buffered?N(b)?O.PARTIAL:O.OK:b.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},c.backtrack=function(R,w){var b=P(R),x=this.fragments[b];if(!x||x.backtrack)return null;var l=x.backtrack=w||x.loaded;return x.loaded=null,l},c.getBacktrackData=function(R){var w=P(R),b=this.fragments[w];if(b){var x,l=b.backtrack;if(l!=null&&(x=l.payload)!==null&&x!==void 0&&x.byteLength)return l;this.removeFragment(R)}return null},c.isTimeBuffered=function(R,w,b){for(var x,l,a=0;a<b.length;a++){if(x=b.start(a)-this.bufferPadding,l=b.end(a)+this.bufferPadding,R>=x&&w<=l)return!0;if(w<=x)return!1}return!1},c.onFragLoaded=function(R,w){var b=w.frag,x=w.part;if(b.sn==="initSegment"||b.bitrateTest||x)return;var l=P(b);this.fragments[l]={body:b,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(R,w){var b=this,x=w.frag,l=w.part,a=w.timeRanges;if(x.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=x,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(u){var A=a[u];if(b.detectEvictedFragments(u,A),!l)for(var v=0;v<A.length;v++)x.appendedPTS=Math.max(A.end(v),x.appendedPTS||0)})},c.onFragBuffered=function(R,w){this.detectPartialFragments(w)},c.hasFragment=function(R){var w=P(R);return!!this.fragments[w]},c.removeFragmentsInRange=function(R,w,b){var x=this;Object.keys(this.fragments).forEach(function(l){var a=x.fragments[l];if(!a)return;if(a.buffered){var s=a.body;s.type===b&&s.start<w&&s.end>R&&x.removeFragment(s)}})},c.removeFragment=function(R){var w=P(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[w]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function N(C){var c,p;return C.buffered&&(((c=C.range.video)===null||c===void 0?void 0:c.partial)||((p=C.range.audio)===null||p===void 0?void 0:p.partial))}function P(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"STALL_MINIMUM_DURATION_MS",function(){return N}),L.d(H,"MAX_START_GAP_JUMP",function(){return P}),L.d(H,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),L.d(H,"SKIP_BUFFER_RANGE_START",function(){return c}),L.d(H,"default",function(){return p});var z=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),O=L("./src/events.ts"),B=L("./src/utils/logger.ts"),N=250,P=2,C=.1,c=.05,p=function(){function R(b,x,l,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=x,this.fragmentTracker=l,this.hls=a}var w=R.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(x){var l=this.config,a=this.media,s=this.stalled,u=a.currentTime,A=a.seeking,v=this.seeking&&!A,g=!this.seeking&&A;if(this.seeking=A,u!==x){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||v)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var T=z.BufferHelper.bufferInfo(a,u,0),f=T.len>0,h=T.nextStart||0;if(!f&&!h)return;if(A){var d=T.len>P,o=!h||h-u>P&&!this.fragmentTracker.getPartialFragment(u);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,y=Math.max(h,T.start||0)-u,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=m==null||((E=m.details)===null||E===void 0)?void 0:E.live,I=k?m.details.targetduration*2:P;if(y>0&&y<=I){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(s===null){this.stalled=U;return}var W=U-s;!A&&W>=N&&this._reportStall(T.len);var _=z.BufferHelper.bufferInfo(a,u,l.maxBufferHole);this._tryFixBufferStall(_,W)},w._tryFixBufferStall=function(x,l){var a=this.config,s=this.fragmentTracker,u=this.media,A=u.currentTime,v=s.getPartialFragment(A);if(v){var g=this._trySkipBufferHole(v);if(g)return}x.len>a.maxBufferHole&&l>a.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(x){var l=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+x+")"),l.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},w._trySkipBufferHole=function(x){for(var l=this.config,a=this.hls,s=this.media,u=s.currentTime,A=0,v=z.BufferHelper.getBuffered(s),g=0;g<v.length;g++){var D=v.start(g);if(u+l.maxBufferHole>=A&&u<D){var T=Math.max(D+c,s.currentTime+C);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+T),this.moved=!0,this.stalled=null,s.currentTime=T,x&&a.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+T,frag:x}),T}A=v.end(g)}return 0},w._tryNudgeBuffer=function(){var x=this.config,l=this.hls,a=this.media,s=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<x.nudgeMaxRetry){var A=s+u*x.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+A),a.currentTime=A,l.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+x.nudgeMaxRetry+" nudges"),l.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts"),F=L("./src/utils/texttrack-utils.ts"),O=L("./src/demux/id3.ts"),B=.25,N=function(){function P(c){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=c,this._registerListeners()}var C=P.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var p=this.hls;p.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var p=this.hls;p.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(p,R){this.media=R.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(p){if(!this.media)return;for(var R=0;R<p.length;R++){var w=p[R];if(w.kind==="metadata"&&w.label==="id3")return Object(F.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(p,R){if(!this.media)return;var w=R.frag,b=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var x=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<b.length;l++){var a=O.getID3Frames(b[l].data);if(a){var s=b[l].pts,u=l<b.length-1?b[l+1].pts:w.end,A=u-s;A<=0&&(u=s+B);for(var v=0;v<a.length;v++){var g=a[v];if(!O.isTimeStampFrame(g)){var D=new x(s,u,"");D.value=g,this.id3Track.addCue(D)}}}}},C.onBufferFlushing=function(p,R){var w=R.startOffset,b=R.endOffset,x=R.type;if(!x||x==="audio"){var l=this.id3Track;l&&Object(F.removeCuesInRange)(l,w,b)}},P}();H.default=N},"./src/controller/latency-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return P});var z=L("./src/errors.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts");function B(C,c){for(var p=0;p<c.length;p++){var R=c[p];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(C,R.key,R)}}function N(C,c,p){return c&&B(C.prototype,c),p&&B(C,p),C}var P=function(){function C(p){var R=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 R.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var c=C.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},c.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},c.onMediaAttached=function(R,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},c.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},c.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},c.onLevelUpdated=function(R,w){var b=w.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},c.onError=function(R,w){if(w.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},c.timeupdate=function(){var R=this.media,w=this.levelDetails;if(!R||!w)return;this.currentTime=R.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var x=this.config,l=x.lowLatencyMode,a=x.maxLiveSyncPlaybackRate;if(!l||a===1)return;var s=this.targetLatency;if(s===null)return;var u=b-s,A=Math.min(this.maxLatency,s+w.targetduration),v=u<A;if(w.live&&v&&u>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;R.playbackRate=Math.min(g,Math.max(1,D))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},c.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},c.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},N(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,w=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:w?R.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var w=R.holdBack,b=R.partHoldBack,x=R.targetduration,l=this.config,a=l.liveSyncDuration,s=l.liveSyncDurationCount,u=l.lowLatencyMode,A=this.hls.userConfig,v=u&&b||w;(A.liveSyncDuration||A.liveSyncDurationCount||v===0)&&(v=a!==void 0?a:s*x);var g=x,D=1;return v+Math.min(this.stallCount*D,g)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),w=this.targetLatency,b=this.levelDetails;if(R===null||w===null||b===null)return null;var x=b.edge,l=R-w-this.edgeStalled,a=x-b.totalduration,s=x-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(a,l),s)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var w=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-w,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,w=this.levelDetails;if(!R||!w)return 0;var b=R.buffered.length;return b?R.buffered.end(b-1):w.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return l});var z=L("./src/types/level.ts"),F=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),N=L("./src/controller/level-helper.ts"),P=L("./src/controller/base-playlist-controller.ts"),C=L("./src/types/loader.ts");function c(){return c=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var A in u)Object.prototype.hasOwnProperty.call(u,A)&&(a[A]=u[A])}return a},c.apply(this,arguments)}function p(a,s){for(var u=0;u<s.length;u++){var A=s[u];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function R(a,s,u){return s&&p(a.prototype,s),u&&p(a,u),a}function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,b(a,s)}function b(a,s){return b=Object.setPrototypeOf||function(A,v){return A.__proto__=v,A},b(a,s)}var x=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(a){w(s,a);function s(A){var v;return v=a.call(this,A,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var u=s.prototype;return u._registerListeners=function(){var v=this.hls;v.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(F.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var v=this.hls;v.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(F.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},u.startLoad=function(){var v=this._levels;v.forEach(function(g){g.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(v,g){var D=[],T=[],f=[],h,d={},o,E=!1,y=!1,m=!1;if(g.levels.forEach(function(W){var _=W.attrs;E=E||!!(W.width&&W.height),y=y||!!W.videoCodec,m=m||!!W.audioCodec,x&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var M=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;o=d[M],o?o.url.push(W.url):(o=new z.Level(W),d[M]=o,D.push(o)),_&&(_.AUDIO&&Object(N.addGroupId)(o,"audio",_.AUDIO),_.SUBTITLES&&Object(N.addGroupId)(o,"text",_.SUBTITLES))}),(E||y)&&m&&(D=D.filter(function(W){var _=W.videoCodec,M=W.width,K=W.height;return!!_||!!(M&&K)})),D=D.filter(function(W){var _=W.audioCodec,M=W.videoCodec;return(!_||Object(B.isCodecSupportedInMp4)(_,"audio"))&&(!M||Object(B.isCodecSupportedInMp4)(M,"video"))}),g.audioTracks&&(T=g.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(T)),g.subtitles&&(f=g.subtitles,Object(N.assignTrackIdsByGroup)(f)),D.length>0){h=D[0].bitrate,D.sort(function(W,_){return W.bitrate-_.bitrate}),this._levels=D;for(var k=0;k<D.length;k++)if(D[k].bitrate===h){this._firstLevel=k,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+h);break}var I=m&&!y,U={levels:D,audioTracks:T,subtitleTracks:f,firstLevel:this._firstLevel,stats:g.stats,audio:m,video:y,altAudio:!I&&T.some(function(W){return!!W.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,U),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(v,g){if(a.prototype.onError.call(this,v,g),g.fatal)return;var D=g.context,T=this._levels[this.currentLevelIndex];if(D&&(D.type===C.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&D.groupId===T.audioGroupIds[T.urlId]||D.type===C.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&D.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,d;switch(g.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var o=this._levels[g.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=g.frag.level)):d=g.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(h=!1),d=D.level),f=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:d=g.level,f=!0;break}d!==void 0&&this.recoverLevel(g,d,f,h)},u.recoverLevel=function(v,g,D,T){var f=v.details,h=this._levels[g];if(h.loadError++,D){var d=this.retryLoadingOrFail(v);if(d)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=h.url.length;if(o>1&&h.loadError<o)v.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var E=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(f+": switch to "+E),v.levelRetry=!0,this.hls.nextAutoLevel=E)}}},u.redundantFailover=function(v){var g=this._levels[v],D=g.url.length;if(D>1){var T=(g.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(f){f.urlId=T}),this.level=v}},u.onFragLoaded=function(v,g){var D=g.frag;if(D!==void 0&&D.type===C.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},u.onLevelLoaded=function(v,g){var D,T=g.level,f=g.details,h=this._levels[T];if(!h){var d;this.warn("Invalid level index "+T),(d=g.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(T,g,h.details)):(D=g.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(v,g){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,f=this.hls.audioTracks[g.id].groupId,h=0;h<D.audioGroupIds.length;h++)if(D.audioGroupIds[h]===f){T=h;break}T!==D.urlId&&(D.urlId=T,this.startLoad())}},u.loadPlaylist=function(v){var g=this.currentLevelIndex,D=this._levels[g];if(this.canLoad&&D&&D.url.length>0){var T=D.urlId,f=D.url[T];if(v)try{f=v.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+g+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+T+" "+f),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:f,level:g,id:T,deliveryDirectives:v||null})}},u.removeLevel=function(v,g){var D=function(h,d){return d!==g},T=this._levels.filter(function(f,h){return h!==v?!0:f.url.length>1&&g!==void 0?(f.url=f.url.filter(D),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(D)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(D)),f.urlId=0,!0):!1}).map(function(f,h){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=h}),f});this._levels=T,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:T})},R(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var g,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===v&&(g=D[v])!==null&&g!==void 0&&g.details)return;if(v<0||v>=D.length){var T=v<0;if(this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:T,reason:"invalid level idx"}),T)return;v=Math.min(v,D.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=D[f],d=D[v];this.log("switching to level "+v+" from "+f),this.currentLevelIndex=v;var o=c({},d,{level:v,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,o);var E=d.details;if(!E||E.live){var y=this.switchParams(d.uri,h==null?void 0:h.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"addGroupId",function(){return O}),L.d(H,"assignTrackIdsByGroup",function(){return B}),L.d(H,"updatePTS",function(){return N}),L.d(H,"updateFragPTSDTS",function(){return C}),L.d(H,"mergeDetails",function(){return c}),L.d(H,"mapPartIntersection",function(){return p}),L.d(H,"mapFragmentIntersection",function(){return R}),L.d(H,"adjustSliding",function(){return w}),L.d(H,"addSliding",function(){return b}),L.d(H,"computeReloadInterval",function(){return x}),L.d(H,"getFragmentWithSN",function(){return l}),L.d(H,"getPartWith",function(){return a});var z=L("./src/polyfills/number.ts"),F=L("./src/utils/logger.ts");function O(s,u,A){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(A);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(A);break}}function B(s){var u={};s.forEach(function(A){var v=A.groupId||"";A.id=u[v]=u[v]||0,u[v]++})}function N(s,u,A){var v=s[u],g=s[A];P(v,g)}function P(s,u){var A=u.startPTS;if(Object(z.isFiniteNumber)(A)){var v=0,g;u.sn>s.sn?(v=A-s.start,g=s):(v=s.start-A,g=u),g.duration!==v&&(g.duration=v)}else if(u.sn>s.sn){var D=s.cc===u.cc;D&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function C(s,u,A,v,g,D){var T=v-A;T<=0&&(F.logger.warn("Fragment should have a positive duration",u),v=A+u.duration,D=g+u.duration);var f=A,h=v,d=u.startPTS,o=u.endPTS;if(Object(z.isFiniteNumber)(d)){var E=Math.abs(d-A);Object(z.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(E,u.deltaPTS):u.deltaPTS=E,f=Math.max(A,d),A=Math.min(A,d),g=Math.min(g,u.startDTS),h=Math.min(v,o),v=Math.max(v,o),D=Math.max(D,u.endDTS)}u.duration=v-A;var y=A-u.start;u.appendedPTS=v,u.start=u.startPTS=A,u.maxStartPTS=f,u.startDTS=g,u.endPTS=v,u.minEndPTS=h,u.endDTS=D;var m=u.sn;if(!s||m<s.startSN||m>s.endSN)return 0;var k,I=m-s.startSN,U=s.fragments;for(U[I]=u,k=I;k>0;k--)P(U[k],U[k-1]);for(k=I;k<U.length-1;k++)P(U[k],U[k+1]);return s.fragmentHint&&P(U[U.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,y}function c(s,u){for(var A=null,v=s.fragments,g=v.length-1;g>=0;g--){var D=v[g].initSegment;if(D){A=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var T=0,f;if(R(s,u,function(k,I){k.relurl&&(T=k.cc-I.cc),Object(z.isFiniteNumber)(k.startPTS)&&Object(z.isFiniteNumber)(k.endPTS)&&(I.start=I.startPTS=k.startPTS,I.startDTS=k.startDTS,I.appendedPTS=k.appendedPTS,I.maxStartPTS=k.maxStartPTS,I.endPTS=k.endPTS,I.endDTS=k.endDTS,I.minEndPTS=k.minEndPTS,I.duration=k.endPTS-k.startPTS,I.duration&&(f=I),u.PTSKnown=u.alignedSliding=!0),I.elementaryStreams=k.elementaryStreams,I.loader=k.loader,I.stats=k.stats,I.urlId=k.urlId,k.initSegment&&(I.initSegment=k.initSegment,A=k.initSegment)}),A){var h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;h.forEach(function(k){var I;(!k.initSegment||k.initSegment.relurl===((I=A)===null||I===void 0?void 0:I.relurl))&&(k.initSegment=A)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(k){return!k}),u.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var o=u.fragments;if(T){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<o.length;E++)o[E].cc+=T}u.skippedSegments&&(u.startCC=u.fragments[0].cc),p(s.partList,u.partList,function(k,I){I.elementaryStreams=k.elementaryStreams,I.stats=k.stats}),f?C(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):w(s,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var y=u.advancedDateTime;if(u.advanced&&y){var m=u.edge;u.driftStart||(u.driftStartTime=y,u.driftStart=m),u.driftEndTime=y,u.driftEnd=m}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function p(s,u,A){if(s&&u)for(var v=0,g=0,D=s.length;g<=D;g++){var T=s[g],f=u[g+v];T&&f&&T.index===f.index&&T.fragment.sn===f.fragment.sn?A(T,f):v--}}function R(s,u,A){for(var v=u.skippedSegments,g=Math.max(s.startSN,u.startSN)-u.startSN,D=(s.fragmentHint?1:0)+(v?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,T=u.startSN-s.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=g;d<=D;d++){var o=h[T+d],E=f[d];v&&!E&&d<v&&(E=u.fragments[d]=o),o&&E&&A(o,E)}}function w(s,u){var A=u.startSN+u.skippedSegments-s.startSN,v=s.fragments;if(A<0||A>=v.length)return;b(u,v[A].start)}function b(s,u){if(u){for(var A=s.fragments,v=s.skippedSegments;v<A.length;v++)A[v].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function x(s,u){var A=1e3*s.levelTargetDuration,v=A/2,g=s.age,D=g>0&&g<A*3,T=u.loading.end-u.loading.start,f,h=s.availabilityDelay;if(s.updated===!1)if(D){var d=333*s.misses;f=Math.max(Math.min(v,T*2),d),s.availabilityDelay=(s.availabilityDelay||0)+f}else f=v;else D?(h=Math.min(h||A/2,g),s.availabilityDelay=h,f=h+A-g):f=A-T;return Math.round(f)}function l(s,u,A){if(!s||!s.details)return null;var v=s.details,g=v.fragments[u-v.startSN];return g||(g=v.fragmentHint,g&&g.sn===u?g:u<v.startSN&&A&&A.sn===u?A:null)}function a(s,u,A){if(!s||!s.details)return null;var v=s.details.partList;if(v)for(var g=v.length;g--;){var D=v[g];if(D.index===A&&D.fragment.sn===u)return D}return null}},"./src/controller/stream-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return v});var z=L("./src/polyfills/number.ts"),F=L("./src/controller/base-stream-controller.ts"),O=L("./src/is-supported.ts"),B=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),P=L("./src/controller/fragment-tracker.ts"),C=L("./src/types/loader.ts"),c=L("./src/loader/fragment.ts"),p=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),b=L("./src/errors.ts"),x=L("./src/utils/logger.ts");function l(g,D){for(var T=0;T<D.length;T++){var f=D[T];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function a(g,D,T){return D&&l(g.prototype,D),T&&l(g,T),g}function s(g,D){g.prototype=Object.create(D.prototype),g.prototype.constructor=g,u(g,D)}function u(g,D){return u=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},u(g,D)}var A=100,v=function(g){s(D,g);function D(f,h){var d;return d=g.call(this,f,h,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var T=D.prototype;return T._registerListeners=function(){var h=this.hls;h.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(B.Events.ERROR,this.onError,this),h.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(B.Events.ERROR,this.onError,this),h.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(h){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=o.startLevel;E===-1&&(o.config.testBandwidth?(E=0,this.bitrateTest=!0):E=o.nextAutoLevel),this.level=o.nextLoadLevel=E,this.loadedmetadata=!1}d>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),h=d),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var h,d=this.levels,o=this.level,E=d==null||((h=d[o])===null||h===void 0)?void 0:h.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var y,m=self.performance.now(),k=this.retryDate;(!k||m>=k||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var h,d,o=this.hls,E=this.levelLastLoaded,y=this.levels,m=this.media,k=o.config,I=o.nextLoadLevel;if(E===null||!m&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[I])return;var U=y[I];this.level=o.nextLoadLevel=I;var W=U.details;if(!W||this.state===F.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==I){this.state=F.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,C.PlaylistLevelType.MAIN);if(_===null)return;var M=_.len,K=this.getMaxBufferLength(U.maxBitrate);if(M>=K)return;if(this._streamEnded(_,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=F.State.ENDED;return}var q=_.end,oe=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var be=oe.sn-W.startSN;be>1&&(oe=W.fragments[be-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===P.FragmentState.OK&&this.nextLoadPosition>q){var me=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,me,C.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((h=oe.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((d=oe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(oe,W):this.loadFragment(oe,W,q)},T.loadFragment=function(h,d,o){var E,y=this.fragmentTracker.getState(h);if(this.fragCurrent=h,y===P.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(h);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else y=P.FragmentState.NOT_LOADED}y===P.FragmentState.NOT_LOADED||y===P.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,g.prototype.loadFragment.call(this,h,d,o)):y===P.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(h){var d=this.fragmentTracker.getAppendedFrag(h,C.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},T.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,C.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var h=this.levels,d=this.media;if(d!=null&&d.readyState){var o,E=this.getAppendedFrag(d.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!d.paused&&h){var y=this.hls.nextLoadLevel,m=h[y],k=this.fragLastKbps;k&&this.fragCurrent?o=this.fragCurrent.duration*m.maxBitrate/(1e3*k)+1:o=0}else o=0;var I=this.getBufferedFrag(d.currentTime+o);if(I){var U=this.followingBufferedFrag(I);if(U){this.abortCurrentFrag();var W=U.maxStartPTS?U.maxStartPTS:U.start,_=U.duration,M=Math.max(I.end,W+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(h,d){g.prototype.flushMainBuffer.call(this,h,d,this.altAudio?"video":null)},T.onMediaAttached=function(h,d){g.prototype.onMediaAttached.call(this,h,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),g.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var h=this.media,d=h?h.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(h,d){var o=!1,E=!1,y;d.levels.forEach(function(m){y=m.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(o=!0),y.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=o&&E&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},T.onLevelLoading=function(h,d){var o=this.levels;if(!o||this.state!==F.State.IDLE)return;var E=o[d.level];(!E.details||E.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(E.details))&&(this.state=F.State.WAITING_LEVEL)},T.onLevelLoaded=function(h,d){var o,E=this.levels,y=d.level,m=d.details,k=m.totalduration;if(!E){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+k);var I=this.fragCurrent;I&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==d.level&&I.loader&&(this.state=F.State.IDLE,I.loader.abort()));var U=E[y],W=0;if(m.live||(o=U.details)!==null&&o!==void 0&&o.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;W=this.alignPlaylists(m,U.details)}if(U.details=m,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:m,level:y}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=F.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,W),this.tick()},T._handleFragmentLoadProgress=function(h){var d,o=h.frag,E=h.part,y=h.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var k=m[o.level],I=k.details;if(!I){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var U=k.videoCodec,W=I.PTSKnown||!I.live,_=(d=o.initSegment)===null||d===void 0?void 0:d.data,M=this._getAudioCodec(k),K=this.transmuxer=this.transmuxer||new p.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=E?E.index:-1,q=Y!==-1,oe=new R.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,y.byteLength,Y,q),be=this.initPTS[o.cc];K.push(y,_,M,U,o,E,I.totalduration,W,oe,be)},T.onAudioTrackSwitching=function(h,d){var o=this.altAudio,E=!!d.url,y=d.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;o&&k.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(h,d){var o=d.id,E=!!this.hls.audioTracks[o].url;if(E){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=E,this.tick()},T.onBufferCreated=function(h,d){var o=d.tracks,E,y,m=!1;for(var k in o){var I=o[k];if(I.id==="main"){if(y=k,E=I,k==="video"){var U=o[k];U&&(this.videoBuffer=U.buffer)}}else m=!0}m&&E?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(h,d){var o=d.frag,E=d.part;if(o&&o.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(E?" p: "+E.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var y=E?E.stats:o.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,E)},T.onError=function(h,d){switch(d.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,d);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=F.State.ERROR):!d.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var o=!0,E=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);E&&E.len>.5&&(o=!this.reduceMaxBufferLength(E.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var h=this.media,d=this.gapController;if(!h||!d||!h.readyState)return;var o=N.BufferHelper.getBuffered(h);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(h,d){var o=d.type;if(o!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(o===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,o,C.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(h,d){this.levels=d.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var h=this.media,d=h.currentTime,o=this.startPosition;if(o>=0&&d<o){if(h.seeking){x.logger.log("could not seek to "+o+", already seeking at "+d);return}var E=N.BufferHelper.getBuffered(h),y=E.length?E.start(0):0,m=y-o;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(x.logger.log("adjusting start position by "+m+" to match buffer start"),o+=m,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),h.currentTime=o}},T._getAudioCodec=function(h){var d=this.config.defaultAudioCodec||h.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},T._loadBitrateTestFrag=function(h){var d=this;this._doFragLoad(h).then(function(o){var E=d.hls;if(!o||E.nextLoadLevel||d.fragContextChanged(h))return;d.fragLoadError=0,d.state=F.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var y=h.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),E.trigger(B.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(h){var d,o="main",E=this.hls,y=h.remuxResult,m=h.chunkMeta,k=this.getCurrentContext(m);if(!k){this.warn("The loading context changed while buffering fragment "+m.sn+" of level "+m.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(m.level);return}var I=k.frag,U=k.part,W=k.level,_=y.video,M=y.text,K=y.id3,Y=y.initSegment,q=this.altAudio?void 0:y.audio;if(this.fragContextChanged(I))return;if(this.state=F.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,I,m),E.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:o,tracks:Y.tracks}));var oe=Y.initPTS,be=Y.timescale;Object(z.isFiniteNumber)(oe)&&(this.initPTS[I.cc]=oe,E.trigger(B.Events.INIT_PTS_FOUND,{frag:I,id:o,initPTS:oe,timescale:be}))}if(_&&y.independent!==!1){if(W.details){var me=_.startPTS,he=_.endPTS,fe=_.startDTS,ue=_.endDTS;if(U)U.elementaryStreams[_.type]={startPTS:me,endPTS:he,startDTS:fe,endDTS:ue};else if(_.firstKeyFrame&&_.independent&&(this.couldBacktrack=!0),_.dropped&&_.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<me){this.backtrack(I);return}I.setElementaryStreamInfo(_.type,I.start,he,I.start,ue,!0)}I.setElementaryStreamInfo(_.type,me,he,fe,ue),this.bufferFragmentData(_,I,U,m)}}else if(y.independent===!1){this.backtrack(I);return}if(q){var pe=q.startPTS,$=q.endPTS,ae=q.startDTS,ee=q.endDTS;U&&(U.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:$,startDTS:ae,endDTS:ee}),I.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,pe,$,ae,ee),this.bufferFragmentData(q,I,U,m)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var Ee={frag:I,id:o,samples:K.samples};E.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(M){var Ce={frag:I,id:o,samples:M.samples};E.trigger(B.Events.FRAG_PARSING_USERDATA,Ce)}},T._bufferInitSegment=function(h,d,o,E){var y=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var m=d.audio,k=d.video,I=d.audiovideo;if(m){var U=h.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),m.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(U="mp4a.40.5")),W.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),h.audioCodec&&h.audioCodec!==U&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+U+'"'),m.levelCodec=U,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(h.audioCodec||"")+"/"+m.codec+"]")}k&&(k.levelCodec=h.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+k.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(_){var M=d[_],K=M.initSegment;K!=null&&K.byteLength&&y.hls.trigger(B.Events.BUFFER_APPENDING,{type:_,data:K,frag:o,part:null,chunkMeta:E,parent:o.type})}),this.tick()},T.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var d=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,d?this.resetFragmentLoading(h):this.state=F.State.BACKTRACKING},T.checkFragmentChanged=function(){var h=this.media,d=null;if(h&&h.readyState>1&&h.seeking===!1){var o=h.currentTime;if(N.BufferHelper.isBuffered(h,o)?d=this.getAppendedFrag(o):N.BufferHelper.isBuffered(h,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var E=this.fragPlaying,y=d.level;(!E||d.sn!==E.sn||E.level!==y||d.urlId!==E.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:d}),(!E||E.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=d)}}},a(D,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"SubtitleStreamController",function(){return s});var z=L("./src/events.ts"),F=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),N=L("./src/utils/discontinuities.ts"),P=L("./src/controller/level-helper.ts"),C=L("./src/controller/fragment-tracker.ts"),c=L("./src/controller/base-stream-controller.ts"),p=L("./src/types/loader.ts"),R=L("./src/types/level.ts");function w(u,A){for(var v=0;v<A.length;v++){var g=A[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}function b(u,A,v){return A&&w(u.prototype,A),v&&w(u,v),u}function x(u,A){u.prototype=Object.create(A.prototype),u.prototype.constructor=u,l(u,A)}function l(u,A){return l=Object.setPrototypeOf||function(g,D){return g.__proto__=D,g},l(u,A)}var a=500,s=function(u){x(A,u);function A(g,D){var T;return T=u.call(this,g,D,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var v=A.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var D=this.hls;D.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(z.Events.ERROR,this.onError,this),D.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var D=this.hls;D.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(z.Events.ERROR,this.onError,this),D.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(a),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(D,T){this.mainDetails=T.details},v.onSubtitleFragProcessed=function(D,T){var f=T.frag,h=T.success;if(this.fragPrevious=f,this.state=c.State.IDLE,!h)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,E=f.start,y=0;y<d.length;y++)if(E>=d[y].start&&E<=d[y].end){o=d[y];break}var m=f.start+f.duration;o?o.end=m:(o={start:E,end:m},d.push(o)),this.fragmentTracker.fragBuffered(f)},v.onBufferFlushing=function(D,T){var f=T.startOffset,h=T.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var E=o[d].details,y=E.targetduration,m=h-y;if(m<=0)return;T.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(k){for(var I=0;I<k.length;){if(k[I].end<=m){k.shift();continue}else if(k[I].start<m)k[I].start=m;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(f,m,p.PlaylistLevelType.SUBTITLE)}},v.onError=function(D,T){var f,h=T.frag;if(!h||h.type!==p.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE},v.onSubtitleTracksUpdated=function(D,T){var f=this,h=T.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(d){return new R.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(D,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(a)},v.onSubtitleTrackLoaded=function(D,T){var f,h=T.details,d=T.id,o=this.currentTrackId,E=this.levels;if(!E.length)return;var y=E[o];if(d>=E.length||d!==o||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=y.details)!==null&&f!==void 0&&f.live){var m=this.mainDetails;if(h.deltaUpdateFailed||!m)return;var k=m.fragments[0];if(!y.details)h.hasProgramDateTime&&m.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(h,m):k&&Object(P.addSliding)(h,k.start);else{var I=this.alignPlaylists(h,y.details);I===0&&k&&Object(P.addSliding)(h,k.start)}}if(y.details=h,this.levelLastLoaded=d,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE){var U=Object(B.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},v._handleFragmentLoadComplete=function(D){var T=D.frag,f=D.payload,h=T.decryptdata,d=this.hls;if(this.fragContextChanged(T))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(E){var y=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:T,payload:E,stats:{tstart:o,tdecrypt:y}})})}},v.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var D,T=this.currentTrackId,f=this.levels;if(!f.length||!f[T]||!f[T].details)return;var h=f[T].details,d=h.targetduration,o=this.config,E=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-d,o.maxBufferHole),m=y.end,k=y.len,I=this.getMaxBufferLength()+d;if(k>I)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var U=h.fragments,W=U.length,_=h.edge,M,K=this.fragPrevious;if(m<_){var Y=o.maxFragLookUpTolerance;K&&h.hasProgramDateTime&&(M=Object(B.findFragmentByPDT)(U,K.endProgramDateTime,Y)),M||(M=Object(B.findFragmentByPTS)(K,U,m,Y),!M&&K&&K.start<U[0].start&&(M=U[0]))}else M=U[W-1];(D=M)!==null&&D!==void 0&&D.encrypted?(F.logger.log("Loading key for "+M.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===C.FragmentState.NOT_LOADED&&this.loadFragment(M,h,m)}},v.loadFragment=function(D,T,f){this.fragCurrent=D,u.prototype.loadFragment.call(this,D,T,f)},b(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(c.default)},"./src/controller/subtitle-track-controller.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/events.ts"),F=L("./src/utils/texttrack-utils.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(w,b){for(var x=0;x<b.length;x++){var l=b[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(w,l.key,l)}}function P(w,b,x){return b&&N(w.prototype,b),x&&N(w,x),w}function C(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,c(w,b)}function c(w,b){return c=Object.setPrototypeOf||function(l,a){return l.__proto__=a,l},c(w,b)}var p=function(w){C(b,w);function b(l){var a;return a=w.call(this,l,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var x=b.prototype;return x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},x.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(z.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(z.Events.ERROR,this.onError,this)},x.onMediaAttached=function(a,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},x.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},x.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=R(this.media.textTracks);a.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},x.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},x.onSubtitleTrackLoaded=function(a,s){var u=s.id,A=s.details,v=this.trackId,g=this.tracksInGroup[v];if(!g){this.warn("Invalid subtitle track id "+u);return}var D=g.details;g.details=s.details,this.log("subtitle track "+u+" loaded ["+A.startSN+"-"+A.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,D))},x.onLevelLoading=function(a,s){this.switchLevel(s.level)},x.onLevelSwitching=function(a,s){this.switchLevel(s.level)},x.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var A=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(T){return!u||T.groupId===u});this.tracksInGroup=v;var g=this.findTrackId(A==null?void 0:A.name)||this.findTrackId();this.groupId=u;var D={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,D),g!==-1&&this.setSubtitleTrack(g,A)}},x.findTrackId=function(a){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var A=s[u];if((!this.selectDefaultTrack||A.default)&&(!a||a===A.name))return A.id}return-1},x.onError=function(a,s){if(w.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},x.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,A=s.groupId,v=s.url;if(a)try{v=a.addDirectives(v)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:v,id:u,groupId:A,deliveryDirectives:a||null})}},x.toggleTrackModes=function(a){var s=this,u=this.media,A=this.subtitleDisplay,v=this.trackId;if(!u)return;var g=R(u.textTracks),D=g.filter(function(h){return h.groupId===s.groupId});if(a===-1)[].slice.call(g).forEach(function(h){h.mode="disabled"});else{var T=D[v];T&&(T.mode="disabled")}var f=D[a];f&&(f.mode=A?"showing":"hidden")},x.setSubtitleTrack=function(a,s){var u,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=A[a])!==null&&u!==void 0&&u.details)||a<-1||a>=A.length)return;this.clearTimer();var v=A[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,v){var g=v.id,D=v.groupId,T=D===void 0?"":D,f=v.name,h=v.type,d=v.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:T,name:f,type:h,url:d});var o=this.switchParams(v.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},x.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=R(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")a=u;else if(s[u].mode==="showing"){a=u;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),b}(O.default);function R(w){for(var b=[],x=0;x<w.length;x++){var l=w[x];l.kind==="subtitles"&&l.label&&b.push(w[x])}return b}H.default=p},"./src/controller/timeline-controller.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"TimelineController",function(){return R});var z=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),N=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),C=L("./src/utils/imsc1-ttml-parser.ts"),c=L("./src/types/loader.ts"),p=L("./src/utils/logger.ts"),R=function(){function l(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new B.default(this,"textTrack1"),A=new B.default(this,"textTrack2"),v=new B.default(this,"textTrack3"),g=new B.default(this,"textTrack4");this.cea608Parser1=new O.default(1,u,A),this.cea608Parser2=new O.default(3,v,g)}s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(F.Events.FRAG_LOADING,this.onFragLoading,this),s.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=l.prototype;return a.destroy=function(){var u=this.hls;u.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(F.Events.FRAG_LOADING,this.onFragLoading,this),u.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,A,v,g,D){for(var T=!1,f=D.length;f--;){var h=D[f],d=b(h[0],h[1],A,v);if(d>=0&&(h[0]=Math.min(h[0],A),h[1]=Math.max(h[1],v),T=!0,d/(v-A)>.5))return}if(T||D.push([A,v]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,A,v,g)}else{var E=this.Cues.newCue(null,A,v,g);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:E,track:u})}},a.onInitPtsFound=function(u,A){var v=this,g=A.frag,D=A.id,T=A.initPTS,f=A.timescale,h=this.unparsedVttFrags;D==="main"&&(this.initPTS[g.cc]=T,this.timescale[g.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(d){v.onFragLoaded(F.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(u){var A=this.media;if(A)for(var v=0;v<A.textTracks.length;v++){var g=A.textTracks[v];if(g[u])return g}return null},a.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},a.createNativeTrack=function(u){if(this.captionsTracks[u])return;var A=this.captionsProperties,v=this.captionsTracks,g=this.media,D=A[u],T=D.label,f=D.languageCode,h=this.getExistingTrack(u);if(h)v[u]=h,Object(P.clearCurrentCues)(v[u]),Object(P.sendAddTrackEvent)(v[u],g);else{var d=this.createTextTrack("captions",T,f);d&&(d[u]=!0,v[u]=d)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var A=this.captionsProperties[u];if(!A)return;var v=A.label,g={_id:u,label:v,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[u]=g,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},a.createTextTrack=function(u,A,v){var g=this.media;return g?g.addTextTrack(u,A,v):void 0},a.onMediaAttaching=function(u,A){this.media=A.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(A){Object(P.clearCurrentCues)(u[A]),delete u[A]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var u=this.media;if(!u)return;var A=u.textTracks;if(A)for(var v=0;v<A.length;v++)Object(P.clearCurrentCues)(A[v])},a.onSubtitleTracksUpdated=function(u,A){var v=this;this.textTracks=[];var g=A.subtitleTracks||[],D=g.some(function(d){return d.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var T=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var E;if(o<f.length){for(var y=null,m=0;m<f.length;m++)if(w(f[m],d)){y=f[m];break}y&&(E=y)}E?Object(P.clearCurrentCues)(E):(E=v.createTextTrack("subtitles",d.name,d.lang),E&&(E.mode="disabled")),E&&(E.groupId=d.groupId,v.textTracks.push(E))})}else if(!T&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},a.onManifestLoaded=function(u,A){var v=this;this.config.enableCEA708Captions&&A.captions&&A.captions.forEach(function(g){var D=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!D)return;var T="textTrack"+D[1],f=v.captionsProperties[T];if(!f)return;f.label=g.name,g.lang&&(f.languageCode=g.lang),f.media=g})},a.onFragLoading=function(u,A){var v=this.cea608Parser1,g=this.cea608Parser2,D=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(v&&g))return;if(A.frag.type===c.PlaylistLevelType.MAIN){var f,h,d=A.frag.sn,o=(f=A==null||((h=A.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;d===D+1||d===D&&o===T+1||(v.reset(),g.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(u,A){var v=A.frag,g=A.payload,D=this.initPTS,T=this.unparsedVttFrags;if(v.type===c.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(z.isFiniteNumber)(D[v.cc])){T.push(A),D.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var f=v.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[v.level],d=this.vttCCs;d[v.cc]||(d[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),h&&h.textCodec===C.IMSC1_CODEC?this._parseIMSC1(v,g):this._parseVTTs(v,g,d)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,A){var v=this,g=this.hls;Object(C.parseIMSC1)(A,this.initPTS[u.cc],this.timescale[u.cc],function(D){v._appendCues(D,u.level),g.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(D){p.logger.log("Failed to parse IMSC1: "+D),g.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:D})})},a._parseVTTs=function(u,A,v){var g=this,D=this.hls;Object(N.parseWebVTT)(A,this.initPTS[u.cc],this.timescale[u.cc],v,u.cc,u.start,function(T){g._appendCues(T,u.level),D.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(T){g._fallbackToIMSC1(u,A),p.logger.log("Failed to parse VTT cue: "+T),D.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:T})})},a._fallbackToIMSC1=function(u,A){var v=this,g=this.tracks[u.level];g.textCodec||Object(C.parseIMSC1)(A,this.initPTS[u.cc],this.timescale[u.cc],function(){g.textCodec=C.IMSC1_CODEC,v._parseIMSC1(u,A)},function(){g.textCodec="wvtt"})},a._appendCues=function(u,A){var v=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[A];if(g.mode==="disabled")return;u.forEach(function(f){return Object(P.addCueToTrack)(g,f)})}else{var D=this.tracks[A],T=D.default?"default":"subtitles"+A;v.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:u,track:T})}},a.onFragDecrypted=function(u,A){var v=A.frag;if(v.type===c.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(F.Events.FRAG_LOADED,A)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,A){var v=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(v&&g))return;for(var D=0;D<A.samples.length;D++){var T=A.samples[D].bytes;if(T){var f=this.extractCea608Data(T);v.addData(A.samples[D].pts,f[0]),g.addData(A.samples[D].pts,f[1])}}},a.onBufferFlushing=function(u,A){var v=A.startOffset,g=A.endOffset,D=A.endOffsetSubtitles,T=A.type,f=this.media;if(!f||f.currentTime<g)return;if(!T||T==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(o){return Object(P.removeCuesInRange)(h[o],v,g)})}if(this.config.renderTextTracksNatively&&(v===0&&D!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(P.removeCuesInRange)(d[o],v,D)})}},a.extractCea608Data=function(u){for(var A=u[0]&31,v=2,g=[[],[]],D=0;D<A;D++){var T=u[v++],f=127&u[v++],h=127&u[v++],d=(4&T)!==0,o=3&T;if(f===0&&h===0)continue;d&&((o===0||o===1)&&(g[o].push(f),g[o].push(h)))}return g},l}();function w(l,a){return l&&l.label===a.name&&!(l.textTrack1||l.textTrack2)}function b(l,a,s,u){return Math.min(a,u)-Math.max(l,s)}function x(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return z});var z=function(){function F(B,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=N}var O=F.prototype;return O.decrypt=function(N,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,N)},F}()},"./src/crypt/aes-decryptor.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"removePadding",function(){return F}),L.d(H,"default",function(){return O});var z=L("./src/utils/typed-array.ts");function F(B){var N=B.byteLength,P=N&&new DataView(B.buffer).getUint8(N-1);return P?Object(z.sliceUint8)(B,0,N-P):B}var O=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=B.prototype;return N.uint8ArrayToUint32Array_=function(C){for(var c=new DataView(C),p=new Uint32Array(4),R=0;R<4;R++)p[R]=c.getUint32(R*4);return p},N.initTable=function(){var C=this.sBox,c=this.invSBox,p=this.subMix,R=p[0],w=p[1],b=p[2],x=p[3],l=this.invSubMix,a=l[0],s=l[1],u=l[2],A=l[3],v=new Uint32Array(256),g=0,D=0,T=0;for(T=0;T<256;T++)T<128?v[T]=T<<1:v[T]=T<<1^283;for(T=0;T<256;T++){var f=D^D<<1^D<<2^D<<3^D<<4;f=f>>>8^f&255^99,C[g]=f,c[f]=g;var h=v[g],d=v[h],o=v[d],E=v[f]*257^f*16843008;R[g]=E<<24|E>>>8,w[g]=E<<16|E>>>16,b[g]=E<<8|E>>>24,x[g]=E,E=o*16843009^d*65537^h*257^g*16843008,a[f]=E<<24|E>>>8,s[f]=E<<16|E>>>16,u[f]=E<<8|E>>>24,A[f]=E,g?(g=h^v[v[v[o^h]]],D^=v[v[D]]):g=D=1}},N.expandKey=function(C){for(var c=this.uint8ArrayToUint32Array_(C),p=!0,R=0;R<c.length&&p;)p=c[R]===this.key[R],R++;if(p)return;this.key=c;var w=this.keySize=c.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var b=this.ksRows=(w+6+1)*4,x,l,a=this.keySchedule=new Uint32Array(b),s=this.invKeySchedule=new Uint32Array(b),u=this.sBox,A=this.rcon,v=this.invSubMix,g=v[0],D=v[1],T=v[2],f=v[3],h,d;for(x=0;x<b;x++){if(x<w){h=a[x]=c[x];continue}d=h,x%w===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=A[x/w|0]<<24):w>6&&x%w===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),a[x]=h=(a[x-w]^d)>>>0}for(l=0;l<b;l++)x=b-l,l&3?d=a[x]:d=a[x-4],l<4||x<=4?s[l]=d:s[l]=g[u[d>>>24]]^D[u[d>>>16&255]]^T[u[d>>>8&255]]^f[u[d&255]],s[l]=s[l]>>>0},N.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},N.decrypt=function(C,c,p){for(var R=this.keySize+6,w=this.invKeySchedule,b=this.invSBox,x=this.invSubMix,l=x[0],a=x[1],s=x[2],u=x[3],A=this.uint8ArrayToUint32Array_(p),v=A[0],g=A[1],D=A[2],T=A[3],f=new Int32Array(C),h=new Int32Array(f.length),d,o,E,y,m,k,I,U,W,_,M,K,Y,q,oe=this.networkToHostOrderSwap;c<f.length;){for(W=oe(f[c]),_=oe(f[c+1]),M=oe(f[c+2]),K=oe(f[c+3]),m=W^w[0],k=K^w[1],I=M^w[2],U=_^w[3],Y=4,q=1;q<R;q++)d=l[m>>>24]^a[k>>16&255]^s[I>>8&255]^u[U&255]^w[Y],o=l[k>>>24]^a[I>>16&255]^s[U>>8&255]^u[m&255]^w[Y+1],E=l[I>>>24]^a[U>>16&255]^s[m>>8&255]^u[k&255]^w[Y+2],y=l[U>>>24]^a[m>>16&255]^s[k>>8&255]^u[I&255]^w[Y+3],m=d,k=o,I=E,U=y,Y=Y+4;d=b[m>>>24]<<24^b[k>>16&255]<<16^b[I>>8&255]<<8^b[U&255]^w[Y],o=b[k>>>24]<<24^b[I>>16&255]<<16^b[U>>8&255]<<8^b[m&255]^w[Y+1],E=b[I>>>24]<<24^b[U>>16&255]<<16^b[m>>8&255]<<8^b[k&255]^w[Y+2],y=b[U>>>24]<<24^b[m>>16&255]<<16^b[k>>8&255]<<8^b[I&255]^w[Y+3],h[c]=oe(d^v),h[c+1]=oe(y^g),h[c+2]=oe(E^D),h[c+3]=oe(o^T),v=W,g=_,D=M,T=K,c=c+4}return h.buffer},B}()},"./src/crypt/decrypter.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return c});var z=L("./src/crypt/aes-crypto.ts"),F=L("./src/crypt/fast-aes-key.ts"),O=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/typed-array.ts"),C=16,c=function(){function p(w,b,x){var l=x===void 0?{}:x,a=l.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=b,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(A){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=p.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var x=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(x):x},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(b,x,l,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),x,l);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),x,l).then(a)},R.softwareDecrypt=function(b,x,l){var a=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(b=Object(N.appendUint8Array)(u,b),this.remainderData=null);var A=this.getValidChunk(b);if(!A.length)return null;a&&(l=a);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new O.default),v.expandKey(x);var g=s;return this.currentResult=v.decrypt(A.buffer,0,l),this.currentIV=Object(P.sliceUint8)(A,-16).buffer,g||null},R.webCryptoDecrypt=function(b,x,l){var a=this,s=this.subtle;return(this.key!==x||!this.fastAesKey)&&(this.key=x,this.fastAesKey=new F.default(s,x)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var A=new z.default(s,l);return A.decrypt(b.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,b,x,l)})},R.onWebCryptoError=function(b,x,l,a){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(x,l,a)},R.getValidChunk=function(b){var x=b,l=b.length-b.length%C;return l!==b.length&&(x=Object(P.sliceUint8)(b,0,l),this.remainderData=Object(P.sliceUint8)(b,l)),x},R.logOnce=function(b){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return z});var z=function(){function F(B,N){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=N}var O=F.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/demux/base-audio-demuxer.ts"),F=L("./src/demux/adts.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function N(c,p){c.prototype=Object.create(p.prototype),c.prototype.constructor=c,P(c,p)}function P(c,p){return P=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},P(c,p)}var C=function(c){N(p,c);function p(w,b){var x;return x=c.call(this)||this,x.observer=void 0,x.config=void 0,x.observer=w,x.config=b,x}var R=p.prototype;return R.resetInitSegment=function(b,x,l){c.prototype.resetInitSegment.call(this,b,x,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(b){if(!b)return!1;for(var x=B.getID3Data(b,0)||[],l=x.length,a=b.length;l<a;l++)if(F.probe(b,l))return O.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(b,x){return F.canParse(b,x)},R.appendFrame=function(b,x,l){F.initTrackConfig(b,this.observer,x,l,b.manifestCodec);var a=F.appendFrame(b,x,l,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(z.default);C.minProbeByteLength=9,H.default=C},"./src/demux/adts.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"getAudioConfig",function(){return B}),L.d(H,"isHeaderPattern",function(){return N}),L.d(H,"getHeaderLength",function(){return P}),L.d(H,"getFullFrameLength",function(){return C}),L.d(H,"canGetFrameLength",function(){return c}),L.d(H,"isHeader",function(){return p}),L.d(H,"canParse",function(){return R}),L.d(H,"probe",function(){return w}),L.d(H,"initTrackConfig",function(){return b}),L.d(H,"getFrameDuration",function(){return x}),L.d(H,"parseFrameHeader",function(){return l}),L.d(H,"appendFrame",function(){return a});var z=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),O=L("./src/events.ts");function B(s,u,A,v){var g,D,T,f,h=navigator.userAgent.toLowerCase(),d=v,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((u[A+2]&192)>>>6)+1;var E=(u[A+2]&60)>>>2;if(E>o.length-1){s.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return T=(u[A+2]&1)<<2,T|=(u[A+3]&192)>>>6,z.logger.log("manifest codec:"+v+", ADTS type:"+g+", samplingIndex:"+E),/firefox/i.test(h)?E>=6?(g=5,f=new Array(4),D=E-3):(g=2,f=new Array(2),D=E):h.indexOf("android")!==-1?(g=2,f=new Array(2),D=E):(g=5,f=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&E>=6?D=E-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(E>=6&&T===1||/vivaldi/i.test(h))||!v&&T===1)&&(g=2,f=new Array(2)),D=E)),f[0]=g<<3,f[0]|=(E&14)>>1,f[1]|=(E&1)<<7,f[1]|=T<<3,g===5&&(f[1]|=(D&14)>>1,f[2]=(D&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:o[E],channelCount:T,codec:"mp4a.40."+g,manifestCodec:d}}function N(s,u){return s[u]===255&&(s[u+1]&246)===240}function P(s,u){return s[u+1]&1?7:9}function C(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function c(s,u){return u+5<s.length}function p(s,u){return u+1<s.length&&N(s,u)}function R(s,u){return c(s,u)&&N(s,u)&&C(s,u)<=s.length-u}function w(s,u){if(p(s,u)){var A=P(s,u);if(u+A>=s.length)return!1;var v=C(s,u);if(v<=A)return!1;var g=u+v;return g===s.length||p(s,g)}return!1}function b(s,u,A,v,g){if(!s.samplerate){var D=B(u,A,v,g);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function x(s){return 1024*9e4/s}function l(s,u,A,v,g){var D=P(s,u),T=C(s,u);if(T-=D,T>0){var f=A+v*g;return{headerLength:D,frameLength:T,stamp:f}}}function a(s,u,A,v,g){var D=x(s.samplerate),T=l(u,A,v,g,D);if(T){var f=T.frameLength,h=T.headerLength,d=T.stamp,o=h+f,E=Math.max(0,A+o-u.length),y;E?(y=new Uint8Array(o-h),y.set(u.subarray(A+h,u.length),0)):y=u.subarray(A+h,A+o);var m={unit:y,pts:d};return E||s.samples.push(m),{sample:m,length:o,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"initPTSFn",function(){return C});var z=L("./src/polyfills/number.ts"),F=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/typed-array.ts"),P=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=c.prototype;return p.resetInitSegment=function(w,b,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(w,b){return!1},p.appendFrame=function(w,b,x){},p.demux=function(w,b){this.cachedData&&(w=Object(B.appendUint8Array)(this.cachedData,w),this.cachedData=null);var x=F.getID3Data(w,0),l=x?x.length:0,a,s,u=this._audioTrack,A=this._id3Track,v=x?F.getTimeStamp(x):void 0,g=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(v,b)),x&&x.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),s=this.initPTS;l<g;){if(this.canParse(w,l)){var D=this.appendFrame(u,w,l);D?(this.frameIndex++,s=D.sample.pts,l+=D.length,a=l):l=g}else F.canParse(w,l)?(x=F.getID3Data(w,l),A.samples.push({pts:s,dts:s,data:x}),l+=x.length,a=l):l++;if(l===g&&a!==g){var T=Object(N.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:u,avcTrack:Object(O.dummyTrack)(),id3Track:A,textTrack:Object(O.dummyTrack)()}},p.demuxSampleAes=function(w,b,x){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(w){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},p.destroy=function(){},c}(),C=function(p,R){return Object(z.isFiniteNumber)(p)?p*90:R*9e4};H.default=P},"./src/demux/chunk-cache.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return z});var z=function(){function O(){this.chunks=[],this.dataLength=0}var B=O.prototype;return B.push=function(P){this.chunks.push(P),this.dataLength+=P.length},B.flush=function(){var P=this.chunks,C=this.dataLength,c;if(P.length)P.length===1?c=P[0]:c=F(P,C);else return new Uint8Array(0);return this.reset(),c},B.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function F(O,B){for(var N=new Uint8Array(B),P=0,C=0;C<O.length;C++){var c=O[C];N.set(c,P),P+=c.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/utils/logger.ts"),F=function(){function O(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var B=O.prototype;return B.loadWord=function(){var P=this.data,C=this.bytesAvailable,c=P.byteLength-C,p=new Uint8Array(4),R=Math.min(4,C);if(R===0)throw new Error("no bytes available");p.set(P.subarray(c,c+R)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},B.skipBits=function(P){var C;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,C=P>>3,P-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},B.readBits=function(P){var C=Math.min(this.bitsAvailable,P),c=this.word>>>32-C;return P>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=P-C,C>0&&this.bitsAvailable?c<<C|this.readBits(C):c},B.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},B.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>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(P){for(var C=8,c=8,p,R=0;R<P;R++)c!==0&&(p=this.readEG(),c=(C+p+256)%256),C=c===0?C:c},B.readSPS=function(){var P=0,C=0,c=0,p=0,R,w,b,x=this.readUByte.bind(this),l=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),A=this.skipEG.bind(this),v=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);x();var D=x();if(l(5),u(3),x(),v(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var T=a();if(T===3&&u(1),v(),v(),u(1),s())for(w=T!==3?8:12,b=0;b<w;b++)s()&&(b<6?g(16):g(64))}v();var f=a();if(f===0)a();else if(f===1)for(u(1),A(),A(),R=a(),b=0;b<R;b++)A();v(),u(1);var h=a(),d=a(),o=l(1);o===0&&u(1),u(1),s()&&(P=a(),C=a(),c=a(),p=a());var E=[1,1];if(s()&&s()){var y=x();switch(y){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[x()<<8|x(),x()<<8|x()];break}}}return{width:Math.ceil((h+1)*16-P*2-C*2),height:(2-o)*(d+1)*16-(o?2:4)*(c+p),pixelRatio:E}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();H.default=F},"./src/demux/id3.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"isHeader",function(){return z}),L.d(H,"isFooter",function(){return F}),L.d(H,"getID3Data",function(){return O}),L.d(H,"canParse",function(){return N}),L.d(H,"getTimeStamp",function(){return P}),L.d(H,"isTimeStampFrame",function(){return C}),L.d(H,"getID3Frames",function(){return p}),L.d(H,"decodeFrame",function(){return R}),L.d(H,"utf8ArrayToStr",function(){return a}),L.d(H,"testables",function(){return s});var z=function(g,D){return D+10<=g.length&&(g[D]===73&&g[D+1]===68&&g[D+2]===51&&(g[D+3]<255&&g[D+4]<255&&(g[D+6]<128&&g[D+7]<128&&g[D+8]<128&&g[D+9]<128)))},F=function(g,D){return D+10<=g.length&&(g[D]===51&&g[D+1]===68&&g[D+2]===73&&(g[D+3]<255&&g[D+4]<255&&(g[D+6]<128&&g[D+7]<128&&g[D+8]<128&&g[D+9]<128)))},O=function(g,D){for(var T=D,f=0;z(g,D);){f+=10;var h=B(g,D+6);f+=h,F(g,D+10)&&(f+=10),D+=f}return f>0?g.subarray(T,T+f):void 0},B=function(g,D){var T=0;return T=(g[D]&127)<<21,T|=(g[D+1]&127)<<14,T|=(g[D+2]&127)<<7,T|=g[D+3]&127,T},N=function(g,D){return z(g,D)&&B(g,D+6)+10<=g.length-D},P=function(g){for(var D=p(g),T=0;T<D.length;T++){var f=D[T];if(C(f))return l(f)}return},C=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},c=function(g){var D=String.fromCharCode(g[0],g[1],g[2],g[3]),T=B(g,4),f=10;return{type:D,size:T,data:g.subarray(f,f+T)}},p=function(g){for(var D=0,T=[];z(g,D);){var f=B(g,D+6);D+=10;for(var h=D+f;D+8<h;){var d=c(g.subarray(D)),o=R(d);o&&T.push(o),D+=d.size+10}F(g,D)&&(D+=10)}return T},R=function(g){return g.type==="PRIV"?w(g):g.type[0]==="W"?x(g):b(g)},w=function(g){if(g.size<2)return;var D=a(g.data,!0),T=new Uint8Array(g.data.subarray(D.length+1));return{key:g.type,info:D,data:T.buffer}},b=function(g){if(g.size<2)return;if(g.type==="TXXX"){var D=1,T=a(g.data.subarray(D),!0);D+=T.length+1;var f=a(g.data.subarray(D));return{key:g.type,info:T,data:f}}var h=a(g.data.subarray(1));return{key:g.type,data:h}},x=function(g){if(g.type==="WXXX"){if(g.size<2)return;var D=1,T=a(g.data.subarray(D),!0);D+=T.length+1;var f=a(g.data.subarray(D));return{key:g.type,info:T,data:f}}var h=a(g.data);return{key:g.type,data:h}},l=function(g){if(g.data.byteLength===8){var D=new Uint8Array(g.data),T=D[3]&1,f=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return f/=45,T&&(f+=4772185884e-2),Math.round(f)}return},a=function(g,D){D===void 0&&(D=!1);var T=A();if(T){var f=T.decode(g);if(D){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var d=g.length,o,E,y,m="",k=0;k<d;){if(o=g[k++],o===0&&D)return m;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:m+=String.fromCharCode(o);break;case 12:case 13:E=g[k++],m+=String.fromCharCode((o&31)<<6|E&63);break;case 14:E=g[k++],y=g[k++],m+=String.fromCharCode((o&15)<<12|(E&63)<<6|(y&63)<<0);break;default:}}return m},s={decodeTextFrame:b},u;function A(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/demux/base-audio-demuxer.ts"),F=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function N(c,p){c.prototype=Object.create(p.prototype),c.prototype.constructor=c,P(c,p)}function P(c,p){return P=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},P(c,p)}var C=function(c){N(p,c);function p(){return c.apply(this,arguments)||this}var R=p.prototype;return R.resetInitSegment=function(b,x,l){c.prototype.resetInitSegment.call(this,b,x,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(b){if(!b)return!1;for(var x=F.getID3Data(b,0)||[],l=x.length,a=b.length;l<a;l++)if(B.probe(b,l))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(b,x){return B.canParse(b,x)},R.appendFrame=function(b,x,l){return this.initPTS===null?void 0:B.appendFrame(b,x,l,this.initPTS,this.frameIndex)},p}(z.default);C.minProbeByteLength=4,H.default=C},"./src/demux/mp4demuxer.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/utils/mp4-tools.ts"),F=L("./src/demux/dummy-demuxed-track.ts"),O=function(){function B(P,C){this.remainderData=null,this.config=void 0,this.config=C}var N=B.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},B.probe=function(C){return Object(z.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},N.demux=function(C){var c=C,p=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(z.appendUint8Array)(this.remainderData,C));var R=Object(z.segmentValidRange)(c);this.remainderData=R.remainder,p.samples=R.valid||new Uint8Array}else p.samples=c;return{audioTrack:Object(F.dummyTrack)(),avcTrack:p,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},N.flush=function(){var C=Object(F.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:C,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},N.demuxSampleAes=function(C,c,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},B}();O.minProbeByteLength=1024,H.default=O},"./src/demux/mpegaudio.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"appendFrame",function(){return P}),L.d(H,"parseHeader",function(){return C}),L.d(H,"isHeaderPattern",function(){return c}),L.d(H,"isHeader",function(){return p}),L.d(H,"canParse",function(){return R}),L.d(H,"probe",function(){return w});var z=null,F=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function P(b,x,l,a,s){if(l+24>x.length)return;var u=C(x,l);if(u&&l+u.frameLength<=x.length){var A=u.samplesPerFrame*9e4/u.sampleRate,v=a+s*A,g={unit:x.subarray(l,l+u.frameLength),pts:v,dts:v};return b.config=[],b.channelCount=u.channelCount,b.samplerate=u.sampleRate,b.samples.push(g),{sample:g,length:u.frameLength,missing:0}}}function C(b,x){var l=b[x+1]>>3&3,a=b[x+1]>>1&3,s=b[x+2]>>4&15,u=b[x+2]>>2&3;if(l!==1&&s!==0&&s!==15&&u!==3){var A=b[x+2]>>1&1,v=b[x+3]>>6,g=l===3?3-a:a===3?3:4,D=F[g*14+s-1]*1e3,T=l===3?0:l===2?1:2,f=O[T*3+u],h=v===3?1:2,d=B[l][a],o=N[a],E=d*8*o,y=Math.floor(d*D/f+A)*o;if(z===null){var m=navigator.userAgent||"",k=m.match(/Chrome\/(\d+)/i);z=k?parseInt(k[1]):0}var I=!!z&&z<=87;return I&&a===2&&D>=224e3&&v===0&&(b[x+3]=b[x+3]|128),{sampleRate:f,channelCount:h,frameLength:y,samplesPerFrame:E}}}function c(b,x){return b[x]===255&&(b[x+1]&224)===224&&(b[x+1]&6)!==0}function p(b,x){return x+1<b.length&&c(b,x)}function R(b,x){var l=4;return c(b,x)&&l<=b.length-x}function w(b,x){if(x+1<b.length&&c(b,x)){var l=4,a=C(b,x),s=l;a!=null&&a.frameLength&&(s=a.frameLength);var u=x+s;return u===b.length||p(b,u)}return!1}},"./src/demux/sample-aes.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/crypt/decrypter.ts"),F=L("./src/demux/tsdemuxer.ts"),O=function(){function B(P,C,c){this.keyData=void 0,this.decrypter=void 0,this.keyData=c,this.decrypter=new z.default(P,C,{removePKCS7Padding:!1})}var N=B.prototype;return N.decryptBuffer=function(C,c){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,c)},N.decryptAacSample=function(C,c,p,R){var w=C[c].unit,b=w.subarray(16,w.length-w.length%16),x=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),l=this;this.decryptBuffer(x,function(a){var s=new Uint8Array(a);w.set(s,16),R||l.decryptAacSamples(C,c+1,p)})},N.decryptAacSamples=function(C,c,p){for(;;c++){if(c>=C.length){p();return}if(C[c].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(C,c,p,R),!R)return}},N.getAvcEncryptedData=function(C){for(var c=Math.floor((C.length-48)/160)*16+16,p=new Int8Array(c),R=0,w=32;w<=C.length-16;w+=160,R+=16)p.set(C.subarray(w,w+16),R);return p},N.getAvcDecryptedUnit=function(C,c){for(var p=new Uint8Array(c),R=0,w=32;w<=C.length-16;w+=160,R+=16)C.set(p.subarray(R,R+16),w);return C},N.decryptAvcSample=function(C,c,p,R,w,b){var x=Object(F.discardEPB)(w.data),l=this.getAvcEncryptedData(x),a=this;this.decryptBuffer(l.buffer,function(s){w.data=a.getAvcDecryptedUnit(x,s),b||a.decryptAvcSamples(C,c,p+1,R)})},N.decryptAvcSamples=function(C,c,p,R){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,p=0){if(c>=C.length){R();return}for(var w=C[c].units;!(p>=w.length);p++){var b=w[p];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(C,c,p,R,b,x),!x)return}}},B}();H.default=O},"./src/demux/transmuxer-interface.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return w});var z=L("./node_modules/webworkify-webpack/index.js"),F=L.n(z),O=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),N=L("./src/utils/logger.ts"),P=L("./src/errors.ts"),C=L("./src/utils/mediasource-helper.ts"),c=L("./node_modules/eventemitter3/index.js"),p=L.n(c),R=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function b(l,a,s,u){var A=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=l,this.id=a,this.onTransmuxComplete=s,this.onFlush=u;var v=l.config,g=function(d,o){o=o||{},o.frag=A.frag,o.id=A.id,l.trigger(d,o)};this.observer=new c.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,g),this.observer.on(O.Events.ERROR,g);var D={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var f;try{f=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){l.trigger(O.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},f.postMessage({cmd:"init",typeSupported:D,vendor:T,id:a,config:JSON.stringify(v)})}catch(h){N.logger.warn("Error in worker:",h),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new B.default(this.observer,D,v,T,a),this.worker=null}}else this.transmuxer=new B.default(this.observer,D,v,T,a)}var x=b.prototype;return x.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},x.push=function(a,s,u,A,v,g,D,T,f,h){var d=this;f.transmuxing.start=self.performance.now();var o=this.transmuxer,E=this.worker,y=g?g.start:v.start,m=v.decryptdata,k=this.frag,I=!(k&&v.cc===k.cc),U=!(k&&f.level===k.level),W=k?f.sn-k.sn:-1,_=this.part?f.part-this.part.index:1,M=!U&&(W===1||W===0&&_===1),K=self.performance.now();(U||W||v.stats.parsing.start===0)&&(v.stats.parsing.start=K),g&&(_||!M)&&(g.stats.parsing.start=K);var Y=new B.TransmuxState(I,M,T,U,y);if(!M||I){N.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+I+`
|
|
trackSwitch: `+U+`
|
|
contiguous: `+M+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+y);var q=new B.TransmuxConfig(u,A,s,D,h);this.configureTransmuxer(q)}if(this.frag=v,this.part=g,E)E.postMessage({cmd:"demux",data:a,decryptdata:m,chunkMeta:f,state:Y},a instanceof ArrayBuffer?[a]:[]);else if(o){var oe=o.push(a,m,f,Y);Object(B.isPromise)(oe)?oe.then(function(be){d.handleTransmuxComplete(be)}):this.handleTransmuxComplete(oe)}},x.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:a});else if(u){var v=u.flush(a);Object(B.isPromise)(v)?v.then(function(g){s.handleFlushResult(g,a)}):this.handleFlushResult(v,a)}},x.handleFlushResult=function(a,s){var u=this;a.forEach(function(A){u.handleTransmuxComplete(A)}),this.onFlush(s)},x.onWorkerMessage=function(a){var s=a.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},x.configureTransmuxer=function(a){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},x.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},b}()},"./src/demux/transmuxer-worker.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return P});var z=L("./src/demux/transmuxer.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),N=L.n(B);function P(w){var b=new B.EventEmitter,x=function(a,s){w.postMessage({event:a,data:s})};b.on(F.Events.FRAG_DECRYPTED,x),b.on(F.Events.ERROR,x),w.addEventListener("message",function(l){var a=l.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);w.transmuxer=new z.default(b,a.typeSupported,s,a.vendor,a.id),Object(O.enableLogs)(s.debug),x("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var u=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(z.isPromise)(u)?u.then(function(g){C(w,g)}):C(w,u);break}case"flush":{var A=a.chunkMeta,v=w.transmuxer.flush(A);Object(z.isPromise)(v)?v.then(function(g){p(w,g,A)}):p(w,v,A);break}default:break}})}function C(w,b){if(R(b.remuxResult))return;var x=[],l=b.remuxResult,a=l.audio,s=l.video;a&&c(x,a),s&&c(x,s),w.postMessage({event:"transmuxComplete",data:b},x)}function c(w,b){b.data1&&w.push(b.data1.buffer),b.data2&&w.push(b.data2.buffer)}function p(w,b,x){b.forEach(function(l){C(w,l)}),w.postMessage({event:"flush",data:x})}function R(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return s}),L.d(H,"isPromise",function(){return v}),L.d(H,"TransmuxConfig",function(){return g}),L.d(H,"TransmuxState",function(){return D});var z=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),N=L("./src/demux/mp4demuxer.ts"),P=L("./src/demux/tsdemuxer.ts"),C=L("./src/demux/mp3demuxer.ts"),c=L("./src/remux/mp4-remuxer.ts"),p=L("./src/remux/passthrough-remuxer.ts"),R=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),b=L("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(T){b.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var l=[{demux:P.default,remux:c.default},{demux:N.default,remux:p.default},{demux:B.default,remux:c.default},{demux:C.default,remux:c.default}],a=1024;l.forEach(function(T){var f=T.demux;a=Math.max(a,f.minProbeByteLength)});var s=function(){function T(h,d,o,E,y){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=h,this.typeSupported=d,this.config=o,this.vendor=E,this.id=y}var f=T.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,o,E,y){var m=this,k=E.transmuxing;k.executeStart=x();var I=new Uint8Array(d),U=this.cache,W=this.config,_=this.currentTransmuxState,M=this.transmuxConfig;y&&(this.currentTransmuxState=y);var K=u(I,o);if(K&&K.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var q=Y.softwareDecrypt(I,K.key.buffer,K.iv.buffer);if(!q)return k.executeEnd=x(),A(E);I=new Uint8Array(q)}else return this.decryptionPromise=Y.webCryptoDecrypt(I,K.key.buffer,K.iv.buffer).then(function(Se){var Re=m.push(Se,null,E);return m.decryptionPromise=null,Re}),this.decryptionPromise}var oe=y||_,be=oe.contiguous,me=oe.discontinuity,he=oe.trackSwitch,fe=oe.accurateTimeOffset,ue=oe.timeOffset,ie=M.audioCodec,pe=M.videoCodec,$=M.defaultInitPts,ae=M.duration,ee=M.initSegmentData;if((me||he)&&this.resetInitSegment(ee,ie,pe,ae),me&&this.resetInitialTimestamp($),be||this.resetContiguity(),this.needsProbing(I,me,he)){if(U.dataLength){var Ee=U.flush();I=Object(w.appendUint8Array)(Ee,I)}this.configureTransmuxer(I,M)}var Ce=this.transmux(I,K,ue,fe,E),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,k.executeEnd=x(),Ce},f.flush=function(d){var o=this,E=d.transmuxing;E.executeStart=x();var y=this.decrypter,m=this.cache,k=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return o.flush(d)});var U=[],W=k.timeOffset;if(y){var _=y.flush();_&&U.push(this.push(_,null,d))}var M=m.dataLength;m.reset();var K=this.demuxer,Y=this.remuxer;if(!K||!Y)return M>=a&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=x(),[A(d)];var q=K.flush(W);return v(q)?q.then(function(oe){return o.flushRemux(U,oe,d),U}):(this.flushRemux(U,q,d),U)},f.flushRemux=function(d,o,E){var y=o.audioTrack,m=o.avcTrack,k=o.id3Track,I=o.textTrack,U=this.currentTransmuxState,W=U.accurateTimeOffset,_=U.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var M=this.remuxer.remux(y,m,k,I,_,W,!0,this.id);d.push({remuxResult:M,chunkMeta:E}),E.transmuxing.executeEnd=x()},f.resetInitialTimestamp=function(d){var o=this.demuxer,E=this.remuxer;if(!o||!E)return;o.resetTimeStamp(d),E.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},f.resetInitSegment=function(d,o,E,y){var m=this.demuxer,k=this.remuxer;if(!m||!k)return;m.resetInitSegment(o,E,y),k.resetInitSegment(d,o,E)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(d,o,E,y,m){var k;return o&&o.method==="SAMPLE-AES"?k=this.transmuxSampleAes(d,o,E,y,m):k=this.transmuxUnencrypted(d,E,y,m),k},f.transmuxUnencrypted=function(d,o,E,y){var m=this.demuxer.demux(d,o,!1,!this.config.progressive),k=m.audioTrack,I=m.avcTrack,U=m.id3Track,W=m.textTrack,_=this.remuxer.remux(k,I,U,W,o,E,!1,this.id);return{remuxResult:_,chunkMeta:y}},f.transmuxSampleAes=function(d,o,E,y,m){var k=this;return this.demuxer.demuxSampleAes(d,o,E).then(function(I){var U=k.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,E,y,!1,k.id);return{remuxResult:U,chunkMeta:m}})},f.configureTransmuxer=function(d,o){for(var E=this.config,y=this.observer,m=this.typeSupported,k=this.vendor,I=o.audioCodec,U=o.defaultInitPts,W=o.duration,_=o.initSegmentData,M=o.videoCodec,K,Y=0,q=l.length;Y<q;Y++)if(l[Y].demux.probe(d)){K=l[Y];break}K||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:N.default,remux:p.default});var oe=this.demuxer,be=this.remuxer,me=K.remux,he=K.demux;(!be||!(be instanceof me))&&(this.remuxer=new me(y,E,m,k)),(!oe||!(oe instanceof he))&&(this.demuxer=new he(y,E,m),this.probe=he.probe),this.resetInitSegment(_,I,M,W),this.resetInitialTimestamp(U)},f.needsProbing=function(d,o,E){return!this.demuxer||!this.remuxer||o||E},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new O.default(this.observer,this.config)),d},T}();function u(T,f){var h=null;return T.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var A=function(f){return{remuxResult:{},chunkMeta:f}};function v(T){return"then"in T&&T.then instanceof Function}var g=function(f,h,d,o,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=h,this.initSegmentData=d,this.duration=o,this.defaultInitPts=E},D=function(f,h,d,o,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=h,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"discardEPB",function(){return A});var z=L("./src/demux/adts.ts"),F=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),N=L("./src/demux/sample-aes.ts"),P=L("./src/events.ts"),C=L("./src/utils/mp4-tools.ts"),c=L("./src/utils/logger.ts"),p=L("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},w=function(){function v(D,T,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=T,this.typeSupported=f}v.probe=function(T){var f=v.syncOffset(T);return f<0?!1:(f&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},v.syncOffset=function(T){for(var f=Math.min(1e3,T.length-3*188),h=0;h<f;){if(T[h]===71&&T[h+188]===71&&T[h+2*188]===71)return h;h++}return-1},v.createTrack=function(T,f){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:R[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?f:void 0}};var g=v.prototype;return g.resetInitSegment=function(T,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",h),this._audioTrack=v.createTrack("audio",h),this._id3Track=v.createTrack("id3",h),this._txtTrack=v.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=f,this._duration=h},g.resetTimeStamp=function(){},g.resetContiguity=function(){var T=this._audioTrack,f=this._avcTrack,h=this._id3Track;T&&(T.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(T,f,h,d){h===void 0&&(h=!1),d===void 0&&(d=!1),h||(this.sampleAes=null);var o,E=this._avcTrack,y=this._audioTrack,m=this._id3Track,k=E.pid,I=E.pesData,U=y.pid,W=m.pid,_=y.pesData,M=m.pesData,K=!1,Y=this.pmtParsed,q=this._pmtId,oe=T.length;if(this.remainderData&&(T=Object(C.appendUint8Array)(this.remainderData,T),oe=T.length,this.remainderData=null),oe<188&&!d)return this.remainderData=T,{audioTrack:y,avcTrack:E,id3Track:m,textTrack:this._txtTrack};var be=Math.max(0,v.syncOffset(T));oe-=(oe+be)%188,oe<T.byteLength&&!d&&(this.remainderData=new Uint8Array(T.buffer,oe,T.buffer.byteLength-oe));for(var me=be;me<oe;me+=188)if(T[me]===71){var he=!!(T[me+1]&64),fe=((T[me+1]&31)<<8)+T[me+2],ue=(T[me+3]&48)>>4,ie=void 0;if(ue>1){if(ie=me+5+T[me+4],ie===me+188)continue}else ie=me+4;switch(fe){case k:he&&(I&&(o=a(I))&&this.parseAVCPES(o,!1),I={data:[],size:0}),I&&(I.data.push(T.subarray(ie,me+188)),I.size+=me+188-ie);break;case U:he&&(_&&(o=a(_))&&(y.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),_={data:[],size:0}),_&&(_.data.push(T.subarray(ie,me+188)),_.size+=me+188-ie);break;case W:he&&(M&&(o=a(M))&&this.parseID3PES(o),M={data:[],size:0}),M&&(M.data.push(T.subarray(ie,me+188)),M.size+=me+188-ie);break;case 0:he&&(ie+=T[ie]+1),q=this._pmtId=x(T,ie);break;case q:{he&&(ie+=T[ie]+1);var pe=l(T,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);k=pe.avc,k>0&&(E.pid=k),U=pe.audio,U>0&&(y.pid=U,y.isAAC=pe.isAAC),W=pe.id3,W>0&&(m.pid=W),K&&!Y&&(c.logger.log("reparse from beginning"),K=!1,me=be-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=I,y.pesData=_,m.pesData=M;var $={audioTrack:y,avcTrack:E,id3Track:m,textTrack:this._txtTrack};return d&&this.extractRemainingSamples($),$},g.flush=function(){var T=this.remainderData;this.remainderData=null;var f;return T?f=this.demux(T,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},g.extractRemainingSamples=function(T){var f=T.audioTrack,h=T.avcTrack,d=T.id3Track,o=h.pesData,E=f.pesData,y=d.pesData,m;o&&(m=a(o))?(this.parseAVCPES(m,!0),h.pesData=null):h.pesData=o,E&&(m=a(E))?(f.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),f.pesData=null):(E!=null&&E.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),y&&(m=a(y))?(this.parseID3PES(m),d.pesData=null):d.pesData=y},g.demuxSampleAes=function(T,f,h){var d=this.demux(T,h,!0,!this.config.progressive),o=this.sampleAes=new N.default(this.observer,this.config,f);return this.decrypt(d,o)},g.decrypt=function(T,f){return new Promise(function(h){var d=T.audioTrack,o=T.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){o.samples?f.decryptAvcSamples(o.samples,0,0,function(){h(T)}):h(T)}):o.samples&&f.decryptAvcSamples(o.samples,0,0,function(){h(T)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(T,f){var h=this,d=this._avcTrack,o=this.parseAVCNALu(T.data),E=!1,y=this.avcSample,m,k=!1;T.data=null,y&&o.length&&!d.audFound&&(s(y,d),y=this.avcSample=b(!1,T.pts,T.dts,"")),o.forEach(function(I){switch(I.type){case 1:{m=!0,y||(y=h.avcSample=b(!0,T.pts,T.dts,"")),E&&(y.debug+="NDR "),y.frame=!0;var U=I.data;if(k&&U.length>4){var W=new O.default(U).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:m=!0,y||(y=h.avcSample=b(!0,T.pts,T.dts,"")),E&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{m=!0,E&&y&&(y.debug+="SEI ");var _=new O.default(A(I.data));_.readUByte();for(var M=0,K=0,Y=!1,q=0;!Y&&_.bytesAvailable>1;){M=0;do q=_.readUByte(),M+=q;while(q===255);K=0;do q=_.readUByte(),K+=q;while(q===255);if(M===4&&_.bytesAvailable!==0){Y=!0;var oe=_.readUByte();if(oe===181){var be=_.readUShort();if(be===49){var me=_.readUInt();if(me===1195456820){var he=_.readUByte();if(he===3){for(var fe=_.readUByte(),ue=_.readUByte(),ie=31&fe,pe=[fe,ue],$=0;$<ie;$++)pe.push(_.readUByte()),pe.push(_.readUByte()),pe.push(_.readUByte());u(h._txtTrack.samples,{type:3,pts:T.pts,bytes:pe})}}}}}else if(M===5&&_.bytesAvailable!==0){if(Y=!0,K>16){for(var ae=[],ee=0;ee<16;ee++)ae.push(_.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&ae.push("-");for(var Ee=K-16,Ce=new Uint8Array(Ee),ve=0;ve<Ee;ve++)Ce[ve]=_.readUByte();u(h._txtTrack.samples,{pts:T.pts,payloadType:M,uuid:ae.join(""),userData:Object(B.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(K<_.bytesAvailable)for(var Se=0;Se<K;Se++)_.readUByte()}break}case 7:if(m=!0,k=!0,E&&y&&(y.debug+="SPS "),!d.sps){var Re=new O.default(I.data),Ne=Re.readSPS();d.width=Ne.width,d.height=Ne.height,d.pixelRatio=Ne.pixelRatio,d.sps=[I.data],d.duration=h._duration;for(var _e=I.data.subarray(1,4),Pe="avc1.",ke=0;ke<3;ke++){var Ze=_e[ke].toString(16);Ze.length<2&&(Ze="0"+Ze),Pe+=Ze}d.codec=Pe}break;case 8:m=!0,E&&y&&(y.debug+="PPS "),d.pps||(d.pps=[I.data]);break;case 9:m=!1,d.audFound=!0,y&&s(y,d),y=h.avcSample=b(!1,T.pts,T.dts,E?"AUD ":"");break;case 12:m=!1;break;default:m=!1,y&&(y.debug+="unknown NAL "+I.type+" ");break}if(y&&m){var Ge=y.units;Ge.push(I)}}),f&&y&&(s(y,d),this.avcSample=null)},g.getLastNalUnit=function(){var T,f=this.avcSample,h;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((T=f)!==null&&T!==void 0&&T.units){var o=f.units;h=o[o.length-1]}return h},g.parseAVCNALu=function(T){var f=T.byteLength,h=this._avcTrack,d=h.naluState||0,o=d,E=[],y=0,m,k,I,U=-1,W=0;for(d===-1&&(U=0,W=T[0]&31,d=0,y=1);y<f;){if(m=T[y++],!d){d=m?0:1;continue}if(d===1){d=m?0:2;continue}if(!m)d=3;else if(m===1){if(U>=0){var _={data:T.subarray(U,y-d-1),type:W};E.push(_)}else{var M=this.getLastNalUnit();if(M&&(o&&y<=4-o&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-o))),k=y-d-1,k>0)){var K=new Uint8Array(M.data.byteLength+k);K.set(M.data,0),K.set(T.subarray(0,k),M.data.byteLength),M.data=K,M.state=0}}y<f?(I=T[y]&31,U=y,W=I,d=0):d=-1}else d=0}if(U>=0&&d>=0){var Y={data:T.subarray(U,f),type:W,state:d};E.push(Y)}if(E.length===0){var q=this.getLastNalUnit();if(q){var oe=new Uint8Array(q.data.byteLength+T.byteLength);oe.set(q.data,0),oe.set(T,q.data.byteLength),q.data=oe}}return h.naluState=d,E},g.parseAACPES=function(T){var f=0,h=this._audioTrack,d=this.aacOverFlow,o=T.data;if(d){this.aacOverFlow=null;var E=d.sample.unit.byteLength,y=Math.min(d.missing,E),m=E-y;d.sample.unit.set(o.subarray(0,y),m),h.samples.push(d.sample),f=d.missing}var k,I;for(k=f,I=o.length;k<I-1&&!z.isHeader(o,k);k++);if(k!==f){var U,W;if(k<I-1?(U="AAC PES did not start with ADTS header,offset:"+k,W=!1):(U="no ADTS header found in AAC PES",W=!0),c.logger.warn("parsing error:"+U),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:U}),W)return}z.initTrackConfig(h,this.observer,o,k,this.audioCodec);var _;if(T.pts!==void 0)_=T.pts;else if(d){var M=z.getFrameDuration(h.samplerate);_=d.sample.pts+M}else{c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;k<I;)if(z.isHeader(o,k)){if(k+5<I){var Y=z.appendFrame(h,o,k,_,K);if(Y)if(Y.missing)this.aacOverFlow=Y;else{k+=Y.length,K++;continue}}break}else k++},g.parseMPEGPES=function(T){var f=T.data,h=f.length,d=0,o=0,E=T.pts;if(E===void 0){c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<h;)if(F.isHeader(f,o)){var y=F.appendFrame(this._audioTrack,f,o,E,d);if(y)o+=y.length,d++;else break}else o++},g.parseID3PES=function(T){if(T.pts===void 0){c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},v}();w.minProbeByteLength=188;function b(v,g,D,T){return{key:v,frame:!1,pts:g,dts:D,units:[],debug:T,length:0}}function x(v,g){return(v[g+10]&31)<<8|v[g+11]}function l(v,g,D,T){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(v[g+1]&15)<<8|v[g+2],d=g+3+h-4,o=(v[g+10]&15)<<8|v[g+11];for(g+=12+o;g<d;){var E=(v[g+1]&31)<<8|v[g+2];switch(v[g]){case 207:if(!T){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=E);break;case 21:f.id3===-1&&(f.id3=E);break;case 219:if(!T){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=E);break;case 3:case 4:D?f.audio===-1&&(f.audio=E,f.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((v[g+3]&15)<<8|v[g+4])+5}return f}function a(v){var g=0,D,T,f,h,d,o=v.data;if(!v||v.size===0)return null;for(;o[0].length<19&&o.length>1;){var E=new Uint8Array(o[0].length+o[1].length);E.set(o[0]),E.set(o[1],o[0].length),o[0]=E,o.splice(1,1)}D=o[0];var y=(D[0]<<16)+(D[1]<<8)+D[2];if(y===1){if(T=(D[4]<<8)+D[5],T&&T>v.size-6)return null;var m=D[7];m&192&&(h=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,m&64?(d=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,h-d>60*9e4&&(c.logger.warn(Math.round((h-d)/9e4)+"s delta between PTS and DTS, align them"),h=d)):d=h),f=D[8];var k=f+9;if(v.size<=k)return null;v.size-=k;for(var I=new Uint8Array(v.size),U=0,W=o.length;U<W;U++){D=o[U];var _=D.byteLength;if(k)if(k>_){k-=_;continue}else D=D.subarray(k),_-=k,k=0;I.set(D,g),g+=_}return T&&(T-=f+3),{data:I,pts:h,dts:d,len:T}}return null}function s(v,g){if(v.units.length&&v.frame){if(v.pts===void 0){var D=g.samples,T=D.length;if(T){var f=D[T-1];v.pts=f.pts,v.dts=f.dts}else{g.dropped++;return}}g.samples.push(v)}v.debug.length&&c.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function u(v,g){var D=v.length;if(D>0){if(g.pts>=v[D-1].pts)v.push(g);else for(var T=D-1;T>=0;T--)if(g.pts<v[T].pts){v.splice(T,0,g);break}}else v.push(g)}function A(v){for(var g=v.byteLength,D=[],T=1;T<g-2;)v[T]===0&&v[T+1]===0&&v[T+2]===3?(D.push(T+2),T+=2):T++;if(D.length===0)return v;var f=g-D.length,h=new Uint8Array(f),d=0;for(T=0;T<f;d++,T++)d===D[0]&&(d++,D.shift()),h[T]=v[d];return h}H.default=w},"./src/errors.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"ErrorTypes",function(){return z}),L.d(H,"ErrorDetails",function(){return F});var z;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(z||(z={}));var F;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"Events",function(){return z});var z;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return v});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),F=L.n(z),O=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),N=L("./src/controller/id3-track-controller.ts"),P=L("./src/controller/latency-controller.ts"),C=L("./src/controller/level-controller.ts"),c=L("./src/controller/fragment-tracker.ts"),p=L("./src/controller/stream-controller.ts"),R=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),b=L("./src/config.ts"),x=L("./node_modules/eventemitter3/index.js"),l=L.n(x),a=L("./src/events.ts"),s=L("./src/errors.ts");function u(g,D){for(var T=0;T<D.length;T++){var f=D[T];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(g,f.key,f)}}function A(g,D,T){return D&&u(g.prototype,D),T&&u(g,T),g}var v=function(){g.isSupported=function(){return Object(R.isSupported)()};function g(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new x.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 f=this.config=Object(b.mergeConfig)(g.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(b.enableStreamingMode)(f);var h=f.abrController,d=f.bufferController,o=f.capLevelController,E=f.fpsController,y=this.abrController=new h(this),m=this.bufferController=new d(this),k=this.capLevelController=new o(this),I=new E(this),U=new O.default(this),W=new B.default(this),_=new N.default(this),M=this.levelController=new C.default(this),K=new c.FragmentTracker(this),Y=this.streamController=new p.default(this,K);k.setStreamController(Y),I.setStreamController(Y);var q=[M,Y];this.networkControllers=q;var oe=[U,W,y,m,k,I,_,K];this.audioTrackController=this.createController(f.audioTrackController,null,q),this.createController(f.audioStreamController,K,q),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,q),this.createController(f.subtitleStreamController,K,q),this.createController(f.timelineController,null,oe),this.emeController=this.createController(f.emeController,null,oe),this.cmcdController=this.createController(f.cmcdController,null,oe),this.latencyController=this.createController(P.default,null,oe),this.coreComponents=oe}var D=g.prototype;return D.createController=function(f,h,d){if(f){var o=h?new f(this,h):new f(this);return d&&d.push(o),o}return null},D.on=function(f,h,d){d===void 0&&(d=this),this._emitter.on(f,h,d)},D.once=function(f,h,d){d===void 0&&(d=this),this._emitter.once(f,h,d)},D.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},D.off=function(f,h,d,o){d===void 0&&(d=this),this._emitter.off(f,h,d,o)},D.listeners=function(f){return this._emitter.listeners(f)},D.emit=function(f,h,d){return this._emitter.emit(f,h,d)},D.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(d){w.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:d})}return!1},D.listenerCount=function(f){return this._emitter.listenerCount(f)},D.destroy=function(){w.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},D.attachMedia=function(f){w.logger.log("attachMedia"),this._media=f,this.trigger(a.Events.MEDIA_ATTACHING,{media:f})},D.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(f){this.stopLoad();var h=this.media,d=this.url,o=this.url=z.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),h&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(a.Events.MANIFEST_LOADING,{url:f})},D.startLoad=function(f){f===void 0&&(f=-1),w.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},D.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},D.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){w.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},D.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},A(g,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){w.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){w.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){w.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){w.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){w.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var h=!!f;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(w.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,h=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,o=0;o<d;o++)if(f[o].maxBitrate>h)return o;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,h=this.autoLevelCapping,d;return h===-1&&f&&f.length?d=f.length-1:d=h,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var h=this.audioTrackController;h&&(h.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:b.hlsDefaultConfig},set:function(f){g.defaultConfig=f}}]),g}();v.defaultConfig=void 0},"./src/is-supported.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"isSupported",function(){return O}),L.d(H,"changeTypeSupported",function(){return B});var z=L("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var N=Object(z.getMediaSource)();if(!N)return!1;var P=F(),C=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!C&&!!c}function B(){var N,P=F();return typeof(P==null||((N=P.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return w}),L.d(H,"LoadError",function(){return x});var z=L("./src/polyfills/number.ts"),F=L("./src/errors.ts");function O(l,a){l.prototype=Object.create(a.prototype),l.prototype.constructor=l,c(l,a)}function B(l){var a=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!C(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(u))return a.get(u);a.set(u,A)}function A(){return N(u,arguments,p(this).constructor)}return A.prototype=Object.create(u.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),c(A,u)},B(l)}function N(l,a,s){return P()?N=Reflect.construct:N=function(A,v,g){var D=[null];D.push.apply(D,v);var T=Function.bind.apply(A,D),f=new T;return g&&c(f,g.prototype),f},N.apply(null,arguments)}function P(){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(l){return!1}}function C(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function c(l,a){return c=Object.setPrototypeOf||function(u,A){return u.__proto__=A,u},c(l,a)}function p(l){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},p(l)}var R=Math.pow(2,17),w=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=l.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(u,A){var v=this,g=u.url;if(!g)return Promise.reject(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,f=D.loader;return new Promise(function(h,d){v.loader&&v.loader.destroy();var o=v.loader=u.loader=T?new T(D):new f(D),E=b(u),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:R};u.stats=o.stats,o.load(E,y,{onSuccess:function(k,I,U,W){v.resetLoader(u,o),h({frag:u,part:null,payload:k.data,networkDetails:W})},onError:function(k,I,U){v.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:k,networkDetails:U}))},onAbort:function(k,I,U){v.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:U}))},onTimeout:function(k,I,U){v.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:U}))},onProgress:function(k,I,U,W){A&&A({frag:u,part:null,payload:U,networkDetails:W})}})})},a.loadPart=function(u,A,v){var g=this;this.abort();var D=this.config,T=D.fLoader,f=D.loader;return new Promise(function(h,d){g.loader&&g.loader.destroy();var o=g.loader=u.loader=T?new T(D):new f(D),E=b(u,A),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:R};A.stats=o.stats,o.load(E,y,{onSuccess:function(k,I,U,W){g.resetLoader(u,o),g.updateStatsFromPart(u,A);var _={frag:u,part:A,payload:k.data,networkDetails:W};v(_),h(_)},onError:function(k,I,U){g.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:A,response:k,networkDetails:U}))},onAbort:function(k,I,U){u.stats.aborted=A.stats.aborted,g.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:A,networkDetails:U}))},onTimeout:function(k,I,U){g.resetLoader(u,o),d(new x({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:A,networkDetails:U}))}})})},a.updateStatsFromPart=function(u,A){var v=u.stats,g=A.stats,D=g.total;if(v.loaded+=g.loaded,D){var T=Math.round(u.duration/A.duration),f=Math.min(Math.round(v.loaded/D),T),h=T-f,d=h*Math.round(v.loaded/f);v.total=v.loaded+d}else v.total=Math.max(v.loaded,v.total);var o=v.loading,E=g.loading;o.start?o.first+=E.first-E.start:(o.start=E.start,o.first=E.first),o.end=E.end},a.resetLoader=function(u,A){u.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},l}();function b(l,a){a===void 0&&(a=null);var s=a||l,u={frag:l,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},A=s.byteRangeStartOffset,v=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(A)&&Object(z.isFiniteNumber)(v)&&(u.rangeStart=A,u.rangeEnd=v),u}var x=function(l){O(a,l);function a(s){for(var u,A=arguments.length,v=new Array(A>1?A-1:0),g=1;g<A;g++)v[g-1]=arguments[g];return u=l.call.apply(l,[this].concat(v))||this,u.data=void 0,u.data=s,u}return a}(B(Error))},"./src/loader/fragment.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"ElementaryStreamTypes",function(){return w}),L.d(H,"BaseSegment",function(){return b}),L.d(H,"Fragment",function(){return x}),L.d(H,"Part",function(){return l});var z=L("./src/polyfills/number.ts"),F=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(F),B=L("./src/utils/logger.ts"),N=L("./src/loader/level-key.ts"),P=L("./src/loader/load-stats.ts");function C(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,c(a,s)}function c(a,s){return c=Object.setPrototypeOf||function(A,v){return A.__proto__=v,A},c(a,s)}function p(a,s){for(var u=0;u<s.length;u++){var A=s[u];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function R(a,s,u){return s&&p(a.prototype,s),u&&p(a,u),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var b=function(){function a(u){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[w.AUDIO]=null,A[w.VIDEO]=null,A[w.AUDIOVIDEO]=null,A),this.baseurl=u}var s=a.prototype;return s.setByteRange=function(A,v){var g=A.split("@",2),D=[];g.length===1?D[0]=v?v.byteRangeEndOffset:0:D[0]=parseInt(g[1]),D[1]=parseInt(g[0])+D[0],this._byteRange=D},R(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),a}(),x=function(a){C(s,a);function s(A,v){var g;return g=a.call(this,v)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new P.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=A,g}var u=s.prototype;return u.createInitializationVector=function(v){for(var g=new Uint8Array(16),D=12;D<16;D++)g[D]=v>>8*(15-D)&255;return g},u.setDecryptDataFromLevelKey=function(v,g){var D=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(D=N.LevelKey.fromURI(v.uri),D.method=v.method,D.iv=this.createInitializationVector(g),D.keyFormat="identity"),D},u.setElementaryStreamInfo=function(v,g,D,T,f,h){h===void 0&&(h=!1);var d=this.elementaryStreams,o=d[v];if(!o){d[v]={startPTS:g,endPTS:D,startDTS:T,endDTS:f,partial:h};return}o.startPTS=Math.min(o.startPTS,g),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,f)},u.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[w.AUDIO]=null,v[w.VIDEO]=null,v[w.AUDIOVIDEO]=null},R(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="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'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var v=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),s}(b),l=function(a){C(s,a);function s(u,A,v,g,D){var T;T=a.call(this,v)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new P.LoadStats,T.duration=u.decimalFloatingPoint("DURATION"),T.gap=u.bool("GAP"),T.independent=u.bool("INDEPENDENT"),T.relurl=u.enumeratedString("URI"),T.fragment=A,T.index=g;var f=u.enumeratedString("BYTERANGE");return f&&T.setByteRange(f,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}return R(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return B});var z=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=function(){function N(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var P=N.prototype;return P._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var c in this.loaders){var p=this.loaders[c];p&&p.destroy()}this.loaders={}},P.onKeyLoading=function(c,p){var R=p.frag,w=R.type,b=this.loaders[w];if(!R.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=R.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(b&&(O.logger.warn("abort previous key loader for type:"+w),b.abort()),!x){O.logger.warn("key uri is falsy");return}var a=l.loader,s=R.loader=this.loaders[w]=new a(l);this.decrypturl=x,this.decryptkey=null;var u={url:x,frag:R,responseType:"arraybuffer"},A={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,A,v)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:R}))},P.loadsuccess=function(c,p,R){var w=R.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(c.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:w})},P.loaderror=function(c,p){var R=p.frag,w=R.loader;w&&w.abort(),delete this.loaders[R.type],this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:c})},P.loadtimeout=function(c,p){var R=p.frag,w=R.loader;w&&w.abort(),delete this.loaders[R.type],this.hls.trigger(z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},N}()},"./src/loader/level-details.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"LevelDetails",function(){return N});var z=L("./src/polyfills/number.ts");function F(P,C){for(var c=0;c<C.length;c++){var p=C[c];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function O(P,C,c){return C&&F(P.prototype,C),c&&F(P,c),P}var B=10,N=function(){function P(c){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=c}var C=P.prototype;return C.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-p.lastPartSn,w=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!w||!!R,this.advanced=this.endSN>p.endSN||R>0||R===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},O(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var R=this.driftEnd-this.driftStart;return R*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"LevelKey",function(){return N});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),F=L.n(z);function O(P,C){for(var c=0;c<C.length;c++){var p=C[c];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function B(P,C,c){return C&&O(P.prototype,C),c&&O(P,c),P}var N=function(){P.fromURL=function(c,p){return new P(c,p)},P.fromURI=function(c){return new P(c)};function P(C,c){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,c?this._uri=Object(z.buildAbsoluteURL)(C,c,{alwaysNormalize:!0}):this._uri=C}return B(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"LoadStats",function(){return z});var z=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(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return s});var z=L("./src/polyfills/number.ts"),F=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(F),B=L("./src/loader/fragment.ts"),N=L("./src/loader/level-details.ts"),P=L("./src/loader/level-key.ts"),C=L("./src/utils/attr-list.ts"),c=L("./src/utils/logger.ts"),p=L("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),x=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function a(D){var T,f;return l.test((T=(f=F.parseURL(D))===null||f===void 0?void 0:f.path)!=null?T:"")}var s=function(){function D(){}return D.findGroup=function(f,h){for(var d=0;d<f.length;d++){var o=f[d];if(o.id===h)return o}},D.convertAVC1ToAVCOTI=function(f){var h=f.split(".");if(h.length>2){var d=h.shift()+".";return d+=parseInt(h.shift()).toString(16),d+=("000"+parseInt(h.shift()).toString(16)).substr(-4),d}return f},D.resolve=function(f,h){return F.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(f,h){var d=[],o={},E=!1;R.lastIndex=0;for(var y;(y=R.exec(f))!=null;)if(y[1]){var m=new C.AttrList(y[1]),k={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:D.resolve(y[2],h)},I=m.decimalResolution("RESOLUTION");I&&(k.width=I.width,k.height=I.height),u((m.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=D.convertAVC1ToAVCOTI(k.videoCodec)),d.push(k)}else if(y[3]){var U=new C.AttrList(y[3]);U["DATA-ID"]&&(E=!0,o[U["DATA-ID"]]=U)}return{levels:d,sessionData:E?o:null}},D.parseMasterPlaylistMedia=function(f,h,d,o){o===void 0&&(o=[]);var E,y=[],m=0;for(w.lastIndex=0;(E=w.exec(f))!==null;){var k=new C.AttrList(E[1]);if(k.TYPE===d){var I={attrs:k,bitrate:0,id:m++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:d,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?D.resolve(k.URI,h):""};if(o.length){var U=D.findGroup(o,I.groupId)||o[0];A(I,U,"audioCodec"),A(I,U,"textCodec")}y.push(I)}}return y},D.parseLevelPlaylist=function(f,h,d,o,E){var y=new N.LevelDetails(h),m=y.fragments,k=null,I=0,U=0,W=0,_=0,M=null,K=new B.Fragment(o,h),Y,q,oe,be=-1,me=!1;for(b.lastIndex=0,y.m3u8=f;(Y=b.exec(f))!==null;){me&&(me=!1,K=new B.Fragment(o,h),K.start=W,K.sn=I,K.cc=_,K.level=d,k&&(K.initSegment=k,K.rawProgramDateTime=k.rawProgramDateTime));var he=Y[1];if(he){K.duration=parseFloat(he);var fe=(" "+Y[2]).slice(1);K.title=fe||null,K.tagList.push(fe?["INF",he,fe]:["INF",he])}else if(Y[3])Object(z.isFiniteNumber)(K.duration)&&(K.start=W,oe&&(K.levelkey=oe),K.sn=I,K.level=d,K.cc=_,K.urlId=E,m.push(K),K.relurl=(" "+Y[3]).slice(1),g(K,M),M=K,W+=K.duration,I++,U=0,me=!0);else if(Y[4]){var ue=(" "+Y[4]).slice(1);M?K.setByteRange(ue,M):K.setByteRange(ue)}else if(Y[5])K.rawProgramDateTime=(" "+Y[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),be===-1&&(be=m.length);else{if(Y=Y[0].match(x),!Y){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<Y.length&&!(typeof Y[q]!="undefined");q++);var ie=(" "+Y[q]).slice(1),pe=(" "+Y[q+1]).slice(1),$=Y[q+2]?(" "+Y[q+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":y.type=pe.toUpperCase();break;case"MEDIA-SEQUENCE":I=y.startSN=parseInt(pe);break;case"SKIP":{var ae=new C.AttrList(pe),ee=ae.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(ee)){y.skippedSegments=ee;for(var Ee=ee;Ee--;)m.unshift(null);I+=ee}var Ce=ae.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(y.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(pe);break;case"VERSION":y.version=parseInt(pe);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(pe||$)&&K.tagList.push($?[pe,$]:[pe]);break;case"DIS":_++;case"GAP":K.tagList.push([ie]);break;case"BITRATE":K.tagList.push([ie,pe]);break;case"DISCONTINUITY-SEQ":_=parseInt(pe);break;case"KEY":{var ve,Se=new C.AttrList(pe),Re=Se.enumeratedString("METHOD"),Ne=Se.URI,_e=Se.hexadecimalInteger("IV"),Pe=Se.enumeratedString("KEYFORMATVERSIONS"),ke=Se.enumeratedString("KEYID"),Ze=(ve=Se.enumeratedString("KEYFORMAT"))!=null?ve:"identity",Ge=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ge.indexOf(Ze)>-1){c.logger.warn("Keyformat "+Ze+" is not supported from the manifest");continue}else if(Ze!=="identity")continue;Re&&(oe=P.LevelKey.fromURL(h,Ne),Ne&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(oe.method=Re,oe.keyFormat=Ze,ke&&(oe.keyID=ke),Pe&&(oe.keyFormatVersions=Pe),oe.iv=_e));break}case"START":{var Ve=new C.AttrList(pe),We=Ve.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(We)&&(y.startTimeOffset=We);break}case"MAP":{var rt=new C.AttrList(pe);K.relurl=rt.URI,rt.BYTERANGE&&K.setByteRange(rt.BYTERANGE),K.level=d,K.sn="initSegment",oe&&(K.levelkey=oe),K.initSegment=null,k=K,me=!0;break}case"SERVER-CONTROL":{var Xe=new C.AttrList(pe);y.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var $e=new C.AttrList(pe);y.partTarget=$e.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=y.partList;we||(we=y.partList=[]);var qe=U>0?we[we.length-1]:void 0,Ye=U++,Ae=new B.Part(new C.AttrList(pe),K,h,Ye,qe);we.push(Ae),K.duration+=Ae.duration;break}case"PRELOAD-HINT":{var Me=new C.AttrList(pe);y.preloadHint=Me;break}case"RENDITION-REPORT":{var ge=new C.AttrList(pe);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:c.logger.warn("line parsed but not handled: "+Y);break}}}M&&!M.relurl?(m.pop(),W-=M.duration,y.partList&&(y.fragmentHint=M)):y.partList&&(g(K,M),K.cc=_,y.fragmentHint=K);var de=m.length,ce=m[0],Q=m[de-1];if(W+=y.skippedSegments*y.targetduration,W>0&&de&&Q){y.averagetargetduration=W/de;var Z=Q.sn;y.endSN=Z!=="initSegment"?Z:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(te){return te.relurl&&a(te.relurl)})&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(o,h),K.relurl=Q.relurl,K.level=d,K.sn="initSegment",ce.initSegment=K,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=_,be>0&&v(m,be),y},D}();function u(D,T){["video","audio","text"].forEach(function(f){var h=D.filter(function(o){return Object(p.isCodecType)(o,f)});if(h.length){var d=h.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[f+"Codec"]=d.length>0?d[0]:h[0],D=D.filter(function(o){return h.indexOf(o)===-1})}}),T.unknownCodecs=D}function A(D,T,f){var h=T[f];h&&(D[f]=h)}function v(D,T){for(var f=D[T],h=T;h--;){var d=D[h];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function g(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(z.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/m3u8-parser.ts"),C=L("./src/types/loader.ts"),c=L("./src/utils/attr-list.ts");function p(b){var x=b.type;switch(x){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function R(b,x){var l=b.url;return(l===void 0||l.indexOf("data:")===0)&&(l=x.url),l}var w=function(){function b(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var x=b.prototype;return x.registerListeners=function(){var a=this.hls;a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(a){var s=this.hls.config,u=s.pLoader,A=s.loader,v=u||A,g=new v(s);return a.loader=g,this.loaders[a.type]=g,g},x.getInternalLoader=function(a){return this.loaders[a.type]},x.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},x.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.onManifestLoading=function(a,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},x.onLevelLoading=function(a,s){var u=s.id,A=s.level,v=s.url,g=s.deliveryDirectives;this.load({id:u,groupId:null,level:A,responseType:"text",type:C.PlaylistContextType.LEVEL,url:v,deliveryDirectives:g})},x.onAudioTrackLoading=function(a,s){var u=s.id,A=s.groupId,v=s.url,g=s.deliveryDirectives;this.load({id:u,groupId:A,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:g})},x.onSubtitleTrackLoading=function(a,s){var u=s.id,A=s.groupId,v=s.url,g=s.deliveryDirectives;this.load({id:u,groupId:A,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:g})},x.load=function(a){var s,u=this.hls.config,A=this.getInternalLoader(a);if(A){var v=A.context;if(v&&v.url===a.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),A.abort()}var g,D,T,f;switch(a.type){case C.PlaylistContextType.MANIFEST:g=u.manifestLoadingMaxRetry,D=u.manifestLoadingTimeOut,T=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:g=0,D=u.levelLoadingTimeOut;break;default:g=u.levelLoadingMaxRetry,D=u.levelLoadingTimeOut,T=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var h;if(a.type===C.PlaylistContextType.LEVEL&&a.level!==null?h=this.hls.levels[a.level].details:a.type===C.PlaylistContextType.AUDIO_TRACK&&a.id!==null?h=this.hls.audioTracks[a.id].details:a.type===C.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(h=this.hls.subtitleTracks[a.id].details),h){var d=h.partTarget,o=h.targetduration;d&&o&&(D=Math.min(Math.max(d*3,o*.8)*1e3,D))}}var E={timeout:D,maxRetry:g,retryDelay:T,maxRetryDelay:f,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};A.load(a,E,y)},x.loadsuccess=function(a,s,u,A){if(A===void 0&&(A=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,s,u,A);return}this.resetInternalLoader(u.type);var v=a.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",A);return}s.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,u,A):this.handleMasterPlaylist(a,s,u,A)},x.loaderror=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,a)},x.loadtimeout=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},x.handleMasterPlaylist=function(a,s,u,A){var v=this.hls,g=a.data,D=R(a,u),T=P.default.parseMasterPlaylist(g,D),f=T.levels,h=T.sessionData;if(!f.length){this.handleManifestParsingError(a,u,"no level found in manifest",A);return}var d=f.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),o=f.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),E=P.default.parseMasterPlaylistMedia(g,D,"AUDIO",d),y=P.default.parseMasterPlaylistMedia(g,D,"SUBTITLES",o),m=P.default.parseMasterPlaylistMedia(g,D,"CLOSED-CAPTIONS");if(E.length){var k=E.some(function(I){return!I.url});!k&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}v.trigger(F.Events.MANIFEST_LOADED,{levels:f,audioTracks:E,subtitles:y,captions:m,url:D,stats:s,networkDetails:A,sessionData:h})},x.handleTrackOrLevelPlaylist=function(a,s,u,A){var v=this.hls,g=u.id,D=u.level,T=u.type,f=R(a,u),h=Object(z.isFiniteNumber)(g)?g:0,d=Object(z.isFiniteNumber)(D)?D:h,o=p(u),E=P.default.parseLevelPlaylist(a.data,f,d,o,h);if(!E.fragments.length){v.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(T===C.PlaylistContextType.MANIFEST){var y={attrs:new c.AttrList({}),bitrate:0,details:E,name:"",url:f};v.trigger(F.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:f,stats:s,networkDetails:A,sessionData:null})}if(s.parsing.end=performance.now(),E.needSidxRanges){var m,k=(m=E.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:k,isSidxRequest:!0,type:T,level:D,levelDetails:E,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=E,this.handlePlaylistLoaded(a,s,u,A)},x.handleSidxRequest=function(a,s){var u=Object(N.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var A=u.references,v=s.levelDetails;A.forEach(function(g,D){var T=g.info,f=v.fragments[D];f.byteRange.length===0&&f.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(a,s,u,A){this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===C.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:s,networkDetails:A})},x.handleNetworkError=function(a,s,u,A){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var v=O.ErrorDetails.UNKNOWN,g=!1,D=this.getInternalLoader(a);switch(a.type){case C.PlaylistContextType.MANIFEST:v=u?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case C.PlaylistContextType.LEVEL:v=u?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case C.PlaylistContextType.AUDIO_TRACK:v=u?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:v=u?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}D&&this.resetInternalLoader(a.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:v,fatal:g,url:a.url,loader:D,context:a,networkDetails:s};A&&(T.response=A),this.hls.trigger(F.Events.ERROR,T)},x.handlePlaylistLoaded=function(a,s,u,A){var v=u.type,g=u.level,D=u.id,T=u.groupId,f=u.loader,h=u.levelDetails,d=u.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",A);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(v){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:h,level:g||0,id:D||0,stats:s,networkDetails:A,deliveryDirectives:d});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:h,id:D||0,groupId:T||"",stats:s,networkDetails:A,deliveryDirectives:d});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:h,id:D||0,groupId:T||"",stats:s,networkDetails:A,deliveryDirectives:d});break}},b}();H.default=w},"./src/polyfills/number.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"isFiniteNumber",function(){return z}),L.d(H,"MAX_SAFE_INTEGER",function(){return F});var z=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,H,L){"use strict";L.r(H);var z=function(){function F(){}return F.getSilentFrame=function(B,N){switch(B){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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},F}();H.default=z},"./src/remux/mp4-generator.ts":function(J,H,L){"use strict";L.r(H);var z=Math.pow(2,32)-1,F=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in O.types)O.types.hasOwnProperty(N)&&(O.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var P=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]),C=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:P,audio:C};var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=p,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,R,b,R,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,c))},O.box=function(N){for(var P=8,C=arguments.length,c=new Array(C>1?C-1:0),p=1;p<C;p++)c[p-1]=arguments[p];for(var R=c.length,w=R;R--;)P+=c[R].byteLength;var b=new Uint8Array(P);for(b[0]=P>>24&255,b[1]=P>>16&255,b[2]=P>>8&255,b[3]=P&255,b.set(N,4),R=0,P=8;R<w;R++)b.set(c[R],P),P+=c[R].byteLength;return b},O.hdlr=function(N){return O.box(O.types.hdlr,O.HDLR_TYPES[N])},O.mdat=function(N){return O.box(O.types.mdat,N)},O.mdhd=function(N,P){P*=N;var C=Math.floor(P/(z+1)),c=Math.floor(P%(z+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,C>>24,C>>16&255,C>>8&255,C&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},O.mdia=function(N){return O.box(O.types.mdia,O.mdhd(N.timescale,N.duration),O.hdlr(N.type),O.minf(N))},O.mfhd=function(N){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},O.minf=function(N){return N.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(N)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(N))},O.moof=function(N,P,C){return O.box(O.types.moof,O.mfhd(N),O.traf(C,P))},O.moov=function(N){for(var P=N.length,C=[];P--;)C[P]=O.trak(N[P]);return O.box.apply(null,[O.types.moov,O.mvhd(N[0].timescale,N[0].duration)].concat(C).concat(O.mvex(N)))},O.mvex=function(N){for(var P=N.length,C=[];P--;)C[P]=O.trex(N[P]);return O.box.apply(null,[O.types.mvex].concat(C))},O.mvhd=function(N,P){P*=N;var C=Math.floor(P/(z+1)),c=Math.floor(P%(z+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,C>>24,C>>16&255,C>>8&255,C&255,c>>24,c>>16&255,c>>8&255,c&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,p)},O.sdtp=function(N){var P=N.samples||[],C=new Uint8Array(4+P.length),c,p;for(c=0;c<P.length;c++)p=P[c].flags,C[c+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return O.box(O.types.sdtp,C)},O.stbl=function(N){return O.box(O.types.stbl,O.stsd(N),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(N){var P=[],C=[],c,p,R;for(c=0;c<N.sps.length;c++)p=N.sps[c],R=p.byteLength,P.push(R>>>8&255),P.push(R&255),P=P.concat(Array.prototype.slice.call(p));for(c=0;c<N.pps.length;c++)p=N.pps[c],R=p.byteLength,C.push(R>>>8&255),C.push(R&255),C=C.concat(Array.prototype.slice.call(p));var w=O.box(O.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|N.sps.length].concat(P).concat([N.pps.length]).concat(C))),b=N.width,x=N.height,l=N.pixelRatio[0],a=N.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>8&255,b&255,x>>8&255,x&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,a>>24,a>>16&255,a>>8&255,a&255])))},O.esds=function(N){var P=N.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(N.config).concat([6,1,2]))},O.mp4a=function(N){var P=N.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),O.box(O.types.esds,O.esds(N)))},O.mp3=function(N){var P=N.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},O.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(N)):O.box(O.types.stsd,O.STSD,O.mp4a(N)):O.box(O.types.stsd,O.STSD,O.avc1(N))},O.tkhd=function(N){var P=N.id,C=N.duration*N.timescale,c=N.width,p=N.height,R=Math.floor(C/(z+1)),w=Math.floor(C%(z+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,c>>8&255,c&255,0,0,p>>8&255,p&255,0,0]))},O.traf=function(N,P){var C=O.sdtp(N),c=N.id,p=Math.floor(P/(z+1)),R=Math.floor(P%(z+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,R>>24,R>>16&255,R>>8&255,R&255])),O.trun(N,C.length+16+20+8+16+8+8),C)},O.trak=function(N){return N.duration=N.duration||4294967295,O.box(O.types.trak,O.tkhd(N),O.mdia(N))},O.trex=function(N){var P=N.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(N,P){var C=N.samples||[],c=C.length,p=12+16*c,R=new Uint8Array(p),w,b,x,l,a,s;for(P+=8+p,R.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),w=0;w<c;w++)b=C[w],x=b.duration,l=b.size,a=b.flags,s=b.cts,R.set([x>>>24&255,x>>>16&255,x>>>8&255,x&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*w);return O.box(O.types.trun,R)},O.initSegment=function(N){O.types||O.init();var P=O.moov(N),C=new Uint8Array(O.FTYP.byteLength+P.byteLength);return C.set(O.FTYP),C.set(P,O.FTYP.byteLength),C},O}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,H.default=F},"./src/remux/mp4-remuxer.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return s}),L.d(H,"normalizePts",function(){return u});var z=L("./src/polyfills/number.ts"),F=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),N=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),C=L("./src/types/loader.ts"),c=L("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(D[h]=f[h])}return D},p.apply(this,arguments)}var R=10*1e3,w=1024,b=1152,x=null,l=null,a=!1,s=function(){function D(f,h,d,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=h,this.typeSupported=d,this.ISGenerated=!1,x===null){var E=navigator.userAgent||"",y=E.match(/Chrome\/(\d+)/i);x=y?parseInt(y[1]):0}if(l===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);l=m?parseInt(m[1]):0}a=!!x&&x<75||!!l&&l<600}var T=D.prototype;return T.destroy=function(){},T.resetTimeStamp=function(h){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},T.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(h){var d=!1,o=h.reduce(function(E,y){var m=y.pts-E;return m<-4294967296?(d=!0,u(E,y.pts)):m>0?E:y.pts},h[0].pts);return d&&P.logger.debug("PTS rollover detected"),o},T.remux=function(h,d,o,E,y,m,k,I){var U,W,_,M,K,Y,q=y,oe=y,be=h.pid>-1,me=d.pid>-1,he=d.samples.length,fe=h.samples.length>0,ue=he>1,ie=(!be||fe)&&(!me||ue)||this.ISGenerated||k;if(ie){this.ISGenerated||(_=this.generateIS(h,d,y));var pe=this.isVideoContiguous,$=-1;if(ue&&($=A(d.samples),!pe&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){P.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+he+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(d.samples);d.samples=d.samples.slice($),d.dropped+=$,oe+=(d.samples[0].pts-ae)/(d.timescale||9e4)}else $===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),Y=!1);if(this.ISGenerated){if(fe&&ue){var ee=this.getVideoStartPts(d.samples),Ee=u(h.samples[0].pts,ee)-ee,Ce=Ee/d.inputTimeScale;q+=Math.max(0,Ce),oe+=Math.max(0,-Ce)}if(fe){if(h.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(h,d,y)),W=this.remuxAudio(h,q,this.isAudioContiguous,m,me||ue||I===C.PlaylistLevelType.AUDIO?oe:void 0),ue){var ve=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(h,d,y)),U=this.remuxVideo(d,oe,pe,ve)}}else ue&&(U=this.remuxVideo(d,oe,pe,0));U&&(U.firstKeyFrame=$,U.independent=$!==-1)}}return this.ISGenerated&&(o.samples.length&&(K=this.remuxID3(o,y)),E.samples.length&&(M=this.remuxText(E,y))),{audio:W,video:U,initSegment:_,independent:Y,text:M,id3:K}},T.generateIS=function(h,d,o){var E=h.samples,y=d.samples,m=this.typeSupported,k={},I=!Object(z.isFiniteNumber)(this._initPTS),U="audio/mp4",W,_,M;if(I&&(W=_=Infinity),h.config&&E.length&&(h.timescale=h.samplerate,h.isAAC||(m.mpeg?(U="audio/mpeg",h.codec=""):m.mp3&&(h.codec="mp3")),k.audio={id:"audio",container:U,codec:h.codec,initSegment:!h.isAAC&&m.mpeg?new Uint8Array(0):O.default.initSegment([h]),metadata:{channelCount:h.channelCount}},I&&(M=h.inputTimeScale,W=_=E[0].pts-Math.round(M*o))),d.sps&&d.pps&&y.length&&(d.timescale=d.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:O.default.initSegment([d]),metadata:{width:d.width,height:d.height}},I)){M=d.inputTimeScale;var K=this.getVideoStartPts(y),Y=Math.round(M*o);_=Math.min(_,u(y[0].dts,K)-Y),W=Math.min(W,K-Y)}if(Object.keys(k).length)return this.ISGenerated=!0,I&&(this._initPTS=W,this._initDTS=_),{tracks:k,initPTS:W,timescale:M}},T.remuxVideo=function(h,d,o,E){var y=h.inputTimeScale,m=h.samples,k=[],I=m.length,U=this._initPTS,W=this.nextAvcDts,_=8,M,K,Y,q=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,be=0,me=!1;if(!o||W===null){var he=d*y,fe=m[0].pts-u(m[0].dts,m[0].pts);W=he-fe}for(var ue=0;ue<I;ue++){var ie=m[ue];if(ie.pts=u(ie.pts-U,W),ie.dts=u(ie.dts-U,W),ie.dts>ie.pts){var pe=9e4*.2;be=Math.max(Math.min(be,ie.pts-ie.dts),-1*pe)}ie.dts<m[ue>0?ue-1:ue].dts&&(me=!0)}me&&m.sort(function(ht,it){var Qe=ht.dts-it.dts,vt=ht.pts-it.pts;return Qe||vt}),K=m[0].dts,Y=m[m.length-1].dts;var $=Math.round((Y-K)/(I-1));if(be<0){if(be<$*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ae=be,ee=0;ee<I;ee++)m[ee].dts=ae=Math.max(ae,m[ee].pts-$),m[ee].pts=Math.max(ae,m[ee].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(be,!0)+" ms to overcome this issue");for(var Ee=0;Ee<I;Ee++)m[Ee].dts=m[Ee].dts+be}K=m[0].dts}if(o){var Ce=K-W,ve=Ce>$,Se=Ce<-1;if(ve||Se){ve?P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),K=W;var Re=m[0].pts-Ce;m[0].dts=K,m[0].pts=Re,P.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(Re,!0)+"/"+Object(c.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(Ce,!0)+" ms")}}a&&(K=Math.max(0,K));for(var Ne=0,_e=0,Pe=0;Pe<I;Pe++){for(var ke=m[Pe],Ze=ke.units,Ge=Ze.length,Ve=0,We=0;We<Ge;We++)Ve+=Ze[We].data.length;_e+=Ve,Ne+=Ge,ke.length=Ve,ke.dts=Math.max(ke.dts,K),ke.pts=Math.max(ke.pts,ke.dts,0),q=Math.min(ke.pts,q),oe=Math.max(ke.pts,oe)}Y=m[I-1].dts;var rt=_e+4*Ne+8,Xe;try{Xe=new Uint8Array(rt)}catch(ht){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var $e=new DataView(Xe.buffer);$e.setUint32(0,rt),Xe.set(O.default.types.mdat,4);for(var we=0;we<I;we++){for(var qe=m[we],Ye=qe.units,Ae=0,Me=0,ge=Ye.length;Me<ge;Me++){var de=Ye[Me],ce=de.data,Q=de.data.byteLength;$e.setUint32(_,Q),_+=4,Xe.set(ce,_),_+=Q,Ae+=4+Q}if(we<I-1)M=m[we+1].dts-qe.dts;else{var Z=this.config,te=qe.dts-m[we>0?we-1:we].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Z.maxBufferHole*y),Te=(E?q+E*y:this.nextAudioPts)-qe.pts;Te>se?(M=Te-te,M<0&&(M=te),P.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=te}else M=te}var De=Math.round(qe.pts-qe.dts);k.push(new v(qe.key,M,Ae,De))}if(k.length&&x&&x<70){var Be=k[0].flags;Be.dependsOn=2,Be.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+M,this.isVideoContiguous=!0;var et=O.default.moof(h.sequenceNumber++,K,p({},h,{samples:k})),ut="video",Le={data1:et,data2:Xe,startPTS:q/y,endPTS:(oe+M)/y,startDTS:K/y,endDTS:W/y,type:ut,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),Le},T.remuxAudio=function(h,d,o,E,y){var m=h.inputTimeScale,k=h.samplerate?h.samplerate:m,I=m/k,U=h.isAAC?w:b,W=U*I,_=this._initPTS,M=!h.isAAC&&this.typeSupported.mpeg,K=[],Y=h.samples,q=M?0:8,oe=this.nextAudioPts||-1,be=d*m;if(this.isAudioContiguous=o=o||Y.length&&oe>0&&(E&&Math.abs(be-oe)<9e3||Math.abs(u(Y[0].pts-_,be)-oe)<20*W),Y.forEach(function(ce){ce.pts=u(ce.pts-_,be)}),!o||oe<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;y===0?oe=0:E?oe=Math.max(0,be):oe=Y[0].pts}if(h.isAAC)for(var me=y!==void 0,he=this.config.maxAudioFramesDrift,fe=0,ue=oe;fe<Y.length;fe++){var ie=Y[fe],pe=ie.pts,$=pe-ue,ae=Math.abs(1e3*$/m);if($<=-he*W&&me)fe===0&&(P.logger.warn("Audio frame @ "+(pe/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/m)+" ms."),this.nextAudioPts=oe=ue=pe);else if($>=he*W&&ae<R&&me){var ee=Math.round($/W);ue=pe-ee*W,ue<0&&(ee--,ue+=W),fe===0&&(this.nextAudioPts=oe=ue),P.logger.warn("[mp4-remuxer]: Injecting "+ee+" audio frame @ "+(ue/m).toFixed(3)+"s due to "+Math.round(1e3*$/m)+" ms gap.");for(var Ee=0;Ee<ee;Ee++){var Ce=Math.max(ue,0),ve=F.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);ve||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ie.unit.subarray()),Y.splice(fe,0,{unit:ve,pts:Ce}),ue+=W,fe++}}ie.pts=ue,ue+=W}for(var Se=null,Re=null,Ne,_e=0,Pe=Y.length;Pe--;)_e+=Y[Pe].unit.byteLength;for(var ke=0,Ze=Y.length;ke<Ze;ke++){var Ge=Y[ke],Ve=Ge.unit,We=Ge.pts;if(Re!==null){var rt=K[ke-1];rt.duration=Math.round((We-Re)/I)}else if(o&&h.isAAC&&(We=oe),Se=We,_e>0){_e+=q;try{Ne=new Uint8Array(_e)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!M){var Xe=new DataView(Ne.buffer);Xe.setUint32(0,_e),Ne.set(O.default.types.mdat,4)}}else return;Ne.set(Ve,q);var $e=Ve.byteLength;q+=$e,K.push(new v(!0,U,$e,0)),Re=We}var we=K.length;if(!we)return;var qe=K[K.length-1];this.nextAudioPts=oe=Re+I*qe.duration;var Ye=M?new Uint8Array(0):O.default.moof(h.sequenceNumber++,Se/I,p({},h,{samples:K}));h.samples=[];var Ae=Se/m,Me=oe/m,ge="audio",de={data1:Ye,data2:Ne,startPTS:Ae,endPTS:Me,startDTS:Ae,endDTS:Me,type:ge,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(Ne.length,"MDAT length must not be zero"),de},T.remuxEmptyAudio=function(h,d,o,E){var y=h.inputTimeScale,m=h.samplerate?h.samplerate:y,k=y/m,I=this.nextAudioPts,U=(I!==null?I:E.startDTS*y)+this._initDTS,W=E.endDTS*y+this._initDTS,_=k*w,M=Math.ceil((W-U)/_),K=F.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){P.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<M;q++){var oe=U+q*_;Y.push({unit:K,pts:oe,dts:oe})}return h.samples=Y,this.remuxAudio(h,d,o,!1)},T.remuxID3=function(h,d){var o=h.samples.length;if(!o)return;for(var E=h.inputTimeScale,y=this._initPTS,m=this._initDTS,k=0;k<o;k++){var I=h.samples[k];I.pts=u(I.pts-y,d*E)/E,I.dts=u(I.dts-m,d*E)/E}var U=h.samples;return h.samples=[],{samples:U}},T.remuxText=function(h,d){var o=h.samples.length;if(!o)return;for(var E=h.inputTimeScale,y=this._initPTS,m=0;m<o;m++){var k=h.samples[m];k.pts=u(k.pts-y,d*E)/E}h.samples.sort(function(U,W){return U.pts-W.pts});var I=h.samples;return h.samples=[],{samples:I}},D}();function u(D,T){var f;if(T===null)return D;for(T<D?f=-8589934592:f=8589934592;Math.abs(D-T)>4294967296;)D+=f;return D}function A(D){for(var T=0;T<D.length;T++)if(D[T].key)return T;return-1}var v=function(T,f,h,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=h,this.cts=d,this.flags=new g(T)},g=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/polyfills/number.ts"),F=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),N=function(){function c(){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 p=c.prototype;return p.destroy=function(){},p.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(w,b,x){this.audioCodec=b,this.videoCodec=x,this.generateInitSegment(w),this.emitInitSegment=!0},p.generateInitSegment=function(w){var b=this.audioCodec,x=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(F.parseInitSegment)(w);b||(b=C(l.audio,O.ElementaryStreamTypes.AUDIO)),x||(x=C(l.video,O.ElementaryStreamTypes.VIDEO));var a={};l.audio&&l.video?a.audiovideo={container:"video/mp4",codec:b+","+x,initSegment:w,id:"main"}:l.audio?a.audio={container:"audio/mp4",codec:b,initSegment:w,id:"audio"}:l.video?a.video={container:"video/mp4",codec:x,initSegment:w,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(w,b,x,l,a){var s=this.initPTS,u=this.lastEndDTS,A={audio:void 0,video:void 0,text:l,id3:x,initSegment:void 0};Object(z.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var v=b.samples;if(!v||!v.length)return A;var g={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(v),D=this.initData),!D||!D.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=g.initPTS=s=P(D,v,u));var T=Object(F.getDuration)(v,D),f=u,h=T+f;Object(F.offsetStartDTS)(D,v,s),T>0?this.lastEndDTS=h:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!D.audio,o=!!D.video,E="";d&&(E+="audio"),o&&(E+="video");var y={data1:v,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:E,hasAudio:d,hasVideo:o,nb:1,dropped:0};return A.audio=y.type==="audio"?y:void 0,A.video=y.type!=="audio"?y:void 0,A.text=l,A.id3=x,A.initSegment=g,A},c}(),P=function(p,R,w){return Object(F.getStartDTS)(p,R)-w};function C(c,p){var R=c==null?void 0:c.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||p===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}H.default=N},"./src/task-loop.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return z});var z=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=F.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},F}()},"./src/types/cmcd.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"CMCDVersion",function(){return z}),L.d(H,"CMCDObjectType",function(){return F}),L.d(H,"CMCDStreamingFormat",function(){return O}),L.d(H,"CMCDStreamType",function(){return B});var z=1,F;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(F||(F={}));var O;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(O||(O={}));var B;(function(N){N.VOD="v",N.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"HlsSkip",function(){return O}),L.d(H,"getSkipValue",function(){return B}),L.d(H,"HlsUrlParameters",function(){return N}),L.d(H,"Level",function(){return P});function z(C,c){for(var p=0;p<c.length;p++){var R=c[p];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(C,R.key,R)}}function F(C,c,p){return c&&z(C.prototype,c),p&&z(C,p),C}var O;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(O||(O={}));function B(C,c){var p=C.canSkipUntil,R=C.canSkipDateRanges,w=C.endSN,b=c!==void 0?c-w:0;return p&&b<p?R?O.v2:O.Yes:O.No}var N=function(){function C(p,R,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=R,this.skip=w}var c=C.prototype;return c.addDirectives=function(R){var w=new self.URL(R);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},C}(),P=function(){function C(c){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=[c.url],this.attrs=c.attrs,this.bitrate=c.bitrate,c.details&&(this.details=c.details),this.id=c.id||0,this.name=c.name,this.width=c.width||0,this.height=c.height||0,this.audioCodec=c.audioCodec,this.videoCodec=c.videoCodec,this.unknownCodecs=c.unknownCodecs,this.codecSet=[c.videoCodec,c.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return F(C,[{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(p){var R=p%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),C}()},"./src/types/loader.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"PlaylistContextType",function(){return z}),L.d(H,"PlaylistLevelType",function(){return F});var z;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var F;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"ChunkMetadata",function(){return z});var z=function(B,N,P,C,c,p){C===void 0&&(C=0),c===void 0&&(c=-1),p===void 0&&(p=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=B,this.sn=N,this.id=P,this.size=C,this.part=c,this.partial=p};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"AttrList",function(){return O});var z=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function B(P){typeof P=="string"&&(P=B.parseAttrList(P));for(var C in P)P.hasOwnProperty(C)&&(this[C]=P[C])}var N=B.prototype;return N.decimalInteger=function(C){var c=parseInt(this[C],10);return c>Number.MAX_SAFE_INTEGER?Infinity:c},N.hexadecimalInteger=function(C){if(this[C]){var c=(this[C]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var p=new Uint8Array(c.length/2),R=0;R<c.length/2;R++)p[R]=parseInt(c.slice(R*2,R*2+2),16);return p}else return null},N.hexadecimalIntegerAsNumber=function(C){var c=parseInt(this[C],16);return c>Number.MAX_SAFE_INTEGER?Infinity:c},N.decimalFloatingPoint=function(C){return parseFloat(this[C])},N.optionalFloat=function(C,c){var p=this[C];return p?parseFloat(p):c},N.enumeratedString=function(C){return this[C]},N.bool=function(C){return this[C]==="YES"},N.decimalResolution=function(C){var c=z.exec(this[C]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},B.parseAttrList=function(C){var c,p={},R='"';for(F.lastIndex=0;(c=F.exec(C))!==null;){var w=c[2];w.indexOf(R)===0&&w.lastIndexOf(R)===w.length-1&&(w=w.slice(1,-1)),p[c[1]]=w}return p},B}()},"./src/utils/binary-search.ts":function(J,H,L){"use strict";L.r(H);var z={search:function(O,B){for(var N=0,P=O.length-1,C=null,c=null;N<=P;){C=(N+P)/2|0,c=O[C];var p=B(c);if(p>0)N=C+1;else if(p<0)P=C-1;else return c}return null}};H.default=z},"./src/utils/buffer-helper.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"BufferHelper",function(){return O});var z=L("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function B(){}return B.isBuffered=function(P,C){try{if(P){for(var c=B.getBuffered(P),p=0;p<c.length;p++)if(C>=c.start(p)&&C<=c.end(p))return!0}}catch(R){}return!1},B.bufferInfo=function(P,C,c){try{if(P){var p=B.getBuffered(P),R=[],w;for(w=0;w<p.length;w++)R.push({start:p.start(w),end:p.end(w)});return this.bufferedInfo(R,C,c)}}catch(b){}return{len:0,start:C,end:C,nextStart:void 0}},B.bufferedInfo=function(P,C,c){C=Math.max(0,C),P.sort(function(g,D){var T=g.start-D.start;return T||D.end-g.end});var p=[];if(c)for(var R=0;R<P.length;R++){var w=p.length;if(w){var b=p[w-1].end;P[R].start-b<c?P[R].end>b&&(p[w-1].end=P[R].end):p.push(P[R])}else p.push(P[R])}else p=P;for(var x=0,l,a=C,s=C,u=0;u<p.length;u++){var A=p[u].start,v=p[u].end;if(C+c>=A&&C<v)a=A,s=v,x=s-C;else if(C+c<A){l=A;break}}return{len:x,start:a||0,end:s||0,nextStart:l}},B.getBuffered=function(P){try{return P.buffered}catch(C){return z.logger.log("failed to get media.buffered",C),F}},B}()},"./src/utils/cea-608-parser.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"Row",function(){return s}),L.d(H,"CaptionScreen",function(){return u});var z=L("./src/utils/logger.ts"),F={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(h){var d=h;return F.hasOwnProperty(h)&&(d=F[h]),String.fromCharCode(d)},B=15,N=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(w||(w={}));var b=function(){function f(){this.time=null,this.verboseLevel=w.ERROR}var h=f.prototype;return h.log=function(o,E){this.verboseLevel>=o&&z.logger.log(this.time+" ["+o+"] "+E)},f}(),x=function(h){for(var d=[],o=0;o<h.length;o++)d.push(h[o].toString(16));return d},l=function(){function f(d,o,E,y,m){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=o||!1,this.italics=E||!1,this.background=y||"black",this.flash=m||!1}var h=f.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(o){for(var E=["foreground","underline","italics","background","flash"],y=0;y<E.length;y++){var m=E[y];o.hasOwnProperty(m)&&(this[m]=o[m])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},h.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),a=function(){function f(d,o,E,y,m,k){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new l(o,E,y,m,k)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(o,E){this.uchar=o,this.penState.copy(E)},h.setPenState=function(o){this.penState.copy(o)},h.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},h.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),s=function(){function f(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<N;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new l}var h=f.prototype;return h.equals=function(o){for(var E=!0,y=0;y<N;y++)if(!this.chars[y].equals(o.chars[y])){E=!1;break}return E},h.copy=function(o){for(var E=0;E<N;E++)this.chars[E].copy(o.chars[E])},h.isEmpty=function(){for(var o=!0,E=0;E<N;E++)if(!this.chars[E].isEmpty()){o=!1;break}return o},h.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},h.moveCursor=function(o){var E=this.pos+o;if(o>1)for(var y=this.pos+1;y<E+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(E)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(o){o>=144&&this.backSpace();var E=O(o);if(this.pos>=N){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(o){var E;for(E=o;E<N;E++)this.chars[E].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var o=[],E=!0,y=0;y<N;y++){var m=this.chars[y].uchar;m!==" "&&(E=!1),o.push(m)}return E?"":o.join("")},h.setPenStyles=function(o){this.currPenState.setStyles(o);var E=this.chars[this.pos];E.setPenState(this.currPenState)},f}(),u=function(){function f(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<B;o++)this.rows.push(new s(d));this.logger=d,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=f.prototype;return h.reset=function(){for(var o=0;o<B;o++)this.rows[o].clear();this.currRow=B-1},h.equals=function(o){for(var E=!0,y=0;y<B;y++)if(!this.rows[y].equals(o.rows[y])){E=!1;break}return E},h.copy=function(o){for(var E=0;E<B;E++)this.rows[E].copy(o.rows[E])},h.isEmpty=function(){for(var o=!0,E=0;E<B;E++)if(!this.rows[E].isEmpty()){o=!1;break}return o},h.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},h.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},h.insertChar=function(o){var E=this.rows[this.currRow];E.insertChar(o)},h.setPen=function(o){var E=this.rows[this.currRow];E.setPenStyles(o)},h.moveCursor=function(o){var E=this.rows[this.currRow];E.moveCursor(o)},h.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var E=this.rows[this.currRow];E.setCursor(o)},h.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var E=o.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var y=0;y<B;y++)this.rows[y].clear();var m=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var I=k.rows[m].cueStartTime,U=this.logger.time;if(I&&U!==null&&I<U)for(var W=0;W<this.nrRollUpRows;W++)this.rows[E-this.nrRollUpRows+W+1].copy(k.rows[m+W])}}this.currRow=E;var _=this.rows[this.currRow];if(o.indent!==null){var M=o.indent,K=Math.max(M-1,0);_.setCursor(o.indent),o.color=_.chars[K].penState.foreground}var Y={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(Y)},h.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},h.setRollUpRows=function(o){this.nrRollUpRows=o},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(o,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(w.INFO,"Rolling up")},h.getDisplayText=function(o){o=o||!1;for(var E=[],y="",m=-1,k=0;k<B;k++){var I=this.rows[k].getTextString();I&&(m=k+1,o?E.push("Row "+m+": '"+I+"'"):E.push(I.trim()))}return E.length>0&&(o?y="["+E.join(" | ")+"]":y=E.join(`
|
|
`)),y},h.getTextAndFormat=function(){return this.rows},f}(),A=function(){function f(d,o,E){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=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new u(E),this.nonDisplayedMemory=new u(E),this.lastOutputScreen=new u(E),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var h=f.prototype;return h.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},h.getHandler=function(){return this.outputFilter},h.setHandler=function(o){this.outputFilter=o},h.setPAC=function(o){this.writeScreen.setPAC(o)},h.setBkgData=function(o){this.writeScreen.setBkgData(o)},h.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},h.insertChars=function(o){for(var E=0;E<o.length;E++)this.writeScreen.insertChar(o[E]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},h.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},h.ccMIDROW=function(o){var E={flash:!1};if(E.underline=o%2===1,E.italics=o>=46,E.italics)E.foreground="white";else{var y=Math.floor(o/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=m[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},h.outputDataUpdate=function(o){o===void 0&&(o=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},f}(),v=function(){function f(d,o,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new b;this.channels=[null,new A(d,o,y),new A(d+1,E,y)],this.cmdHistory=T(),this.logger=y}var h=f.prototype;return h.getHandler=function(o){return this.channels[o].getHandler()},h.setHandler=function(o,E){this.channels[o].setHandler(E)},h.addData=function(o,E){var y,m,k,I=!1;this.logger.time=o;for(var U=0;U<E.length;U+=2){if(m=E[U]&127,k=E[U+1]&127,m===0&&k===0)continue;if(this.logger.log(w.DATA,"["+x([E[U],E[U+1]])+"] -> ("+x([m,k])+")"),y=this.parseCmd(m,k),y||(y=this.parseMidrow(m,k)),y||(y=this.parsePAC(m,k)),y||(y=this.parseBackgroundAttributes(m,k)),!y&&(I=this.parseChars(m,k),I)){var W=this.currentChannel;if(W&&W>0){var _=this.channels[W];_.insertChars(I)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!I&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+x([m,k])+" orig: "+x([E[U],E[U+1]]))}},h.parseCmd=function(o,E){var y=this.cmdHistory,m=(o===20||o===28||o===21||o===29)&&E>=32&&E<=47,k=(o===23||o===31)&&E>=33&&E<=35;if(!(m||k))return!1;if(D(o,E,y))return g(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+x([o,E])+") is dropped"),!0;var I=o===20||o===21||o===23?1:2,U=this.channels[I];return o===20||o===21||o===28||o===29?E===32?U.ccRCL():E===33?U.ccBS():E===34?U.ccAOF():E===35?U.ccAON():E===36?U.ccDER():E===37?U.ccRU(2):E===38?U.ccRU(3):E===39?U.ccRU(4):E===40?U.ccFON():E===41?U.ccRDC():E===42?U.ccTR():E===43?U.ccRTD():E===44?U.ccEDM():E===45?U.ccCR():E===46?U.ccENM():E===47&&U.ccEOC():U.ccTO(E-32),g(o,E,y),this.currentChannel=I,!0},h.parseMidrow=function(o,E){var y=0;if((o===17||o===25)&&E>=32&&E<=47){if(o===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[y];return m?(m.ccMIDROW(E),this.logger.log(w.DEBUG,"MIDROW ("+x([o,E])+")"),!0):!1}return!1},h.parsePAC=function(o,E){var y,m=this.cmdHistory,k=(o>=17&&o<=23||o>=25&&o<=31)&&E>=64&&E<=127,I=(o===16||o===24)&&E>=64&&E<=95;if(!(k||I))return!1;if(D(o,E,m))return g(null,null,m),!0;var U=o<=23?1:2;E>=64&&E<=95?y=U===1?P[o]:c[o]:y=U===1?C[o]:p[o];var W=this.channels[U];return W?(W.setPAC(this.interpretPAC(y,E)),g(o,E,m),this.currentChannel=U,!0):!1},h.interpretPAC=function(o,E){var y,m={color:null,italics:!1,indent:null,underline:!1,row:o};return E>95?y=E-96:y=E-64,m.underline=(y&1)===1,y<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((y-16)/2)*4,m},h.parseChars=function(o,E){var y,m=null,k=null;if(o>=25?(y=2,k=o-8):(y=1,k=o),k>=17&&k<=19){var I;k===17?I=E+80:k===18?I=E+112:I=E+144,this.logger.log(w.INFO,"Special char '"+O(I)+"' in channel "+y),m=[I]}else o>=32&&o<=127&&(m=E===0?[o]:[o,E]);if(m){var U=x(m);this.logger.log(w.DEBUG,"Char codes = "+U.join(",")),g(o,E,this.cmdHistory)}return m},h.parseBackgroundAttributes=function(o,E){var y=(o===16||o===24)&&E>=32&&E<=47,m=(o===23||o===31)&&E>=45&&E<=47;if(!(y||m))return!1;var k,I={};o===16||o===24?(k=Math.floor((E-32)/2),I.background=R[k],E%2===1&&(I.background=I.background+"_semi")):E===45?I.background="transparent":(I.foreground="black",E===47&&(I.underline=!0));var U=o<=23?1:2,W=this.channels[U];return W.setBkgData(I),g(o,E,this.cmdHistory),!0},h.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var E=this.channels[o];E&&E.reset()}this.cmdHistory=T()},h.cueSplitAtTime=function(o){for(var E=0;E<this.channels.length;E++){var y=this.channels[E];y&&y.cueSplitAtTime(o)}},f}();function g(f,h,d){d.a=f,d.b=h}function D(f,h,d){return d.a===f&&d.b===h}function T(){return{a:null,b:null}}H.default=v},"./src/utils/codecs.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"isCodecType",function(){return F}),L.d(H,"isCodecSupportedInMp4",function(){return O});var z={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 F(B,N){var P=z[N];return!!P&&P[B.slice(0,4)]===!0}function O(B,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/utils/vttparser.ts"),F=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),B=/\s/,N={newCue:function(C,c,p,R){for(var w=[],b,x,l,a,s,u=self.VTTCue||self.TextTrackCue,A=0;A<R.rows.length;A++)if(b=R.rows[A],l=!0,a=0,s="",!b.isEmpty()){for(var v=0;v<b.chars.length;v++)B.test(b.chars[v].uchar)&&l?a++:(s+=b.chars[v].uchar,l=!1);b.cueStartTime=c,c===p&&(p+=1e-4),a>=16?a--:a++;var g=Object(z.fixLineBreaks)(s.trim()),D=Object(F.generateCueId)(c,p,g);(!C||!C.cues||!C.cues.getCueById(D))&&(x=new u(c,p,g),x.id=D,x.line=A+1,x.align="left",x.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(x))}return C&&w.length&&(w.sort(function(T,f){return T.line==="auto"||f.line==="auto"?0:T.line>8&&f.line>8?f.line-T.line:T.line-f.line}),w.forEach(function(T){return Object(O.addCueToTrack)(C,T)})),w}};H.default=N},"./src/utils/discontinuities.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"findFirstFragWithCC",function(){return B}),L.d(H,"shouldAlignOnDiscontinuities",function(){return N}),L.d(H,"findDiscontinuousReferenceFrag",function(){return P}),L.d(H,"adjustSlidingStart",function(){return c}),L.d(H,"alignStream",function(){return p}),L.d(H,"alignPDT",function(){return w}),L.d(H,"alignFragmentByPDTDelta",function(){return b}),L.d(H,"alignMediaPlaylistByPDT",function(){return x});var z=L("./src/polyfills/number.ts"),F=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function B(l,a){for(var s=null,u=0,A=l.length;u<A;u++){var v=l[u];if(v&&v.cc===a){s=v;break}}return s}function N(l,a,s){return!!(a.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function P(l,a){var s=l.fragments,u=a.fragments;if(!u.length||!s.length){F.logger.log("No fragments to align");return}var A=B(s,u[0].cc);if(!A||A&&!A.startPTS){F.logger.log("No frag in previous level to align on");return}return A}function C(l,a){if(l){var s=l.start+a;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function c(l,a){for(var s=a.fragments,u=0,A=s.length;u<A;u++)C(s[u],l);a.fragmentHint&&C(a.fragmentHint,l),a.alignedSliding=!0}function p(l,a,s){if(!a)return;R(l,s,a),!s.alignedSliding&&a.details&&w(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(O.adjustSliding)(a.details,s)}function R(l,a,s){if(N(l,s,a)){var u=P(s.details,a);u&&Object(z.isFiniteNumber)(u.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),c(u.start,a))}}function w(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=l.fragments[0].programDateTime,A=(u-s)/1e3+a.fragments[0].start;A&&Object(z.isFiniteNumber)(A)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+A.toFixed(3)+" "+l.url+" "),c(A,l))}function b(l,a){var s=l.programDateTime;if(!s)return;var u=(s-a)/1e3;l.start=l.startPTS=u,l.endPTS=u+l.duration}function x(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=a.fragments[0].start,A=s-u*1e3;l.fragments.forEach(function(v){b(v,A)}),l.fragmentHint&&b(l.fragmentHint,A),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/utils/ewma.ts"),F=function(){function O(N,P,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(N),this.fast_=new z.default(P)}var B=O.prototype;return B.update=function(P,C){var c=this.slow_,p=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new z.default(P,c.getEstimate(),c.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new z.default(C,p.getEstimate(),p.getTotalWeight()))},B.sample=function(P,C){P=Math.max(P,this.minDelayMs_);var c=8*C,p=P/1e3,R=c/p;this.fast_.sample(p,R),this.slow_.sample(p,R)},B.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},O}();H.default=F},"./src/utils/ewma.ts":function(J,H,L){"use strict";L.r(H);var z=function(){function F(B,N,P){N===void 0&&(N=0),P===void 0&&(P=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_=N,this.totalWeight_=P}var O=F.prototype;return O.sample=function(N,P){var C=Math.pow(this.alpha_,N);this.estimate_=P*(1-C)+C*this.estimate_,this.totalWeight_+=N},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},F}();H.default=z},"./src/utils/fetch-loader.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"fetchSupported",function(){return b});var z=L("./src/polyfills/number.ts"),F=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function B(u,A){u.prototype=Object.create(A.prototype),u.prototype.constructor=u,p(u,A)}function N(u){var A=typeof Map=="function"?new Map:void 0;return N=function(g){if(g===null||!c(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof A!="undefined"){if(A.has(g))return A.get(g);A.set(g,D)}function D(){return P(g,arguments,R(this).constructor)}return D.prototype=Object.create(g.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),p(D,g)},N(u)}function P(u,A,v){return C()?P=Reflect.construct:P=function(D,T,f){var h=[null];h.push.apply(h,T);var d=Function.bind.apply(D,h),o=new d;return f&&p(o,f.prototype),o},P.apply(null,arguments)}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function c(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function p(u,A){return p=Object.setPrototypeOf||function(g,D){return g.__proto__=D,g},p(u,A)}function R(u){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},R(u)}function w(){return w=Object.assign||function(u){for(var A=1;A<arguments.length;A++){var v=arguments[A];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(u[g]=v[g])}return u},w.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var x=function(){function u(v){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=v.fetchSetup||a,this.controller=new self.AbortController,this.stats=new F.LoadStats}var A=u.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(g,D,T){var f=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var d=l(g,this.controller.signal),o=T.onProgress,E=g.responseType==="arraybuffer",y=E?"byteLength":"length";this.context=g,this.config=D,this.callbacks=T,this.request=this.fetchSetup(g,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),T.onTimeout(h,g,f.response)},D.timeout),self.fetch(this.request).then(function(m){if(f.response=f.loader=m,!m.ok){var k=m.status,I=m.statusText;throw new s(I||"fetch, bad network response",k,m)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(m.headers.get("Content-Length")||"0"),o&&Object(z.isFiniteNumber)(D.highWaterMark)?f.loadProgressively(m,h,g,D.highWaterMark,o):E?m.arrayBuffer():m.text()}).then(function(m){var k=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=m[y];var I={url:k.url,data:m};o&&!Object(z.isFiniteNumber)(D.highWaterMark)&&o(h,g,m,k),T.onSuccess(I,h,g,k)}).catch(function(m){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var k=m.code||0;T.onError({code:k,text:m.message},g,m.details)})},A.getCacheAge=function(){var g=null;if(this.response){var D=this.response.headers.get("age");g=D?parseFloat(D):null}return g},A.loadProgressively=function(g,D,T,f,h){f===void 0&&(f=0);var d=new O.default,o=g.body.getReader(),E=function y(){return o.read().then(function(m){if(m.done)return d.dataLength&&h(D,T,d.flush(),g),Promise.resolve(new ArrayBuffer(0));var k=m.value,I=k.length;return D.loaded+=I,I<f||d.dataLength?(d.push(k),d.dataLength>=f&&h(D,T,d.flush(),g)):h(D,T,k,g),y()}).catch(function(){return Promise.reject()})};return E()},u}();function l(u,A){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(w({},u.headers))};return u.rangeEnd&&v.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),v}function a(u,A){return new self.Request(u.url,A)}var s=function(u){B(A,u);function A(v,g,D){var T;return T=u.call(this,v)||this,T.code=void 0,T.details=void 0,T.code=g,T.details=D,T}return A}(N(Error));H.default=x},"./src/utils/imsc1-ttml-parser.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"IMSC1_CODEC",function(){return c}),L.d(H,"parseIMSC1",function(){return b});var z=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),P=L("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(f[o]=d[o])}return f},C.apply(this,arguments)}var c="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(f,h,d,o,E){var y=Object(z.findBox)(new Uint8Array(f),["mdat"]);if(y.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var m=y[0],k=Object(B.utf8ArrayToStr)(new Uint8Array(f,m.start,m.end-m.start)),I=Object(N.toTimescaleFromScale)(h,1,d);try{o(x(k,I))}catch(U){E(U)}}function x(f,h){var d=new DOMParser,o=d.parseFromString(f,"text/xml"),E=o.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(y).reduce(function(_,M){return _[M]=E.getAttribute("ttp:"+M)||y[M],_},{}),k=E.getAttribute("xml:space")!=="preserve",I=a(l(E,"styling","style")),U=a(l(E,"layout","region")),W=l(E,"body","[begin]");return[].map.call(W,function(_){var M=s(_,k);if(!M||!_.hasAttribute("begin"))return null;var K=g(_.getAttribute("begin"),m),Y=g(_.getAttribute("dur"),m),q=g(_.getAttribute("end"),m);if(K===null)throw v(_);if(q===null){if(Y===null)throw v(_);q=K+Y}var oe=new O.default(K-h,q-h,M);oe.id=Object(P.generateCueId)(oe.startTime,oe.endTime,oe.text);var be=U[_.getAttribute("region")],me=I[_.getAttribute("style")];oe.position=10,oe.size=80;var he=u(be,me),fe=he.textAlign;if(fe){var ue=w[fe];ue&&(oe.lineAlign=ue),oe.align=fe}return C(oe,he),oe}).filter(function(_){return _!==null})}function l(f,h,d){var o=f.getElementsByTagName(h)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(f){return f.reduce(function(h,d){var o=d.getAttribute("xml:id");return o&&(h[o]=d),h},{})}function s(f,h){return[].slice.call(f.childNodes).reduce(function(d,o,E){var y;return o.nodeName==="br"&&E?d+`
|
|
`:(y=o.childNodes)!==null&&y!==void 0&&y.length?s(o,h):h?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function u(f,h){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(E,y){var m=A(h,d,y)||A(f,d,y);return m&&(E[y]=m),E},{})}function A(f,h,d){return f.hasAttributeNS(h,d)?f.getAttributeNS(h,d):null}function v(f){return new Error("Could not parse ttml timestamp "+f)}function g(f,h){if(!f)return null;var d=Object(F.parseTimeStamp)(f);return d===null&&(p.test(f)?d=D(f,h):R.test(f)&&(d=T(f,h))),d}function D(f,h){var d=p.exec(f),o=(d[4]|0)+(d[5]|0)/h.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/h.frameRate}function T(f,h){var d=R.exec(f),o=Number(d[1]),E=d[2];switch(E){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/h.frameRate;case"t":return o/h.tickRate}return o}},"./src/utils/logger.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"enableLogs",function(){return P}),L.d(H,"logger",function(){return C});var z=function(){},F={trace:z,debug:z,log:z,warn:z,info:z,error:z},O=F;function B(c){var p=self.console[c];return p?p.bind(self.console,"["+c+"] >"):z}function N(c){for(var p=arguments.length,R=new Array(p>1?p-1:0),w=1;w<p;w++)R[w-1]=arguments[w];R.forEach(function(b){O[b]=c[b]?c[b].bind(c):B(b)})}function P(c){if(self.console&&c===!0||typeof c=="object"){N(c,"debug","log","info","warn","error");try{O.log()}catch(p){O=F}}else O=F}var C=O},"./src/utils/mediakeys-helper.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"KeySystems",function(){return z}),L.d(H,"requestMediaKeySystemAccess",function(){return F});var z;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(z||(z={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"bin2str",function(){return N}),L.d(H,"readUint16",function(){return P}),L.d(H,"readUint32",function(){return C}),L.d(H,"writeUint32",function(){return c}),L.d(H,"findBox",function(){return p}),L.d(H,"parseSegmentIndex",function(){return R}),L.d(H,"parseInitSegment",function(){return w}),L.d(H,"getStartDTS",function(){return b}),L.d(H,"getDuration",function(){return x}),L.d(H,"computeRawDurationFromSamples",function(){return l}),L.d(H,"offsetStartDTS",function(){return a}),L.d(H,"segmentValidRange",function(){return s}),L.d(H,"appendUint8Array",function(){return u});var z=L("./src/utils/typed-array.ts"),F=L("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,B=[].push;function N(A){return String.fromCharCode.apply(null,A)}function P(A,v){"data"in A&&(v+=A.start,A=A.data);var g=A[v]<<8|A[v+1];return g<0?65536+g:g}function C(A,v){"data"in A&&(v+=A.start,A=A.data);var g=A[v]<<24|A[v+1]<<16|A[v+2]<<8|A[v+3];return g<0?4294967296+g:g}function c(A,v,g){"data"in A&&(v+=A.start,A=A.data),A[v]=g>>24,A[v+1]=g>>16&255,A[v+2]=g>>8&255,A[v+3]=g&255}function p(A,v){var g=[];if(!v.length)return g;var D,T,f;"data"in A?(D=A.data,T=A.start,f=A.end):(D=A,T=0,f=D.byteLength);for(var h=T;h<f;){var d=C(D,h),o=N(D.subarray(h+4,h+8)),E=d>1?h+d:f;if(o===v[0])if(v.length===1)g.push({data:D,start:h+8,end:E});else{var y=p({data:D,start:h+8,end:E},v.slice(1));y.length&&B.apply(g,y)}h=E}return g}function R(A){var v=p(A,["moov"]),g=v[0],D=g?g.end:null,T=p(A,["sidx"]);if(!T||!T[0])return null;var f=[],h=T[0],d=h.data[0],o=d===0?8:16,E=C(h,o);o+=4;var y=0,m=0;d===0?o+=8:o+=16,o+=2;var k=h.end+m,I=P(h,o);o+=2;for(var U=0;U<I;U++){var W=o,_=C(h,W);W+=4;var M=_&2147483647,K=(_&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=C(h,W);W+=4,f.push({referenceSize:M,subsegmentDuration:Y,info:{duration:Y/E,start:k,end:k+M-1}}),k+=M,W+=4,o=W}return{earliestPresentationTime:y,timescale:E,version:d,referencesCount:I,references:f,moovEndOffset:D}}function w(A){for(var v=[],g=p(A,["moov","trak"]),D=0;D<g.length;D++){var T=g[D],f=p(T,["tkhd"])[0];if(f){var h=f.data[f.start],d=h===0?12:20,o=C(f,d),E=p(T,["mdia","mdhd"])[0];if(E){h=E.data[E.start],d=h===0?12:20;var y=C(E,d),m=p(T,["mdia","hdlr"])[0];if(m){var k=N(m.data.subarray(m.start+8,m.start+12)),I={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[k];if(I){var U=p(T,["mdia","minf","stbl","stsd"])[0],W=void 0;U&&(W=N(U.data.subarray(U.start+12,U.start+16))),v[o]={timescale:y,type:I},v[I]={timescale:y,id:o,codec:W}}}}}}var _=p(A,["moov","mvex","trex"]);return _.forEach(function(M){var K=C(M,4),Y=v[K];Y&&(Y.default={duration:C(M,12),flags:C(M,20)})}),v}function b(A,v){return p(v,["moof","traf"]).reduce(function(g,D){var T=p(D,["tfdt"])[0],f=T.data[T.start],h=p(D,["tfhd"]).reduce(function(d,o){var E=C(o,4),y=A[E];if(y){var m=C(T,4);f===1&&(m*=Math.pow(2,32),m+=C(T,8));var k=y.timescale||9e4,I=m/k;if(isFinite(I)&&(d===null||I<d))return I}return d},null);return h!==null&&isFinite(h)&&(g===null||h<g)?h:g},null)||0}function x(A,v){for(var g=0,D=0,T=0,f=p(A,["moof","traf"]),h=0;h<f.length;h++){var d=f[h],o=p(d,["tfhd"])[0],E=C(o,4),y=v[E];if(!y)continue;var m=y.default,k=C(o,0)|(m==null?void 0:m.flags),I=m==null?void 0:m.duration;k&8&&(k&2?I=C(o,12):I=C(o,8));for(var U=y.timescale||9e4,W=p(d,["trun"]),_=0;_<W.length;_++){if(I){var M=C(W[_],4);g=I*M}else g=l(W[_]);y.type===F.ElementaryStreamTypes.VIDEO?D+=g/U:y.type===F.ElementaryStreamTypes.AUDIO&&(T+=g/U)}}if(D===0&&T===0){var K=R(A);if(K!=null&&K.references)return K.references.reduce(function(Y,q){return Y+q.info.duration||0},0)}return D||T}function l(A){var v=C(A,0),g=8;v&1&&(g+=4),v&4&&(g+=4);for(var D=0,T=C(A,4),f=0;f<T;f++){if(v&256){var h=C(A,g);D+=h,g+=4}v&512&&(g+=4),v&1024&&(g+=4),v&2048&&(g+=4)}return D}function a(A,v,g){p(v,["moof","traf"]).forEach(function(D){p(D,["tfhd"]).forEach(function(T){var f=C(T,4),h=A[f];if(!h)return;var d=h.timescale||9e4;p(D,["tfdt"]).forEach(function(o){var E=o.data[o.start],y=C(o,4);if(E===0)c(o,4,y-g*d);else{y*=Math.pow(2,32),y+=C(o,8),y-=g*d,y=Math.max(y,0);var m=Math.floor(y/(O+1)),k=Math.floor(y%(O+1));c(o,4,m),c(o,8,k)}})})})}function s(A){var v={valid:null,remainder:null},g=p(A,["moof"]);if(g){if(g.length<2)return v.remainder=A,v}else return v;var D=g[g.length-1];return v.valid=Object(z.sliceUint8)(A,0,D.start-8),v.remainder=Object(z.sliceUint8)(A,D.start-8),v}function u(A,v){var g=new Uint8Array(A.length+v.length);return g.set(A),g.set(v,A.length),g}},"./src/utils/output-filter.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"default",function(){return z});var z=function(){function F(B,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=N}var O=F.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(N,P,C){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=P,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"sendAddTrackEvent",function(){return F}),L.d(H,"addCueToTrack",function(){return O}),L.d(H,"clearCurrentCues",function(){return B}),L.d(H,"removeCuesInRange",function(){return N}),L.d(H,"getCuesInRange",function(){return C});var z=L("./src/utils/logger.ts");function F(c,p){var R;try{R=new Event("addtrack")}catch(w){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=c,p.dispatchEvent(R)}function O(c,p){var R=c.mode;if(R==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(p.id))try{if(c.addCue(p),!c.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(b){z.logger.debug("[texttrack-utils]: "+b);var w=new self.TextTrackCue(p.startTime,p.endTime,p.text);w.id=p.id,c.addCue(w)}R==="disabled"&&(c.mode=R)}function B(c){var p=c.mode;if(p==="disabled"&&(c.mode="hidden"),c.cues)for(var R=c.cues.length;R--;)c.removeCue(c.cues[R]);p==="disabled"&&(c.mode=p)}function N(c,p,R){var w=c.mode;if(w==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var b=C(c.cues,p,R),x=0;x<b.length;x++)c.removeCue(b[x]);w==="disabled"&&(c.mode=w)}function P(c,p){if(p<c[0].startTime)return 0;var R=c.length-1;if(p>c[R].endTime)return-1;for(var w=0,b=R;w<=b;){var x=Math.floor((b+w)/2);if(p<c[x].startTime)b=x-1;else if(p>c[x].startTime&&w<R)w=x+1;else return x}return c[w].startTime-p<p-c[b].startTime?w:b}function C(c,p,R){var w=[],b=P(c,p);if(b>-1)for(var x=b,l=c.length;x<l;x++){var a=c[x];if(a.startTime>=p&&a.endTime<=R)w.push(a);else if(a.startTime>R)return w}return w}},"./src/utils/time-ranges.ts":function(J,H,L){"use strict";L.r(H);var z={toString:function(O){for(var B="",N=O.length,P=0;P<N;P++)B+="["+O.start(P).toFixed(3)+","+O.end(P).toFixed(3)+"]";return B}};H.default=z},"./src/utils/timescale-conversion.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"toTimescaleFromBase",function(){return F}),L.d(H,"toTimescaleFromScale",function(){return O}),L.d(H,"toMsFromMpegTsClock",function(){return B}),L.d(H,"toMpegTsClockFromTimescale",function(){return N});var z=9e4;function F(P,C,c,p){c===void 0&&(c=1),p===void 0&&(p=!1);var R=P*C*c;return p?Math.round(R):R}function O(P,C,c,p){return c===void 0&&(c=1),p===void 0&&(p=!1),F(P,C,1/c,p)}function B(P,C){return C===void 0&&(C=!1),F(P,1e3,1/z,C)}function N(P,C){return C===void 0&&(C=1),F(P,z,1/C)}},"./src/utils/typed-array.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"sliceUint8",function(){return z});function z(F,O,B){return Uint8Array.prototype.slice?F.slice(O,B):new Uint8Array(Array.prototype.slice.call(F,O,B))}},"./src/utils/vttcue.ts":function(J,H,L){"use strict";L.r(H),H.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],F=["start","middle","end","left","right"];function O(c,p){if(typeof p!="string")return!1;if(!Array.isArray(c))return!1;var R=p.toLowerCase();return~c.indexOf(R)?R:!1}function B(c){return O(z,c)}function N(c){return O(F,c)}function P(c){for(var p=arguments.length,R=new Array(p>1?p-1:0),w=1;w<p;w++)R[w-1]=arguments[w];for(var b=1;b<arguments.length;b++){var x=arguments[b];for(var l in x)c[l]=x[l]}return c}function C(c,p,R){var w=this,b={enumerable:!0};w.hasBeenReset=!1;var x="",l=!1,a=c,s=p,u=R,A=null,v="",g=!0,D="auto",T="start",f=50,h="middle",d=50,o="middle";Object.defineProperty(w,"id",P({},b,{get:function(){return x},set:function(y){x=""+y}})),Object.defineProperty(w,"pauseOnExit",P({},b,{get:function(){return l},set:function(y){l=!!y}})),Object.defineProperty(w,"startTime",P({},b,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",P({},b,{get:function(){return s},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");s=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",P({},b,{get:function(){return u},set:function(y){u=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",P({},b,{get:function(){return A},set:function(y){A=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",P({},b,{get:function(){return v},set:function(y){var m=B(y);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",P({},b,{get:function(){return g},set:function(y){g=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",P({},b,{get:function(){return D},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",P({},b,{get:function(){return T},set:function(y){var m=N(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");T=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",P({},b,{get:function(){return f},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");f=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",P({},b,{get:function(){return h},set:function(y){var m=N(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",P({},b,{get:function(){return d},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",P({},b,{get:function(){return o},set:function(y){var m=N(y);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");o=m,this.hasBeenReset=!0}})),w.displayState=void 0}return C.prototype.getCueAsHTML=function(){var c=self.WebVTT;return c.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"parseTimeStamp",function(){return O}),L.d(H,"fixLineBreaks",function(){return p}),L.d(H,"VTTParser",function(){return R});var z=L("./src/utils/vttcue.ts"),F=function(){function w(){}var b=w.prototype;return b.decode=function(l,a){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},w}();function O(w){function b(l,a,s,u){return(l|0)*3600+(a|0)*60+(s|0)+parseFloat(u||0)}var x=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?b(x[2],x[3],0,x[4]):b(x[1],x[2],x[3],x[4]):null}var B=function(){function w(){this.values=Object.create(null)}var b=w.prototype;return b.set=function(l,a){!this.get(l)&&a!==""&&(this.values[l]=a)},b.get=function(l,a,s){return s?this.has(l)?this.values[l]:a[s]:this.has(l)?this.values[l]:a},b.has=function(l){return l in this.values},b.alt=function(l,a,s){for(var u=0;u<s.length;++u)if(a===s[u]){this.set(l,a);break}},b.integer=function(l,a){/^-?\d+$/.test(a)&&this.set(l,parseInt(a,10))},b.percent=function(l,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},w}();function N(w,b,x,l){var a=l?w.split(l):[w];for(var s in a){if(typeof a[s]!="string")continue;var u=a[s].split(x);if(u.length!==2)continue;var A=u[0],v=u[1];b(A,v)}}var P=new z.default(0,0,""),C=P.align==="middle"?"middle":"center";function c(w,b,x){var l=w;function a(){var A=O(w);if(A===null)throw new Error("Malformed timestamp: "+l);return w=w.replace(/^[^\sa-zA-Z-]+/,""),A}function s(A,v){var g=new B;N(A,function(f,h){var d;switch(f){case"region":for(var o=x.length-1;o>=0;o--)if(x[o].id===h){g.set(f,x[o].region);break}break;case"vertical":g.alt(f,h,["rl","lr"]);break;case"line":d=h.split(","),g.integer(f,d[0]),g.percent(f,d[0])&&g.set("snapToLines",!1),g.alt(f,d[0],["auto"]),d.length===2&&g.alt("lineAlign",d[1],["start",C,"end"]);break;case"position":d=h.split(","),g.percent(f,d[0]),d.length===2&&g.alt("positionAlign",d[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":g.percent(f,h);break;case"align":g.alt(f,h,["start",C,"end","left","right"]);break}},/:/,/\s/),v.region=g.get("region",null),v.vertical=g.get("vertical","");var D=g.get("line","auto");D==="auto"&&P.line===-1&&(D=-1),v.line=D,v.lineAlign=g.get("lineAlign","start"),v.snapToLines=g.get("snapToLines",!0),v.size=g.get("size",100),v.align=g.get("align",C);var T=g.get("position","auto");T==="auto"&&P.position===50&&(T=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=T}function u(){w=w.replace(/^\s+/,"")}if(u(),b.startTime=a(),u(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);w=w.substr(3),u(),b.endTime=a(),u(),s(w,b)}function p(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=w.prototype;return b.parse=function(l){var a=this;l&&(a.buffer+=a.decoder.decode(l,{stream:!0}));function s(){var T=a.buffer,f=0;for(T=p(T);f<T.length&&T[f]!=="\r"&&T[f]!==`
|
|
`;)++f;var h=T.substr(0,f);return T[f]==="\r"&&++f,T[f]===`
|
|
`&&++f,a.buffer=T.substr(f),h}function u(T){N(T,function(f,h){},/:/)}try{var A="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;A=s();var v=A.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var g=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;g?g=!1:A=s();switch(a.state){case"HEADER":/:/.test(A)?u(A):A||(a.state="ID");continue;case"NOTE":A||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){a.state="NOTE";break}if(!A)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",A.indexOf("-->")===-1){a.cue.id=A;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{c(A,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=A.indexOf("-->")!==-1;if(!A||D&&(g=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=A}continue;case"BADCUE":A||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){l.onparsingerror&&l.onparsingerror(a)}return l.onflush&&l.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(J,H,L){"use strict";L.r(H),L.d(H,"generateCueId",function(){return R}),L.d(H,"parseWebVTT",function(){return b});var z=L("./src/polyfills/number.ts"),F=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),N=L("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,C=function(l,a,s){return s===void 0&&(s=0),l.substr(s,a.length)===a},c=function(l){var a=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),u=parseInt(l.substr(-9,2)),A=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(u)||!Object(z.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return a+=1e3*s,a+=60*1e3*u,a+=60*60*1e3*A,a},p=function(l){for(var a=5381,s=l.length;s;)a=a*33^l.charCodeAt(--s);return(a>>>0).toString()};function R(x,l,a){return p(x.toString())+p(l.toString())+p(a)}var w=function(l,a,s){var u=l[a],A=l[u.prevCC];if(!A||!A.new&&u.new){l.ccOffset=l.presentationOffset=u.start,u.new=!1;return}for(;(v=A)!==null&&v!==void 0&&v.new;){var v;l.ccOffset+=u.start-A.start,u.new=!1,u=A,A=l[u.prevCC]}l.presentationOffset=s};function b(x,l,a,s,u,A,v,g){var D=new F.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(P,`
|
|
`).split(`
|
|
`),f=[],h=Object(B.toMpegTsClockFromTimescale)(l,a),d="00:00.000",o=0,E=0,y,m=!0,k=!1;D.oncue=function(I){var U=s[u],W=s.ccOffset,_=(o-h)/9e4;if(U!=null&&U.new&&(E!==void 0?W=s.ccOffset=U.start:w(s,u,_)),_&&(W=_-s.presentationOffset),k){var M=I.endTime-I.startTime,K=Object(N.normalizePts)((I.startTime+W-E)*9e4,A*9e4)/9e4;I.startTime=K,I.endTime=K+M}var Y=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(Y)),I.id||(I.id=R(I.startTime,I.endTime,Y)),I.endTime>0&&f.push(I)},D.onparsingerror=function(I){y=I},D.onflush=function(){if(y){g(y);return}v(f)},T.forEach(function(I){if(m)if(C(I,"X-TIMESTAMP-MAP=")){m=!1,k=!0,I.substr(16).split(",").forEach(function(U){C(U,"LOCAL:")?d=U.substr(6):C(U,"MPEGTS:")&&(o=parseInt(U.substr(7)))});try{E=c(d)/1e3}catch(U){k=!1,y=U}return}else I===""&&(m=!1);D.parse(I+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(J,H,L){"use strict";L.r(H);var z=L("./src/utils/logger.ts"),F=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,B=function(){function N(C){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=C?C.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var P=N.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},P.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(c,p,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=p,this.callbacks=R,this.retryDelay=p.retryDelay,this.loadInternal()},P.loadInternal=function(){var c=this.config,p=this.context;if(!c)return;var R=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var b=this.xhrSetup;try{if(b)try{b(R,p.url)}catch(a){R.open("GET",p.url,!0),b(R,p.url)}R.readyState||R.open("GET",p.url,!0);var x=this.context.headers;if(x)for(var l in x)R.setRequestHeader(l,x[l])}catch(a){this.callbacks.onError({code:R.status,text:a.message},p,R);return}p.rangeEnd&&R.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),R.send()},P.readystatechange=function(){var c=this.context,p=this.loader,R=this.stats;if(!c||!p)return;var w=p.readyState,b=this.config;if(R.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),w===4){p.onreadystatechange=null,p.onprogress=null;var x=p.status;if(x>=200&&x<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var l,a;if(c.responseType==="arraybuffer"?(l=p.response,a=l.byteLength):(l=p.responseText,a=l.length),R.loaded=R.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(R,c,l,p),!this.callbacks)return;var u={url:p.responseURL,data:l};this.callbacks.onSuccess(u,R,c,p)}else R.retry>=b.maxRetry||x>=400&&x<499?(z.logger.error(x+" while loading "+c.url),this.callbacks.onError({code:x,text:p.statusText},c,p)):(z.logger.warn(x+" while loading "+c.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,b.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},P.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(c){var p=this.stats;p.loaded=c.loaded,c.lengthComputable&&(p.total=c.total)},P.getCacheAge=function(){var c=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");c=p?parseFloat(p):null}return c},N}();H.default=B}}).default})},wU8J:function(nt,ze){function re(){this.buffer=new Array,this.length=0}re.prototype={get:function(J){var H=Math.floor(J/8);return(this.buffer[H]>>>7-J%8&1)==1},put:function(J,H){for(var L=0;L<H;L++)this.putBit((J>>>H-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var H=Math.floor(this.length/8);this.buffer.length<=H&&this.buffer.push(0),J&&(this.buffer[H]|=128>>>this.length%8),this.length++}},nt.exports=re}}]);
|