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.
133 lines
789 KiB
133 lines
789 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[245,7,13],{"+NIl":function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(K,A){"use strict";function F(O,C){O.cmdState.push(C)}function T(O){return O.cmdState.length>0?O.cmdState[O.cmdState.length-1]:null}function M(O){var C=O.cmdState.pop();C&&C.closeBracket()}function U(O){for(var C=O.cmdState,p=C.length-1;p>=0;p--){var l=C[p];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function I(O,C,p){return function(){this.name=O,this.bracketNo=0,this.style=C,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=I("importmodule","tag",["string","builtin"]),R.documentclass=I("documentclass","tag",["","atom"]),R.usepackage=I("usepackage","tag",["atom"]),R.begin=I("begin","tag",["atom"]),R.end=I("end","tag",["atom"]),R.label=I("label","tag",["atom"]),R.ref=I("ref","tag",["atom"]),R.eqref=I("eqref","tag",["atom"]),R.cite=I("cite","tag",["atom"]),R.bibitem=I("bibitem","tag",["atom"]),R.Bibitem=I("Bibitem","tag",["atom"]),R.RBibitem=I("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(O,C){O.f=C}function y(O,C){var p;if(O.match(/^\\[a-zA-Z@]+/)){var l=O.current().slice(1);return p=R.hasOwnProperty(l)?R[l]:R.DEFAULT,p=new p,F(C,p),_(C,L),p.style}if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/\\]/))return"tag";if(O.match("\\["))return _(C,function(s,u){return w(s,u,"\\]")}),"keyword";if(O.match("\\("))return _(C,function(s,u){return w(s,u,"\\)")}),"keyword";if(O.match("$$"))return _(C,function(s,u){return w(s,u,"$$")}),"keyword";if(O.match("$"))return _(C,function(s,u){return w(s,u,"$")}),"keyword";var a=O.next();if(a=="%")return O.skipToEnd(),"comment";if(a=="}"||a=="]"){if(p=T(C),p)p.closeBracket(a),_(C,L);else return"error";return"bracket"}else return a=="{"||a=="["?(p=R.DEFAULT,p=new p,F(C,p),"bracket"):/\d/.test(a)?(O.eatWhile(/[\w.%]/),"atom"):(O.eatWhile(/[\w\-_]/),p=U(C),p.name=="begin"&&(p.argument=O.current()),p.styleIdentifier())}function w(O,C,p){if(O.eatSpace())return null;if(p&&O.match(p))return _(C,y),"keyword";if(O.match(/^\\[a-zA-Z@]+/))return"tag";if(O.match(/^[a-zA-Z]+/))return"variable-2";if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/]/))return"tag";if(O.match(/^[\^_&]/))return"tag";if(O.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(O.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=O.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(O.skipToEnd(),"comment"):"error"}function L(O,C){var p=O.peek(),l;return p=="{"||p=="["?(l=T(C),l.openBracket(p),O.eat(p),_(C,y),"bracket"):/[ \t\r]/.test(p)?(O.eat(p),null):(_(C,y),M(C),y(O,C))}return{startState:function(){var O=A.inMathMode?function(C,p){return w(C,p)}:y;return{cmdState:[],f:O}},copyState:function(O){return{cmdState:O.cmdState.slice(),f:O.f}},token:function(O,C){return C.f(O,C)},blankLine:function(O){O.f=y,O.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"19Vz":function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){q.defineOption("placeholder","",function(I,R,_){var y=_&&_!=q.Init;if(R&&!y)I.on("blur",T),I.on("change",M),I.on("swapDoc",M),q.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){F(I)}),M(I);else if(!R&&y){I.off("blur",T),I.off("change",M),I.off("swapDoc",M),q.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),K(I);var w=I.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}R&&!I.hasFocus()&&T(I)});function K(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function A(I){K(I);var R=I.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=I.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var _=I.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),R.appendChild(_),I.display.lineSpace.insertBefore(R,I.display.lineSpace.firstChild)}function F(I){setTimeout(function(){var R=!1,_=I.getInputField();_.nodeName=="TEXTAREA"?R=!_.value:I.lineCount()==1&&(R=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),R?A(I):K(I)},20)}function T(I){U(I)&&A(I)}function M(I){var R=I.getWrapperElement(),_=U(I);R.className=R.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?A(I):K(I)}function U(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(F,T){var M=F.indentUnit,U={},I=T.htmlMode?K:A;for(var R in I)U[R]=I[R];for(var R in T)U[R]=T[R];var _,y;function w(o,E){function g(B){return E.tokenize=B,B(o,E)}var S=o.next();if(S=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?g(C("atom","]]>")):null:o.match("--")?g(C("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),g(p(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),E.tokenize=C("meta","?>"),"meta"):(_=o.eat("/")?"closeTag":"openTag",E.tokenize=L,"tag bracket");if(S=="&"){var P;return o.eat("#")?o.eat("x")?P=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):P=o.eatWhile(/[\d]/)&&o.eat(";"):P=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),P?"atom":"error"}else return o.eatWhile(/[^&<]/),null}w.isInText=!0;function L(o,E){var g=o.next();if(g==">"||g=="/"&&o.eat(">"))return E.tokenize=w,_=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return _="equals",null;if(g=="<"){E.tokenize=w,E.state=u,E.tagName=E.tagStart=null;var S=E.tokenize(o,E);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(g)?(E.tokenize=O(g),E.stringStartCol=o.column(),E.tokenize(o,E)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(o){var E=function(g,S){for(;!g.eol();)if(g.next()==o){S.tokenize=L;break}return"string"};return E.isInAttribute=!0,E}function C(o,E){return function(g,S){for(;!g.eol();){if(g.match(E)){S.tokenize=w;break}g.next()}return o}}function p(o){return function(E,g){for(var S;(S=E.next())!=null;){if(S=="<")return g.tokenize=p(o+1),g.tokenize(E,g);if(S==">")if(o==1){g.tokenize=w;break}else return g.tokenize=p(o-1),g.tokenize(E,g)}return"meta"}}function l(o,E,g){this.prev=o.context,this.tagName=E,this.indent=o.indented,this.startOfLine=g,(U.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 g;;){if(!o.context)return;if(g=o.context.tagName,!U.contextGrabbers.hasOwnProperty(g)||!U.contextGrabbers[g].hasOwnProperty(E))return;a(o)}}function u(o,E,g){return o=="openTag"?(g.tagStart=E.column(),b):o=="closeTag"?m:u}function b(o,E,g){return o=="word"?(g.tagName=E.current(),y="tag",v):U.allowMissingTagName&&o=="endTag"?(y="tag bracket",v(o,E,g)):(y="error",b)}function m(o,E,g){if(o=="word"){var S=E.current();return g.context&&g.context.tagName!=S&&U.implicitlyClosed.hasOwnProperty(g.context.tagName)&&a(g),g.context&&g.context.tagName==S||U.matchClosing===!1?(y="tag",h):(y="tag error",D)}else return U.allowMissingTagName&&o=="endTag"?(y="tag bracket",h(o,E,g)):(y="error",D)}function h(o,E,g){return o!="endTag"?(y="error",h):(a(g),u)}function D(o,E,g){return y="error",h(o,E,g)}function v(o,E,g){if(o=="word")return y="attribute",c;if(o=="endTag"||o=="selfcloseTag"){var S=g.tagName,P=g.tagStart;return g.tagName=g.tagStart=null,o=="selfcloseTag"||U.autoSelfClosers.hasOwnProperty(S)?s(g,S):(s(g,S),g.context=new l(g,S,P==g.indented)),u}return y="error",v}function c(o,E,g){return o=="equals"?f:(U.allowMissing||(y="error"),v(o,E,g))}function f(o,E,g){return o=="string"?d:o=="word"&&U.allowUnquoted?(y="string",v):(y="error",v(o,E,g))}function d(o,E,g){return o=="string"?d:v(o,E,g)}return{startState:function(o){var E={tokenize:w,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;_=null;var g=E.tokenize(o,E);return(g||_)&&g!="comment"&&(y=null,E.state=E.state(_||g,o,E),y&&(g=y=="error"?g+" error":y)),g},indent:function(o,E,g){var S=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+M;if(S&&S.noIndent)return q.Pass;if(o.tokenize!=L&&o.tokenize!=w)return g?g.match(/^(\s*)/)[0].length:0;if(o.tagName)return U.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+M*(U.multilineTagIndentFactor||1);if(U.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var P=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(P&&P[1])for(;S;)if(S.tagName==P[2]){S=S.prev;break}else if(U.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(P)for(;S;){var B=U.contextGrabbers[S.tagName];if(B&&B.hasOwnProperty(P[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+M:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:U.htmlMode?"html":"xml",helperType:U.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=v)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var E=[],g=o.context;g;g=g.prev)g.tagName&&E.push(g.tagName);return E.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3TLj":function(Dt,at,Z){Dt.exports={flex_box_center:"flex_box_center____TbjK",flex_space_between:"flex_space_between___2coRZ",flex_box_vertical_center:"flex_box_vertical_center___3NVFE",flex_box_center_end:"flex_box_center_end___3GKhy",flex_box_column:"flex_box_column___2SLfn",bg:"bg___3oKWe",formWrap:"formWrap___2Y1wq"}},"5v/u":function(Dt,at,Z){"use strict";Z.r(at);var q=Z("5NDa"),K=Z("5rEg"),A=Z("2qtc"),F=Z("kLXV"),T=Z("9og8"),M=Z("k1fw"),U=Z("y8nQ"),I=Z("Vl3Y"),R=Z("tJVT"),_=Z("PpiC"),y=Z("Znn+"),w=Z("ZTPi"),L=Z("WmNS"),O=Z.n(L),C=Z("cDcd"),p=Z.n(C),l=Z("9kvl"),a=Z("Ot1p"),s=Z("HBuW"),u=Z("3TLj"),b=Z.n(u),m=Z("xKgJ"),h=Z("UqFu"),D=Z("9ZNV"),v=Z("nuEh"),c=w.a.TabPane,f=function(o){var E,g,S=o.shixunsDetail,P=o.dispatch,B=o.match,H=o.practiceSetting,Y=Object(_.a)(o,["shixunsDetail","dispatch","match","practiceSetting"]),j=I.a.useForm(),N=Object(R.a)(j,1),Q=N[0],ne=Object(C.useState)({}),pe=Object(R.a)(ne,2),xe=pe[0],Ie=pe[1],Ae=S.challengesNew,De=Object(C.useRef)(null),Ce=H.selectQuestionParams,Oe=H.id,ce=H.newQuestion,fe=Object(C.useState)(!0),Pe=Object(R.a)(fe,2),qe=Pe[0],Ve=Pe[1];Object(C.useEffect)(function(){Ve(!0),P({type:"shixunsDetail/getChallengesNew",payload:Object(M.a)({},B.params)}),Ve(!1)},[B.params]);var Ze=function(){var et=Object(T.a)(O.a.mark(function Qe(Ne){var Ue,lt,ut;return O.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Ue=Object(M.a)({},xe),lt=!(!Ne.unity_3d_routes||Ne.unity_3d_routes==""),Ue.identifier=B.params.id,Ue.st=1,Je.next=6,Object(s.b)(Object(M.a)(Object(M.a)({},Ue),{},{unity_3d_routes:lt?Ne.unity_3d_routes:null,unity_3d:lt}));case 6:ut=Je.sent,ut.status===1&&(l.d.replace("/shixuns/".concat(B.params.id,"/edit/").concat(ut.challenge_id,"/editquestion?tab=2")),setTimeout(function(){P({type:"practiceSetting/setParams",payload:{newQuestion:null}}),P({type:"practiceSetting/setUpdateIndex"})},200));case 8:case"end":return Je.stop()}},Qe)}));return function(Ne){return et.apply(this,arguments)}}(),ct=function(){Xe()},je=function(Qe){clearTimeout(De.current),De.current=setTimeout(function(){"subject"in Qe&&ce&&P({type:"practiceSetting/setParams",payload:{newQuestion:{st:1,name:Qe==null?void 0:Qe.subject}}});var Ne=Q.getFieldsValue(),Ue=Ne.subject,lt=Ne.task_pass;Ue!==""||lt!==Object(h.a)(Ae.task_pass_default)?P({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}):P({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},500)},Be=function(Qe){Ie(Object(M.a)({},Q.getFieldsValue())),je(Qe)},Xe=function(){var Qe,Ne=function(){l.d.push("/shixuns/".concat(Oe,"/challenges")),P({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};H!=null&&(Qe=H.sideBar)!==null&&Qe!==void 0&&Qe.confirmLeave?F.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){Ne()}}):Ne()};return p.a.createElement("section",{className:b.a.bg},p.a.createElement(w.a,{activeKey:"1"},p.a.createElement(c,{tab:"\u672C\u5173\u4EFB\u52A1",key:"1"},p.a.createElement(I.a,{form:Q,className:b.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Be,onFinish:Ze},p.a.createElement("div",{className:b.a.fieldWrap},p.a.createElement(I.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},p.a.createElement(K.a,{bordered:!1,maxLength:60,suffix:"".concat(((E=xe.subject)===null||E===void 0?void 0:E.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),p.a.createElement("div",{className:b.a.mdWrap},p.a.createElement(I.a.Item,{name:"task_pass",label:"\u8FC7\u5173\u4EFB\u52A1:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},p.a.createElement(a.a,{watch:!0,defaultValue:Ae.task_pass_default}))),Object(m.o)()&&p.a.createElement("div",{className:b.a.fieldWrap},p.a.createElement(I.a.Item,{initialValue:"",name:"unity_3d_routes",label:"\u5D4C\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0:"},p.a.createElement(K.a,{bordered:!1,maxLength:60,suffix:"".concat(((g=xe.unity_3d_routes)===null||g===void 0?void 0:g.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0\u5730\u5740"}))),p.a.createElement(I.a.Item,{noStyle:!0},p.a.createElement(D.a,{okButtonProps:{htmlType:"submit"},className:"customFixedButton",onCancel:ct}))))),p.a.createElement(v.a,{loading:qe}))};at.default=Object(l.a)(function(d){var o=d.shixunsDetail,E=d.practiceSetting;return{shixunsDetail:o,practiceSetting:E}})(f)},"7Cbv":function(Dt,at,Z){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function A(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(K)}var F=/^(?:[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 T(L){return typeof L=="string"&&F.test(L)}for(var M=T,U=[],I=0;I<256;++I)U.push((I+256).toString(16).substr(1));function R(L){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(U[L[O+0]]+U[L[O+1]]+U[L[O+2]]+U[L[O+3]]+"-"+U[L[O+4]]+U[L[O+5]]+"-"+U[L[O+6]]+U[L[O+7]]+"-"+U[L[O+8]]+U[L[O+9]]+"-"+U[L[O+10]]+U[L[O+11]]+U[L[O+12]]+U[L[O+13]]+U[L[O+14]]+U[L[O+15]]).toLowerCase();if(!M(C))throw TypeError("Stringified UUID is invalid");return C}var _=R;function y(L,O,C){L=L||{};var p=L.random||(L.rng||A)();if(p[6]=p[6]&15|64,p[8]=p[8]&63|128,O){C=C||0;for(var l=0;l<16;++l)O[C+l]=p[l];return O}return _(p)}var w=at.a=y},"7ahc":function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return b});var q=Z("k1fw"),K=Z("0Owb"),A=Z("+L6B"),F=Z("2/Rp"),T=Z("y8nQ"),M=Z("Vl3Y"),U=Z("tJVT"),I=Z("OaEy"),R=Z("2fM7"),_=Z("cDcd"),y=Z.n(_),w=Z("VrN/"),L=Z.n(w),O=Z("p77/"),C=Z.n(O),p=Z("c5Ni"),l=Z.n(p),a=R.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"]};at.b=function(m){var h=m.callback,D=m.onCancel,v=Object(_.useState)("python"),c=Object(U.a)(v,2),f=c[0],d=c[1];function o(g){d(u[g][1])}function E(g){h(g)}return y.a.createElement(M.a,Object(K.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(R.a,{onChange:o},Object.keys(u).map(function(g){return y.a.createElement(a,{key:g,value:g},u[g][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(b,{mode:f})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(F.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function b(m){var h=m.value,D=m.onChange,v=m.mode,c=m.options,f=c===void 0?{}:c,d=Object(_.useRef)(),o=Object(_.useState)(),E=Object(U.a)(o,2),g=E[0],S=E[1];return Object(_.useEffect)(function(){if(g){function P(B){var H=B.getValue();D&&D(H)}return g.on("change",P),function(){g.off("change",P)}}},[g,D]),Object(_.useEffect)(function(){g&&g.setOption("mode",v)},[g,v]),Object(_.useEffect)(function(){g&&((h!==g.getValue()||h==="")&&setTimeout(function(){g.setValue(h||" ")},300))},[g,h]),Object(_.useEffect)(function(){if(d.current&&!g){var P=L.a.fromTextArea(d.current,Object(q.a)({mode:v,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));S(P)}},[d.current,g]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:d}))}},"7ixt":function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return A});var q={adjustX:1,adjustY:1},K=[0,0],A={left:{points:["cr","cl"],overflow:q,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:q,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:q,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:q,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:q,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:q,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:q,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:q,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:q,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:q,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:q,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:q,offset:[-4,0],targetOffset:K}},F=A},"8EBN":function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){"use strict";q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var K=0;K<q.modeInfo.length;K++){var A=q.modeInfo[K];A.mimes&&(A.mime=A.mimes[0])}q.findModeByMIME=function(F){F=F.toLowerCase();for(var T=0;T<q.modeInfo.length;T++){var M=q.modeInfo[T];if(M.mime==F)return M;if(M.mimes){for(var U=0;U<M.mimes.length;U++)if(M.mimes[U]==F)return M}}if(/\+xml$/.test(F))return q.findModeByMIME("application/xml");if(/\+json$/.test(F))return q.findModeByMIME("application/json")},q.findModeByExtension=function(F){F=F.toLowerCase();for(var T=0;T<q.modeInfo.length;T++){var M=q.modeInfo[T];if(M.ext){for(var U=0;U<M.ext.length;U++)if(M.ext[U]==F)return M}}},q.findModeByFileName=function(F){for(var T=0;T<q.modeInfo.length;T++){var M=q.modeInfo[T];if(M.file&&M.file.test(F))return M}var U=F.lastIndexOf("."),I=U>-1&&F.substring(U+1,F.length);if(I)return q.findModeByExtension(I)},q.findModeByName=function(F){F=F.toLowerCase();for(var T=0;T<q.modeInfo.length;T++){var M=q.modeInfo[T];if(M.name.toLowerCase()==F)return M;if(M.alias){for(var U=0;U<M.alias.length;U++)if(M.alias[U].toLowerCase()==F)return M}}}})},"8hTe":function(Dt,at,Z){Dt.exports={button:"button___1wy9m"}},"9Bee":function(Dt,at,Z){"use strict";var q=Z("DYRE"),K=Z("zeV3"),A=Z("+L6B"),F=Z("2/Rp"),T=Z("k1fw"),M=Z("tJVT"),U=Z("cDcd"),I=Z.n(U),R=Z("vg9a"),_=Z("DlQD"),y=Z.n(_),w=Z("rUJ1");function L(De,Ce){var Oe=De.match(/^(\s+)(?:```)/);if(Oe===null)return Ce;var ce=Oe[1];return Ce.split(`
|
|
`).map(function(fe){var Pe=fe.match(/^\s+/);if(Pe===null)return fe;var qe=Object(M.a)(Pe,1),Ve=qe[0];return Ve.length>=ce.length?fe.slice(ce.length):fe}).join(`
|
|
`)}var O=[],C=["<ul>"],p=new y.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){O.length=0,C=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(De,Ce,Oe,ce){if(Ce>=De.length||De[Ce].level<=Oe)return Ce;var fe=De[Ce];ce.push("<li><a href='#"+fe.anchor+"'>"+fe.text+"</a>"),Ce++;var Pe=[];return Ce=u(De,Ce,fe.level,Pe),Pe.length>0&&(ce.push("<ul>"),Pe.forEach(function(qe){ce.push(qe)}),ce.push("</ul>")),ce.push("</li>"),Ce=u(De,Ce,Oe,ce),Ce}function b(){return u(O,0,0,C),C.push("</ul>"),C.join("")}var m={heading:function(Ce){var Oe=l.exec(Ce);if(Oe)return{type:"heading",raw:Oe[0],depth:Oe[1].length,text:Oe[2]}},fences:function(Ce){var Oe=this.rules.block.fences.exec(Ce);if(Oe){var ce=Oe[0],fe=L(ce,Oe[3]||""),Pe=Oe[2]?Oe[2].trim():Oe[2];if(["latex","katex","math"].indexOf(Pe)>=0){var qe=v(),Ve=fe;fe=qe,c[qe]={type:"block",expression:Ve}}return{type:"code",raw:ce,lang:Pe,text:fe}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,D=0,v=function(){return"__special_katext_id_".concat(D++,"__")},c={};function f(){return c}function d(){D=0,c={}}function o(De){return De=De.replace(h,function(Ce,Oe){var ce=v();return c[ce]={type:"inline",expression:Oe},ce}),De}var E=p.listitem;p.listitem=function(De){return E(o(De))};var g=p.paragraph;p.paragraph=function(De){return g(o(De))};var S=p.tablecell;p.tablecell=function(De,Ce){return S(o(De),Ce)},p.code=function(De,Ce,Oe){var ce=(Ce||"").match(/\S*/)[0];return ce?["latex","katex","math"].indexOf(ce)>=0?"<p class='editormd-tex'>".concat(De,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Ce,'">').concat(Oe?De:Object(w.escape)(De,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Oe?De:Object(w.escape)(De,!0))+"</code></pre>"},p.heading=function(De,Ce,Oe){var ce=this.options.headerPrefix+Oe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:ce,level:Ce,text:De}),"<h"+Ce+' id="'+ce+'">'+De+"</h"+Ce+">"},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:m,renderer:p});var P=y.a,B=Z("SJMd"),H=Z("ulZh"),Y=Z.n(H),j=Z("m3rI"),N=Z("Oy/b"),Q=Z("p5ED"),ne=Z("8hTe"),pe=Z.n(ne),xe=/<pre[^>]*>/g;function Ie(De){var Ce=document.createElement("div");return Ce.innerHTML=De,Ce.childNodes.length===0?"":Ce.childNodes[0].nodeValue}var Ae=at.a=function(De){var Ce=De.value,Oe=Ce===void 0?"":Ce,ce=De.edit,fe=ce===void 0?!1:ce,Pe=De.className,qe=De.showTextOnly,Ve=De.showLines,Ze=De.replaces,ct=De.zoomImg,je=De.hasMask,Be=De.style,Xe=Be===void 0?{}:Be,et=De.stylesPrev,Qe=et===void 0?{}:et,Ne=String(Oe),Ue=Object(U.useRef)(),lt=Object(U.useRef)(),ut=Object(U.useState)(""),ot=Object(M.a)(ut,2),Je=ot[0],vt=ot[1],ft=Object(U.useState)("office"),st=Object(M.a)(ft,2),_e=st[0],pt=st[1],dt=Object(U.useMemo)(function(){try{var he=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,J=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ne=Ne.replace(he,"("+j.a.API_SERVER+"/api/attachments/").replace($,'"'+j.a.API_SERVER+"/api/attachments/").replace(J,'"'+j.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(Le){}var re=P(Ne),le=f();if(Ne.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",b()),a()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Le,Fe){var it=le[Fe],xt=it.type,gt=it.expression;return Object(N.renderToString)(Ie(gt)||"",{displayMode:xt==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),d(),qe){var ve=document.createElement("div");return ve.innerHTML=re,ve.innerText}return setTimeout(function(){return be()},500),re},[Ne]),Re=Object(U.useRef)();s.WebkitLineClamp=Ve,Ve&&(Xe=Object(T.a)(Object(T.a)({},Xe),s));function Ke(he){var $=he.target;if($.tagName.toUpperCase()==="IMG"){if(ct){var J=$.getAttribute("src");vt(J),pt("image")}}else if($.tagName.toUpperCase()==="A"){var re=$.getAttribute("href");if(re.indexOf("office")>-1)he.preventDefault(),vt(re),pt("office");else if(re.indexOf("application/pdf")>-1)he.preventDefault(),vt(re),pt("pdf");else if(re.indexOf("text/html")>-1)he.preventDefault(),vt(re),pt("html");else if(re.startsWith("#")){he.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var be=function(){var $,J=($=Re.current)===null||$===void 0?void 0:$.querySelectorAll("video");J==null||J.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var le=new Y.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(U.useEffect)(function(){if(Re.current&&dt&&(dt.match(xe)&&window.PR.prettyPrint()),Re.current)return Re.current.addEventListener("click",Ke),function(){Re.current.removeEventListener("click",Ke),d(),a()}},[dt,Re.current,Ke]);var de=function($){if(!fe)return;$.target.nodeName==="IMG"?(Ue.current.style.display="flex",Ue.current.style.width=$.target.clientWidth+"px",Ue.current.style.height=$.target.clientHeight+"px",Ue.current.style.top=$.target.offsetTop+"px",Ue.current.style.left=$.target.offsetLeft+"px",lt.current.src=$.target.getAttribute("src")):Ue.current.style.display="none"};return I.a.createElement("div",{style:{position:"relative"}},I.a.createElement("div",{ref:Re,style:Object(T.a)({},Xe),className:"".concat(Pe||""," markdown-body ").concat(pe.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:dt}}),I.a.createElement("div",{ref:Ue,className:pe.a.button},I.a.createElement(K.a,null,I.a.createElement(F.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),I.a.createElement(F.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),I.a.createElement("img",{ref:lt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),I.a.createElement(Q.a,{close:!0,data:Je,type:Je!=null&&Je.length?_e:"",style:Object(T.a)({},Qe),onClose:function(){return vt("")}}))}},"9VGf":function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return A});var q=Z("cDcd"),K=Z.n(q);function A(F,T){var M=Object(q.useRef)();Object(q.useEffect)(function(){M.current=F}),Object(q.useEffect)(function(){function U(){M.current()}if(T!==null){var I=setInterval(U,T);return function(){return clearInterval(I)}}},[T])}},"9ZNV":function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return _});var q=Z("0Owb"),K=Z("+L6B"),A=Z("2/Rp"),F=Z("cDcd"),T=Z.n(F),M=Z("UUDw"),U=Z.n(M),I=Z("TSYQ"),R=Z.n(I),_=function(w){var L=w.cancelText,O=L===void 0?"\u53D6\u6D88":L,C=w.okText,p=C===void 0?"\u786E\u5B9A":C,l=w.loading,a=l===void 0?!1:l,s=w.hasOkBtn,u=s===void 0?!0:s,b=w.okButtonProps,m=b===void 0?{}:b,h=w.onCancel,D=h===void 0?function(){}:h,v=w.onOk,c=v===void 0?function(){}:v,f=w.className,d=f===void 0?"":f;return T.a.createElement("div",{className:R()(U.a.buttonFixed,d)},T.a.createElement("div",{className:U.a.buttonWrap},T.a.createElement(A.a,{size:"large",className:"".concat(U.a.button," mr20"),onClick:D},O),u&&T.a.createElement(A.a,Object(q.a)({size:"large",type:"primary",className:"".concat(U.a.button," mr20"),loading:a,onClick:c},m),p)))}},Bd2K:function(Dt,at,Z){(function(q){q(Z("VrN/"),Z("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(R,_,y){if(y!=q.Init&&y&&R.removeKeyMap("autoCloseTags"),!_)return;var w={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(w["'/'"]=function(L){return M(L)}),(typeof _!="object"||_.whenOpening!==!1)&&(w["'>'"]=function(L){return F(L)}),R.addKeyMap(w)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function F(R){if(R.getOption("disableInput"))return q.Pass;for(var _=R.listSelections(),y=[],w=R.getOption("autoCloseTags"),L=0;L<_.length;L++){if(!_[L].empty())return q.Pass;var O=_[L].head,C=R.getTokenAt(O),p=q.innerMode(R.getMode(),C.state),l=p.state,a=p.mode.xmlCurrentTag&&p.mode.xmlCurrentTag(l),s=a&&a.name;if(!s)return q.Pass;var u=p.mode.configuration=="html",b=typeof w=="object"&&w.dontCloseTags||u&&K,m=typeof w=="object"&&w.indentTags||u&&A;C.end>O.ch&&(s=s.slice(0,s.length-C.end+O.ch));var h=s.toLowerCase();if(!s||C.type=="string"&&(C.end!=O.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&a.close||C.string.indexOf("/")==O.ch-C.start-1||b&&U(b,h)>-1||I(R,p.mode.xmlCurrentContext&&p.mode.xmlCurrentContext(l)||[],s,O,!0))return q.Pass;var D=typeof w=="object"&&w.emptyTags;if(D&&U(D,s)>-1){y[L]={text:"/>",newPos:q.Pos(O.line,O.ch+2)};continue}var v=m&&U(m,h)>-1;y[L]={indent:v,text:">"+(v?`
|
|
|
|
`:"")+"</"+s+">",newPos:v?q.Pos(O.line+1,0):q.Pos(O.line,O.ch+1)}}for(var c=typeof w=="object"&&w.dontIndentOnAutoClose,L=_.length-1;L>=0;L--){var f=y[L];R.replaceRange(f.text,_[L].head,_[L].anchor,"+insert");var d=R.listSelections().slice(0);d[L]={head:f.newPos,anchor:f.newPos},R.setSelections(d),!c&&f.indent&&(R.indentLine(f.newPos.line,null,!0),R.indentLine(f.newPos.line+1,null,!0))}}function T(R,_){for(var y=R.listSelections(),w=[],L=_?"/":"</",O=R.getOption("autoCloseTags"),C=typeof O=="object"&&O.dontIndentOnSlash,p=0;p<y.length;p++){if(!y[p].empty())return q.Pass;var l=y[p].head,a=R.getTokenAt(l),s=q.innerMode(R.getMode(),a.state),u=s.state;if(_&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=l.ch-1))return q.Pass;var b,m=s.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(m&&s.mode.name=="javascript")b=L+"script";else if(m&&s.mode.name=="css")b=L+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!h||h.length&&I(R,h,h[h.length-1],l))return q.Pass;b=L+h[h.length-1]}R.getLine(l.line).charAt(a.end)!=">"&&(b+=">"),w[p]=b}if(R.replaceSelections(w),y=R.listSelections(),!C)for(var p=0;p<y.length;p++)(p==y.length-1||y[p].head.line<y[p+1].head.line)&&R.indentLine(y[p].head.line)}function M(R){return R.getOption("disableInput")?q.Pass:T(R,!0)}q.commands.closeTag=function(R){return T(R)};function U(R,_){if(R.indexOf)return R.indexOf(_);for(var y=0,w=R.length;y<w;++y)if(R[y]==_)return y;return-1}function I(R,_,y,w,L){if(!q.scanForClosingTag)return!1;var O=Math.min(R.lastLine()+1,w.line+500),C=q.scanForClosingTag(R,w,null,O);if(!C||C.tag!=y)return!1;for(var p=L?1:0,l=_.length-1;l>=0&&_[l]==y;l--)++p;w=C.to;for(var l=1;l<p;l++){var a=q.scanForClosingTag(R,w,null,O);if(!a||a.tag!=y)return!1;w=a.to}return!0}})},BjJ7:function(Dt,at,Z){"use strict";Z.d(at,"d",function(){return K}),Z.d(at,"c",function(){return A}),Z.d(at,"e",function(){return F}),Z.d(at,"b",function(){return T}),Z.d(at,"a",function(){return U});var q=Z("m3rI");function K(I){var R=!0;if(I.length>0){for(var _=0;_<I.length;_++)if(I[_].compile_success==0||!I[_].compile_success){R=!1;break}}else R=!1;return R}function A(I){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],y=0;y<I.length;y++){var w=I[y],L=R?"".concat(R,"/").concat(w.name):"".concat(w.name);_.push({title:w.name,isLeaf:!(w.type==="tree"),key:L})}return _}function F(I,R,_){for(var y=0;y<I.length;y++){var w=I[y];if(w.key===R){w.children=_;break}w.children&&F(w.children,R,_)}return I}function T(I,R,_){var y;return function(){var w=this,L=arguments,O=function(){y=null,_||I.apply(w,L)},C=_&&!y;clearTimeout(y),y=setTimeout(O,R),C&&I.apply(w,L)}}var M=!0,U=q.a.API_SERVER},"C+DQ":function(Dt,at,Z){},DlQD:function(Dt,at,Z){(function(q,K){Dt.exports=K()})(this,function(){"use strict";function q(be,de){for(var he=0;he<de.length;he++){var $=de[he];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(be,$.key,$)}}function K(be,de,he){return de&&q(be.prototype,de),he&&q(be,he),be}function A(be,de){if(!be)return;if(typeof be=="string")return F(be,de);var he=Object.prototype.toString.call(be).slice(8,-1);if(he==="Object"&&be.constructor&&(he=be.constructor.name),he==="Map"||he==="Set")return Array.from(be);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return F(be,de)}function F(be,de){(de==null||de>be.length)&&(de=be.length);for(var he=0,$=new Array(de);he<de;he++)$[he]=be[he];return $}function T(be,de){var he;if(typeof Symbol=="undefined"||be[Symbol.iterator]==null){if(Array.isArray(be)||(he=A(be))||de&&be&&typeof be.length=="number"){he&&(be=he);var $=0;return function(){return $>=be.length?{done:!0}:{done:!1,value:be[$++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return he=be[Symbol.iterator](),he.next.bind(he)}function M(be,de){return de={exports:{}},be(de,de.exports),de.exports}var U=M(function(be){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 he($){be.exports.defaults=$}be.exports={defaults:de(),getDefaults:de,changeDefaults:he}}),I=U.defaults,R=U.getDefaults,_=U.changeDefaults,y=/[&<>"']/,w=/[&<>"']/g,L=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,C={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(de){return C[de]};function l(be,de){if(de){if(y.test(be))return be.replace(w,p)}else if(L.test(be))return be.replace(O,p);return be}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(be){return be.replace(a,function(de,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var u=/(^|[^\[])\^/g;function b(be,de){be=be.source||be,de=de||"";var he={replace:function(J,re){return re=re.source||re,re=re.replace(u,"$1"),be=be.replace(J,re),he},getRegex:function(){return new RegExp(be,de)}};return he}var m=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(be,de,he){if(be){var $;try{$=decodeURIComponent(s(he)).replace(m,"").toLowerCase()}catch(J){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}de&&!h.test(he)&&(he=o(de,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch(J){return null}return he}var v={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(be,de){v[" "+be]||(c.test(be)?v[" "+be]=be+"/":v[" "+be]=P(be,"/",!0)),be=v[" "+be];var he=be.indexOf(":")===-1;return de.substring(0,2)==="//"?he?de:be.replace(f,"$1")+de:de.charAt(0)==="/"?he?de:be.replace(d,"$1")+de:be+de}var E={exec:function(){}};function g(be){for(var de=1,he,$;de<arguments.length;de++){he=arguments[de];for($ in he)Object.prototype.hasOwnProperty.call(he,$)&&(be[$]=he[$])}return be}function S(be,de){var he=be.replace(/\|/g,function(re,le,ve){for(var Le=!1,Fe=le;--Fe>=0&&ve[Fe]==="\\";)Le=!Le;return Le?"|":" |"}),$=he.split(/ \|/),J=0;if($.length>de)$.splice(de);else for(;$.length<de;)$.push("");for(;J<$.length;J++)$[J]=$[J].trim().replace(/\\\|/g,"|");return $}function P(be,de,he){var $=be.length;if($===0)return"";for(var J=0;J<$;){var re=be.charAt($-J-1);if(re===de&&!he)J++;else if(re!==de&&he)J++;else break}return be.substr(0,$-J)}function B(be,de){if(be.indexOf(de[1])===-1)return-1;for(var he=be.length,$=0,J=0;J<he;J++)if(be[J]==="\\")J++;else if(be[J]===de[0])$++;else if(be[J]===de[1]&&($--,$<0))return J;return-1}function H(be){be&&be.sanitize&&!be.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 Y={escape:l,unescape:s,edit:b,cleanUrl:D,resolveUrl:o,noopTest:E,merge:g,splitCells:S,rtrim:P,findClosingBracket:B,checkSanitizeDeprecation:H},j=U.defaults,N=Y.rtrim,Q=Y.splitCells,ne=Y.escape,pe=Y.findClosingBracket;function xe(be,de,he){var $=de.href,J=de.title?ne(de.title):null,re=be[1].replace(/\\([\[\]])/g,"$1");return be[0].charAt(0)!=="!"?{type:"link",raw:he,href:$,title:J,text:re}:{type:"image",raw:he,href:$,title:J,text:ne(re)}}function Ie(be,de){var he=be.match(/^(\s+)(?:```)/);if(he===null)return de;var $=he[1];return de.split(`
|
|
`).map(function(J){var re=J.match(/^\s+/);if(re===null)return J;var le=re[0];return le.length>=$.length?J.slice($.length):J}).join(`
|
|
`)}var Ae=function(){function be(he){this.options=he||j}var de=be.prototype;return de.space=function($){var J=this.rules.block.newline.exec($);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
|
|
`}},de.code=function($,J){var re=this.rules.block.code.exec($);if(re){var le=J[J.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var ve=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?ve:N(ve,`
|
|
`)}}},de.fences=function($){var J=this.rules.block.fences.exec($);if(J){var re=J[0],le=Ie(re,J[3]||"");return{type:"code",raw:re,lang:J[2]?J[2].trim():J[2],text:le}}},de.heading=function($){var J=this.rules.block.heading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},de.nptable=function($){var J=this.rules.block.nptable.exec($);if(J){var re={type:"table",header:Q(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(re.header.length===re.align.length){var le=re.align.length,ve;for(ve=0;ve<le;ve++)/^ *-+: *$/.test(re.align[ve])?re.align[ve]="right":/^ *:-+: *$/.test(re.align[ve])?re.align[ve]="center":/^ *:-+ *$/.test(re.align[ve])?re.align[ve]="left":re.align[ve]=null;for(le=re.cells.length,ve=0;ve<le;ve++)re.cells[ve]=Q(re.cells[ve],re.header.length);return re}}},de.hr=function($){var J=this.rules.block.hr.exec($);if(J)return{type:"hr",raw:J[0]}},de.blockquote=function($){var J=this.rules.block.blockquote.exec($);if(J){var re=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:re}}},de.list=function($){var J=this.rules.block.list.exec($);if(J){for(var re=J[0],le=J[2],ve=le.length>1,Le=le[le.length-1]===")",Fe={type:"list",raw:re,ordered:ve,start:ve?+le.slice(0,-1):"",loose:!1,items:[]},it=J[0].match(this.rules.block.item),xt=!1,gt,Zt,Rt,Tt,nr,Xt,Cr,Or=it.length,It=0;It<Or;It++)gt=it[It],re=gt,Zt=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) */,""),~gt.indexOf(`
|
|
`)&&(Zt-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+Zt+"}","gm"),"")),It!==Or-1&&(Rt=this.rules.block.bullet.exec(it[It+1])[0],(ve?Rt.length===1||!Le&&Rt[Rt.length-1]===")":Rt.length>1||this.options.smartLists&&Rt!==le)&&(Tt=it.slice(It+1).join(`
|
|
`),Fe.raw=Fe.raw.substring(0,Fe.raw.length-Tt.length),It=Or-1)),nr=xt||/\n\n(?!\s*$)/.test(gt),It!==Or-1&&(xt=gt.charAt(gt.length-1)===`
|
|
`,nr||(nr=xt)),nr&&(Fe.loose=!0),Xt=/^\[[ xX]\] /.test(gt),Cr=void 0,Xt&&(Cr=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,"")),Fe.items.push({type:"list_item",raw:re,task:Xt,checked:Cr,loose:nr,text:gt});return Fe}},de.html=function($){var J=this.rules.block.html.exec($);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):ne(J[0]):J[0]}},de.def=function($){var J=this.rules.block.def.exec($);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var re=J[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:J[0],href:J[2],title:J[3]}}},de.table=function($){var J=this.rules.block.table.exec($);if(J){var re={type:"table",header:Q(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=J[0];var le=re.align.length,ve;for(ve=0;ve<le;ve++)/^ *-+: *$/.test(re.align[ve])?re.align[ve]="right":/^ *:-+: *$/.test(re.align[ve])?re.align[ve]="center":/^ *:-+ *$/.test(re.align[ve])?re.align[ve]="left":re.align[ve]=null;for(le=re.cells.length,ve=0;ve<le;ve++)re.cells[ve]=Q(re.cells[ve].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},de.lheading=function($){var J=this.rules.block.lheading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},de.paragraph=function($){var J=this.rules.block.paragraph.exec($);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
|
|
`?J[1].slice(0,-1):J[1]}},de.text=function($,J){var re=this.rules.block.text.exec($);if(re){var le=J[J.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},de.escape=function($){var J=this.rules.inline.escape.exec($);if(J)return{type:"escape",raw:J[0],text:ne(J[1])}},de.tag=function($,J,re){var le=this.rules.inline.tag.exec($);if(le)return!J&&/^<a /i.test(le[0])?J=!0:J&&/^<\/a>/i.test(le[0])&&(J=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:J,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):ne(le[0]):le[0]}},de.link=function($){var J=this.rules.inline.link.exec($);if(J){var re=pe(J[2],"()");if(re>-1){var le=J[0].indexOf("!")===0?5:4,ve=le+J[1].length+re;J[2]=J[2].substring(0,re),J[0]=J[0].substring(0,ve).trim(),J[3]=""}var Le=J[2],Fe="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);it?(Le=it[1],Fe=it[3]):Fe=""}else Fe=J[3]?J[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var xt=xe(J,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Fe&&Fe.replace(this.rules.inline._escapes,"$1")},J[0]);return xt}},de.reflink=function($,J){var re;if((re=this.rules.inline.reflink.exec($))||(re=this.rules.inline.nolink.exec($))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=J[le.toLowerCase()],!le||!le.href){var ve=re[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Le=xe(re,le,re[0]);return Le}},de.strong=function($,J,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec($);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){J=J.slice(-1*$.length);var ve=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Le;(le=ve.exec(J))!=null;)if(Le=this.rules.inline.strong.middle.exec(J.slice(0,le.index+3)),Le)return{type:"strong",raw:$.slice(0,Le[0].length),text:$.slice(2,Le[0].length-2)}}},de.em=function($,J,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec($);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){J=J.slice(-1*$.length);var ve=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Le;(le=ve.exec(J))!=null;)if(Le=this.rules.inline.em.middle.exec(J.slice(0,le.index+2)),Le)return{type:"em",raw:$.slice(0,Le[0].length),text:$.slice(1,Le[0].length-1)}}},de.codespan=function($){var J=this.rules.inline.code.exec($);if(J){var re=J[2].replace(/\n/g," "),le=/[^ ]/.test(re),ve=re.startsWith(" ")&&re.endsWith(" ");return le&&ve&&(re=re.substring(1,re.length-1)),re=ne(re,!0),{type:"codespan",raw:J[0],text:re}}},de.br=function($){var J=this.rules.inline.br.exec($);if(J)return{type:"br",raw:J[0]}},de.del=function($){var J=this.rules.inline.del.exec($);if(J)return{type:"del",raw:J[0],text:J[1]}},de.autolink=function($,J){var re=this.rules.inline.autolink.exec($);if(re){var le,ve;return re[2]==="@"?(le=ne(this.options.mangle?J(re[1]):re[1]),ve="mailto:"+le):(le=ne(re[1]),ve=le),{type:"link",raw:re[0],text:le,href:ve,tokens:[{type:"text",raw:le,text:le}]}}},de.url=function($,J){var re;if(re=this.rules.inline.url.exec($)){var le,ve;if(re[2]==="@")le=ne(this.options.mangle?J(re[0]):re[0]),ve="mailto:"+le;else{var Le;do Le=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Le!==re[0]);le=ne(re[0]),re[1]==="www."?ve="http://"+le:ve=le}return{type:"link",raw:re[0],text:le,href:ve,tokens:[{type:"text",raw:le,text:le}]}}},de.inlineText=function($,J,re){var le=this.rules.inline.text.exec($);if(le){var ve;return J?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):ne(le[0]):le[0]:ve=ne(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:ve}}},be}(),De=Y.noopTest,Ce=Y.edit,Oe=Y.merge,ce={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:De,table:De,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=Ce(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=Ce(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=Ce(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=Ce(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=Ce(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=Ce(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=Oe({},ce),ce.gfm=Oe({},ce.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*|$)"}),ce.gfm.nptable=Ce(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=Ce(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=Oe({},ce.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._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:De,paragraph:Ce(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var fe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:De,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:De,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};fe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",fe.punctuation=Ce(fe.punctuation).replace(/punctuation/g,fe._punctuation).getRegex(),fe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",fe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",fe.em.start=Ce(fe.em.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.middle=Ce(fe.em.middle).replace(/punctuation/g,fe._punctuation).replace(/overlapSkip/g,fe._overlapSkip).getRegex(),fe.em.endAst=Ce(fe.em.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.endUnd=Ce(fe.em.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.start=Ce(fe.strong.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.middle=Ce(fe.strong.middle).replace(/punctuation/g,fe._punctuation).replace(/blockSkip/g,fe._blockSkip).getRegex(),fe.strong.endAst=Ce(fe.strong.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.endUnd=Ce(fe.strong.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.blockSkip=Ce(fe._blockSkip,"g").getRegex(),fe.overlapSkip=Ce(fe._overlapSkip,"g").getRegex(),fe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,fe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,fe._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])?)+(?![-_])/,fe.autolink=Ce(fe.autolink).replace("scheme",fe._scheme).replace("email",fe._email).getRegex(),fe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,fe.tag=Ce(fe.tag).replace("comment",ce._comment).replace("attribute",fe._attribute).getRegex(),fe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,fe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,fe.link=Ce(fe.link).replace("label",fe._label).replace("href",fe._href).replace("title",fe._title).getRegex(),fe.reflink=Ce(fe.reflink).replace("label",fe._label).getRegex(),fe.reflinkSearch=Ce(fe.reflinkSearch,"g").replace("reflink",fe.reflink).replace("nolink",fe.nolink).getRegex(),fe.normal=Oe({},fe),fe.pedantic=Oe({},fe.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:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",fe._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fe._label).getRegex()}),fe.gfm=Oe({},fe.normal,{escape:Ce(fe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),fe.gfm.url=Ce(fe.gfm.url,"i").replace("email",fe.gfm._extended_email).getRegex(),fe.breaks=Oe({},fe.gfm,{br:Ce(fe.br).replace("{2,}","*").getRegex(),text:Ce(fe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Pe={block:ce,inline:fe},qe=U.defaults,Ve=Pe.block,Ze=Pe.inline;function ct(be){return be.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function je(be){var de="",he,$,J=be.length;for(he=0;he<J;he++)$=be.charCodeAt(he),Math.random()>.5&&($="x"+$.toString(16)),de+="&#"+$+";";return de}var Be=function(){function be(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||qe,this.options.tokenizer=this.options.tokenizer||new Ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Ve.normal,inline:Ze.normal};this.options.pedantic?($.block=Ve.pedantic,$.inline=Ze.pedantic):this.options.gfm&&($.block=Ve.gfm,this.options.breaks?$.inline=Ze.breaks:$.inline=Ze.gfm),this.tokenizer.rules=$}be.lex=function($,J){var re=new be(J);return re.lex($)};var de=be.prototype;return de.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function($,J,re){J===void 0&&(J=[]),re===void 0&&(re=!0),$=$.replace(/^ +$/gm,"");for(var le,ve,Le,Fe;$;){if(le=this.tokenizer.space($)){$=$.substring(le.raw.length),le.type&&J.push(le);continue}if(le=this.tokenizer.code($,J)){$=$.substring(le.raw.length),le.type?J.push(le):(Fe=J[J.length-1],Fe.raw+=`
|
|
`+le.raw,Fe.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences($)){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.heading($)){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.nptable($)){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.hr($)){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.blockquote($)){$=$.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),J.push(le);continue}if(le=this.tokenizer.list($)){for($=$.substring(le.raw.length),Le=le.items.length,ve=0;ve<Le;ve++)le.items[ve].tokens=this.blockTokens(le.items[ve].text,[],!1);J.push(le);continue}if(le=this.tokenizer.html($)){$=$.substring(le.raw.length),J.push(le);continue}if(re&&(le=this.tokenizer.def($))){$=$.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table($)){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.lheading($)){$=$.substring(le.raw.length),J.push(le);continue}if(re&&(le=this.tokenizer.paragraph($))){$=$.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.text($,J)){$=$.substring(le.raw.length),le.type?J.push(le):(Fe=J[J.length-1],Fe.raw+=`
|
|
`+le.raw,Fe.text+=`
|
|
`+le.text);continue}if($){var it="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return J},de.inline=function($){var J,re,le,ve,Le,Fe,it=$.length;for(J=0;J<it;J++){Fe=$[J];switch(Fe.type){case"paragraph":case"text":case"heading":{Fe.tokens=[],this.inlineTokens(Fe.text,Fe.tokens);break}case"table":{for(Fe.tokens={header:[],cells:[]},ve=Fe.header.length,re=0;re<ve;re++)Fe.tokens.header[re]=[],this.inlineTokens(Fe.header[re],Fe.tokens.header[re]);for(ve=Fe.cells.length,re=0;re<ve;re++)for(Le=Fe.cells[re],Fe.tokens.cells[re]=[],le=0;le<Le.length;le++)Fe.tokens.cells[re][le]=[],this.inlineTokens(Le[le],Fe.tokens.cells[re][le]);break}case"blockquote":{this.inline(Fe.tokens);break}case"list":{for(ve=Fe.items.length,re=0;re<ve;re++)this.inline(Fe.items[re].tokens);break}}}return $},de.inlineTokens=function($,J,re,le,ve){J===void 0&&(J=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),ve===void 0&&(ve="");var Le,Fe=$,it;if(this.tokens.links){var xt=Object.keys(this.tokens.links);if(xt.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(Fe))!=null;)xt.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(Fe=Fe.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+Fe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(Fe))!=null;)Fe=Fe.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+Fe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Le=this.tokenizer.escape($)){$=$.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.tag($,re,le)){$=$.substring(Le.raw.length),re=Le.inLink,le=Le.inRawBlock,J.push(Le);continue}if(Le=this.tokenizer.link($)){$=$.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,le)),J.push(Le);continue}if(Le=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,le)),J.push(Le);continue}if(Le=this.tokenizer.strong($,Fe,ve)){$=$.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],re,le),J.push(Le);continue}if(Le=this.tokenizer.em($,Fe,ve)){$=$.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],re,le),J.push(Le);continue}if(Le=this.tokenizer.codespan($)){$=$.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.br($)){$=$.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.del($)){$=$.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],re,le),J.push(Le);continue}if(Le=this.tokenizer.autolink($,je)){$=$.substring(Le.raw.length),J.push(Le);continue}if(!re&&(Le=this.tokenizer.url($,je))){$=$.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.inlineText($,le,ct)){$=$.substring(Le.raw.length),ve=Le.raw.slice(-1),J.push(Le);continue}if($){var gt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(gt);break}else throw new Error(gt)}}return J},K(be,null,[{key:"rules",get:function(){return{block:Ve,inline:Ze}}}]),be}(),Xe=U.defaults,et=Y.cleanUrl,Qe=Y.escape,Ne=function(){function be(he){this.options=he||Xe}var de=be.prototype;return de.code=function($,J,re){var le=(J||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight($,le);ve!=null&&ve!==$&&(re=!0,$=ve)}return le?'<pre><code class="'+this.options.langPrefix+Qe(le,!0)+'">'+(re?$:Qe($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?$:Qe($,!0))+`</code></pre>
|
|
`},de.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},de.html=function($){return $},de.heading=function($,J,re,le){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+le.slug(re)+'">'+$+"</h"+J+`>
|
|
`:"<h"+J+">"+$+"</h"+J+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function($,J,re){var le=J?"ol":"ul",ve=J&&re!==1?' start="'+re+'"':"";return"<"+le+ve+`>
|
|
`+$+"</"+le+`>
|
|
`},de.listitem=function($){return"<li>"+$+`</li>
|
|
`},de.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function($){return"<p>"+$+`</p>
|
|
`},de.table=function($,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+J+`</table>
|
|
`},de.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},de.tablecell=function($,J){var re=J.header?"th":"td",le=J.align?"<"+re+' align="'+J.align+'">':"<"+re+">";return le+$+"</"+re+`>
|
|
`},de.strong=function($){return"<strong>"+$+"</strong>"},de.em=function($){return"<em>"+$+"</em>"},de.codespan=function($){return"<code>"+$+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function($){return"<del>"+$+"</del>"},de.link=function($,J,re){if($=et(this.options.sanitize,this.options.baseUrl,$),$===null)return re;var le='<a href="'+Qe($)+'"';return J&&(le+=' title="'+J+'"'),le+=">"+re+"</a>",le},de.image=function($,J,re){if($=et(this.options.sanitize,this.options.baseUrl,$),$===null)return re;var le='<img src="'+$+'" alt="'+re+'"';return J&&(le+=' title="'+J+'"'),le+=this.options.xhtml?"/>":">",le},de.text=function($){return $},be}(),Ue=function(){function be(){}var de=be.prototype;return de.strong=function($){return $},de.em=function($){return $},de.codespan=function($){return $},de.del=function($){return $},de.html=function($){return $},de.text=function($){return $},de.link=function($,J,re){return""+re},de.image=function($,J,re){return""+re},de.br=function(){return""},be}(),lt=function(){function be(){this.seen={}}var de=be.prototype;return de.slug=function($){var J=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var re=J;do this.seen[re]++,J=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},be}(),ut=U.defaults,ot=Y.unescape,Je=function(){function be(he){this.options=he||ut,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new lt}be.parse=function($,J){var re=new be(J);return re.parse($)};var de=be.prototype;return de.parse=function($,J){J===void 0&&(J=!0);var re="",le,ve,Le,Fe,it,xt,gt,Zt,Rt,Tt,nr,Xt,Cr,Or,It,$r,tn,Qr,dn=$.length;for(le=0;le<dn;le++){Tt=$[le];switch(Tt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(Tt.tokens),Tt.depth,ot(this.parseInline(Tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(Tt.text,Tt.lang,Tt.escaped);continue}case"table":{for(Zt="",gt="",Fe=Tt.header.length,ve=0;ve<Fe;ve++)gt+=this.renderer.tablecell(this.parseInline(Tt.tokens.header[ve]),{header:!0,align:Tt.align[ve]});for(Zt+=this.renderer.tablerow(gt),Rt="",Fe=Tt.cells.length,ve=0;ve<Fe;ve++){for(xt=Tt.tokens.cells[ve],gt="",it=xt.length,Le=0;Le<it;Le++)gt+=this.renderer.tablecell(this.parseInline(xt[Le]),{header:!1,align:Tt.align[Le]});Rt+=this.renderer.tablerow(gt)}re+=this.renderer.table(Zt,Rt);continue}case"blockquote":{Rt=this.parse(Tt.tokens),re+=this.renderer.blockquote(Rt);continue}case"list":{for(nr=Tt.ordered,Xt=Tt.start,Cr=Tt.loose,Fe=Tt.items.length,Rt="",ve=0;ve<Fe;ve++)It=Tt.items[ve],$r=It.checked,tn=It.task,Or="",It.task&&(Qr=this.renderer.checkbox($r),Cr?It.tokens.length>0&&It.tokens[0].type==="text"?(It.tokens[0].text=Qr+" "+It.tokens[0].text,It.tokens[0].tokens&&It.tokens[0].tokens.length>0&&It.tokens[0].tokens[0].type==="text"&&(It.tokens[0].tokens[0].text=Qr+" "+It.tokens[0].tokens[0].text)):It.tokens.unshift({type:"text",text:Qr}):Or+=Qr),Or+=this.parse(It.tokens,Cr),Rt+=this.renderer.listitem(Or,tn,$r);re+=this.renderer.list(Rt,nr,Xt);continue}case"html":{re+=this.renderer.html(Tt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(Tt.tokens));continue}case"text":{for(Rt=Tt.tokens?this.parseInline(Tt.tokens):Tt.text;le+1<dn&&$[le+1].type==="text";)Tt=$[++le],Rt+=`
|
|
`+(Tt.tokens?this.parseInline(Tt.tokens):Tt.text);re+=J?this.renderer.paragraph(Rt):Rt;continue}default:{var bn='Token with "'+Tt.type+'" type was not found.';if(this.options.silent){console.error(bn);return}else throw new Error(bn)}}}return re},de.parseInline=function($,J){J=J||this.renderer;var re="",le,ve,Le=$.length;for(le=0;le<Le;le++){ve=$[le];switch(ve.type){case"escape":{re+=J.text(ve.text);break}case"html":{re+=J.html(ve.text);break}case"link":{re+=J.link(ve.href,ve.title,this.parseInline(ve.tokens,J));break}case"image":{re+=J.image(ve.href,ve.title,ve.text);break}case"strong":{re+=J.strong(this.parseInline(ve.tokens,J));break}case"em":{re+=J.em(this.parseInline(ve.tokens,J));break}case"codespan":{re+=J.codespan(ve.text);break}case"br":{re+=J.br();break}case"del":{re+=J.del(this.parseInline(ve.tokens,J));break}case"text":{re+=J.text(ve.text);break}default:{var Fe='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(Fe);return}else throw new Error(Fe)}}}return re},be}(),vt=Y.merge,ft=Y.checkSanitizeDeprecation,st=Y.escape,_e=U.getDefaults,pt=U.changeDefaults,dt=U.defaults;function Re(be,de,he){if(typeof be=="undefined"||be===null)throw new Error("marked(): input parameter is undefined or null");if(typeof be!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(be)+", string expected");if(typeof de=="function"&&(he=de,de=null),de=vt({},Re.defaults,de||{}),ft(de),he){var $=de.highlight,J;try{J=Be.lex(be,de)}catch(Le){return he(Le)}var re=function(Fe){var it;if(!Fe)try{it=Je.parse(J,de)}catch(xt){Fe=xt}return de.highlight=$,Fe?he(Fe):he(null,it)};if(!$||$.length<3)return re();if(delete de.highlight,!J.length)return re();var le=0;Re.walkTokens(J,function(Le){Le.type==="code"&&(le++,setTimeout(function(){$(Le.text,Le.lang,function(Fe,it){if(Fe)return re(Fe);it!=null&&it!==Le.text&&(Le.text=it,Le.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var ve=Be.lex(be,de);return de.walkTokens&&Re.walkTokens(ve,de.walkTokens),Je.parse(ve,de)}catch(Le){if(Le.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+st(Le.message+"",!0)+"</pre>";throw Le}}Re.options=Re.setOptions=function(be){return vt(Re.defaults,be),pt(Re.defaults),Re},Re.getDefaults=_e,Re.defaults=dt,Re.use=function(be){var de=vt({},be);if(be.renderer&&function(){var $=Re.defaults.renderer||new Ne,J=function(ve){var Le=$[ve];$[ve]=function(){for(var Fe=arguments.length,it=new Array(Fe),xt=0;xt<Fe;xt++)it[xt]=arguments[xt];var gt=be.renderer[ve].apply($,it);return gt===!1&&(gt=Le.apply($,it)),gt}};for(var re in be.renderer)J(re);de.renderer=$}(),be.tokenizer&&function(){var $=Re.defaults.tokenizer||new Ae,J=function(ve){var Le=$[ve];$[ve]=function(){for(var Fe=arguments.length,it=new Array(Fe),xt=0;xt<Fe;xt++)it[xt]=arguments[xt];var gt=be.tokenizer[ve].apply($,it);return gt===!1&&(gt=Le.apply($,it)),gt}};for(var re in be.tokenizer)J(re);de.tokenizer=$}(),be.walkTokens){var he=Re.defaults.walkTokens;de.walkTokens=function($){be.walkTokens($),he&&he($)}}Re.setOptions(de)},Re.walkTokens=function(be,de){for(var he=T(be),$;!($=he()).done;){var J=$.value;de(J);switch(J.type){case"table":{for(var re=T(J.tokens.header),le;!(le=re()).done;){var ve=le.value;Re.walkTokens(ve,de)}for(var Le=T(J.tokens.cells),Fe;!(Fe=Le()).done;)for(var it=Fe.value,xt=T(it),gt;!(gt=xt()).done;){var Zt=gt.value;Re.walkTokens(Zt,de)}break}case"list":{Re.walkTokens(J.items,de);break}default:J.tokens&&Re.walkTokens(J.tokens,de)}}},Re.Parser=Je,Re.parser=Je.parse,Re.Renderer=Ne,Re.TextRenderer=Ue,Re.Lexer=Be,Re.lexer=Be.lex,Re.Tokenizer=Ae,Re.Slugger=lt,Re.parse=Re;var Ke=Re;return Ke})},ELLl:function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=q.Pos;q.defineOption("autoCloseBrackets",!1,function(C,p,l){l&&l!=q.Init&&(C.removeKeyMap(T),C.state.closeBrackets=null),p&&(M(F(p,"pairs")),C.state.closeBrackets=p,C.addKeyMap(T))});function F(C,p){return p=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[p]!=null?C[p]:K[p]}var T={Backspace:R,Enter:_};function M(C){for(var p=0;p<C.length;p++){var l=C.charAt(p),a="'"+l+"'";T[a]||(T[a]=U(l))}}M(K.pairs+"`");function U(C){return function(p){return w(p,C)}}function I(C){var p=C.state.closeBrackets;if(!p||p.override)return p;var l=C.getModeAt(C.getCursor());return l.closeBrackets||p}function R(C){var p=I(C);if(!p||C.getOption("disableInput"))return q.Pass;for(var l=F(p,"pairs"),a=C.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return q.Pass;var u=L(C,a[s].head);if(!u||l.indexOf(u)%2!=0)return q.Pass}for(var s=a.length-1;s>=0;s--){var b=a[s].head;C.replaceRange("",A(b.line,b.ch-1),A(b.line,b.ch+1),"+delete")}}function _(C){var p=I(C),l=p&&F(p,"explode");if(!l||C.getOption("disableInput"))return q.Pass;for(var a=C.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return q.Pass;var u=L(C,a[s].head);if(!u||l.indexOf(u)%2!=0)return q.Pass}C.operation(function(){var b=C.lineSeparator()||`
|
|
`;C.replaceSelection(b+b,null),C.execCommand("goCharLeft"),a=C.listSelections();for(var m=0;m<a.length;m++){var h=a[m].head.line;C.indentLine(h,null,!0),C.indentLine(h+1,null,!0)}})}function y(C){var p=q.cmpPos(C.anchor,C.head)>0;return{anchor:new A(C.anchor.line,C.anchor.ch+(p?-1:1)),head:new A(C.head.line,C.head.ch+(p?1:-1))}}function w(C,p){var l=I(C);if(!l||C.getOption("disableInput"))return q.Pass;var a=F(l,"pairs"),s=a.indexOf(p);if(s==-1)return q.Pass;for(var u=F(l,"closeBefore"),b=F(l,"triples"),m=a.charAt(s+1)==p,h=C.listSelections(),D=s%2==0,v,c=0;c<h.length;c++){var f=h[c],d=f.head,o,E=C.getRange(d,A(d.line,d.ch+1));if(D&&!f.empty())o="surround";else if((m||!D)&&E==p)m&&O(C,d)?o="both":b.indexOf(p)>=0&&C.getRange(d,A(d.line,d.ch+3))==p+p+p?o="skipThree":o="skip";else if(m&&d.ch>1&&b.indexOf(p)>=0&&C.getRange(A(d.line,d.ch-2),d)==p+p){if(d.ch>2&&/\bstring/.test(C.getTokenTypeAt(A(d.line,d.ch-2))))return q.Pass;o="addFour"}else if(m){var g=d.ch==0?" ":C.getRange(A(d.line,d.ch-1),d);if(!q.isWordChar(E)&&g!=p&&!q.isWordChar(g))o="both";else return q.Pass}else if(D&&(E.length===0||/\s/.test(E)||u.indexOf(E)>-1))o="both";else return q.Pass;if(!v)v=o;else if(v!=o)return q.Pass}var S=s%2?a.charAt(s-1):p,P=s%2?p:a.charAt(s+1);C.operation(function(){if(v=="skip")C.execCommand("goCharRight");else if(v=="skipThree")for(var B=0;B<3;B++)C.execCommand("goCharRight");else if(v=="surround"){for(var H=C.getSelections(),B=0;B<H.length;B++)H[B]=S+H[B]+P;C.replaceSelections(H,"around"),H=C.listSelections().slice();for(var B=0;B<H.length;B++)H[B]=y(H[B]);C.setSelections(H)}else v=="both"?(C.replaceSelection(S+P,null),C.triggerElectric(S+P),C.execCommand("goCharLeft")):v=="addFour"&&(C.replaceSelection(S+S+S+S,"before"),C.execCommand("goCharRight"))})}function L(C,p){var l=C.getRange(A(p.line,p.ch-1),A(p.line,p.ch+1));return l.length==2?l:null}function O(C,p){var l=C.getTokenAt(A(p.line,p.ch+1));return/\bstring/.test(l.type)&&l.start==p.ch&&(p.ch==0||!/\bstring/.test(C.getTokenTypeAt(p)))}})},F8wB:function(Dt,at,Z){Dt.exports={loading:"loading___1SIOG"}},Gytx:function(Dt,at){Dt.exports=function(q,K,A,F){var T=A?A.call(F,q,K):void 0;if(T!==void 0)return!!T;if(q===K)return!0;if(typeof q!="object"||!q||typeof K!="object"||!K)return!1;var M=Object.keys(q),U=Object.keys(K);if(M.length!==U.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind(K),R=0;R<M.length;R++){var _=M[R];if(!I(_))return!1;var y=q[_],w=K[_];if(T=A?A.call(F,y,w,_):void 0,T===!1||T===void 0&&y!==w)return!1}return!0}},HmJG:function(Dt,at,Z){},I8Z2:function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return F}),Z.d(at,"b",function(){return L}),Z.d(at,"c",function(){return C});var q=Z("cDcd"),K=function(){var p=function(l,a){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var b in u)u.hasOwnProperty(b)&&(s[b]=u[b])},p(l,a)};return function(l,a){p(l,a);function s(){this.constructor=l}l.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)}}(),A=q.createContext(null),F=function(p){K(l,p);function l(){return p!==null&&p.apply(this,arguments)||this}return l.prototype.render=function(){return q.createElement(A.Provider,{value:this.props.store},this.props.children)},l}(q.Component),T=Z("Gytx"),M=Z.n(T),U=Z("2mql"),I=Z.n(U),R=function(){var p=function(l,a){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var b in u)u.hasOwnProperty(b)&&(s[b]=u[b])},p(l,a)};return function(l,a){p(l,a);function s(){this.constructor=l}l.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)}}(),_=function(){return _=Object.assign||function(p){for(var l,a=1,s=arguments.length;a<s;a++){l=arguments[a];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(p[u]=l[u])}return p},_.apply(this,arguments)};function y(p){return p.displayName||p.name||"Component"}var w=function(){return{}};function L(p,l){l===void 0&&(l={});var a=!!p,s=p||w;return function(b){var m=function(D){R(v,D);function v(c,f){var d=D.call(this,c,f)||this;return d.unsubscribe=null,d.handleChange=function(){if(!d.unsubscribe)return;var o=s(d.store.getState(),d.props);d.setState({subscribed:o})},d.store=d.context,d.state={subscribed:s(d.store.getState(),c),store:d.store,props:c},d}return v.getDerivedStateFromProps=function(c,f){return p&&p.length===2&&c!==f.props?{subscribed:s(f.store.getState(),c),props:c}:{props:c}},v.prototype.componentDidMount=function(){this.trySubscribe()},v.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},v.prototype.shouldComponentUpdate=function(c,f){return!M()(this.props,c)||!M()(this.state.subscribed,f.subscribed)},v.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},v.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},v.prototype.render=function(){var c=_(_(_({},this.props),this.state.subscribed),{store:this.store});return q.createElement(b,_({},c,{ref:this.props.miniStoreForwardedRef}))},v.displayName="Connect("+y(b)+")",v.contextType=A,v}(q.Component);if(l.forwardRef){var h=q.forwardRef(function(D,v){return q.createElement(m,_({},D,{miniStoreForwardedRef:v}))});return I()(h,b)}return I()(m,b)}}var O=function(){return O=Object.assign||function(p){for(var l,a=1,s=arguments.length;a<s;a++){l=arguments[a];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(p[u]=l[u])}return p},O.apply(this,arguments)};function C(p){var l=p,a=[];function s(m){l=O(O({},l),m);for(var h=0;h<a.length;h++)a[h]()}function u(){return l}function b(m){return a.push(m),function(){var D=a.indexOf(m);a.splice(D,1)}}return{setState:s,getState:u,subscribe:b}}},LdHM:function(Dt,at,Z){"use strict";Z.d(at,"b",function(){return u}),Z.d(at,"a",function(){return m});var q=Z("1OyB"),K=Z("vuIU"),A=Z("Ji7U"),F=Z("LK+K"),T=Z("cDcd"),M=Z("rePB"),U=Z("Ff2n"),I=Z("ODXe"),R=Z("4IlW"),_=Z("bX4T"),y=Z("YrtM"),w=Z("TSYQ"),L=Z.n(w),O=Z("+nKL"),C=Z("8OUc"),p=function(Q,ne){var pe=Q.prefixCls,xe=Q.id,Ie=Q.flattenOptions,Ae=Q.childrenAsData,De=Q.values,Ce=Q.searchValue,Oe=Q.multiple,ce=Q.defaultActiveFirstOption,fe=Q.height,Pe=Q.itemHeight,qe=Q.notFoundContent,Ve=Q.open,Ze=Q.menuItemSelectedIcon,ct=Q.virtual,je=Q.onSelect,Be=Q.onToggleOpen,Xe=Q.onActiveValue,et=Q.onScroll,Qe=Q.onMouseEnter,Ne="".concat(pe,"-item"),Ue=Object(y.a)(function(){return Ie},[Ve,Ie],function(Ke,be){return be[0]&&Ke[1]!==be[1]}),lt=T.useRef(null),ut=function(be){be.preventDefault()},ot=function(be){lt.current&<.current.scrollTo({index:be})},Je=function(be){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=Ue.length,$=0;$<he;$+=1){var J=(be+$*de+he)%he,re=Ue[J],le=re.group,ve=re.data;if(!le&&!ve.disabled)return J}return-1},vt=T.useState(function(){return Je(0)}),ft=Object(I.a)(vt,2),st=ft[0],_e=ft[1],pt=function(be){_e(be);var de=Ue[be];if(!de){Xe(null,-1);return}Xe(de.data.value,be)};T.useEffect(function(){pt(ce!==!1?Je(0):-1)},[Ue.length,Ce]),T.useEffect(function(){var Ke=setTimeout(function(){if(!Oe&&Ve&&De.size===1){var be=Array.from(De)[0],de=Ue.findIndex(function(he){var $=he.data;return $.value===be});pt(de),ot(de)}});return function(){return clearTimeout(Ke)}},[Ve]);var dt=function(be){be!==void 0&&je(be,{selected:!De.has(be)}),Oe||Be(!1)};if(T.useImperativeHandle(ne,function(){return{onKeyDown:function(be){var de=be.which;switch(de){case R.a.UP:case R.a.DOWN:{var he=0;if(de===R.a.UP?he=-1:de===R.a.DOWN&&(he=1),he!==0){var $=Je(st+he,he);ot($),pt($)}break}case R.a.ENTER:{var J=Ue[st];J&&!J.data.disabled?dt(J.data.value):dt(void 0),Ve&&be.preventDefault();break}case R.a.ESC:Be(!1)}},onKeyUp:function(){},scrollTo:function(be){ot(be)}}}),Ue.length===0)return T.createElement("div",{role:"listbox",id:"".concat(xe,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:ut},qe);function Re(Ke){var be=Ue[Ke];if(!be)return null;var de=be.data||{},he=de.value,$=de.label,J=de.children,re=Object(_.a)(de,!0),le=Ae?J:$;return be?T.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ke,role:"option",id:"".concat(xe,"_list_").concat(Ke),"aria-selected":De.has(he)}),he):null}return T.createElement(T.Fragment,null,T.createElement("div",{role:"listbox",id:"".concat(xe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(st-1),Re(st),Re(st+1)),T.createElement(O.a,{itemKey:"key",ref:lt,data:Ue,height:fe,itemHeight:Pe,fullHeight:!1,onMouseDown:ut,onScroll:et,virtual:ct,onMouseEnter:Qe},function(Ke,be){var de,he=Ke.group,$=Ke.groupOption,J=Ke.data,re=J.label,le=J.key;if(he)return T.createElement("div",{className:L()(Ne,"".concat(Ne,"-group"))},re!==void 0?re:le);var ve=J.disabled,Le=J.value,Fe=J.title,it=J.children,xt=J.style,gt=J.className,Zt=Object(U.a)(J,["disabled","value","title","children","style","className"]),Rt=De.has(Le),Tt="".concat(Ne,"-option"),nr=L()(Ne,Tt,gt,(de={},Object(M.a)(de,"".concat(Tt,"-grouped"),$),Object(M.a)(de,"".concat(Tt,"-active"),st===be&&!ve),Object(M.a)(de,"".concat(Tt,"-disabled"),ve),Object(M.a)(de,"".concat(Tt,"-selected"),Rt),de)),Xt=Ae?it:re,Cr=!Ze||typeof Ze=="function"||Rt;return T.createElement("div",Object.assign({},Zt,{"aria-selected":Rt,className:nr,title:Fe,onMouseMove:function(){if(st===be||ve)return;pt(be)},onClick:function(){ve||dt(Le)},style:xt}),T.createElement("div",{className:"".concat(Tt,"-content")},Xt||Le),T.isValidElement(Ze)||Rt,Cr&&T.createElement(C.a,{className:"".concat(Ne,"-option-state"),customizeIcon:Ze,customizeIconProps:{isSelected:Rt}},Rt?"\u2713":null))}))},l=T.forwardRef(p);l.displayName="OptionList";var a=l,s=function(){return null};s.isSelectOption=!0;var u=s,b=function(){return null};b.isSelectOptGroup=!0;var m=b,h=Z("VTBJ"),D=Z("Zm9Q");function v(N){var Q=N.key,ne=N.props,pe=ne.children,xe=ne.value,Ie=Object(U.a)(ne,["children","value"]);return Object(h.a)({key:Q,value:xe!==void 0?xe:Q,children:pe},Ie)}function c(N){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(N).map(function(ne,pe){if(!T.isValidElement(ne)||!ne.type)return null;var xe=ne.type.isSelectOptGroup,Ie=ne.key,Ae=ne.props,De=Ae.children,Ce=Object(U.a)(Ae,["children"]);return Q||!xe?v(ne):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Ie===null?pe:Ie,"__"),label:Ie},Ce),{},{options:c(De)})}).filter(function(ne){return ne})}var f=Z("2Qr1"),d=Z("qNPg"),o=Z("U8pU"),E=Z("Kwbf"),g=Z("WKfj");function S(N){var Q=N.mode,ne=N.options,pe=N.children,xe=N.backfill,Ie=N.allowClear,Ae=N.placeholder,De=N.getInputElement,Ce=N.showSearch,Oe=N.onSearch,ce=N.defaultOpen,fe=N.autoFocus,Pe=N.labelInValue,qe=N.value,Ve=N.inputValue,Ze=N.optionLabelProp,ct=Q==="multiple"||Q==="tags",je=Ce!==void 0?Ce:ct||Q==="combobox",Be=ne||c(pe);if(Object(E.a)(Q!=="tags"||Be.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Q==="tags"||Q==="combobox"){var Xe=Be.some(function(Ne){return Ne.options?Ne.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(E.a)(!Xe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(Q!=="combobox"||!Ze,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(Q==="combobox"||!xe,"`backfill` only works with `combobox` mode."),Object(E.a)(Q==="combobox"||!De,"`getInputElement` only work with `combobox` mode."),Object(E.b)(Q!=="combobox"||!De||!Ie||!Ae,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Oe&&!je&&Q!=="combobox"&&Q!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!ce||fe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),qe!=null){var et=Object(g.d)(qe);Object(E.a)(!Pe||et.every(function(Ne){return Object(o.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!ct||Array.isArray(qe),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var Qe=null;Object(D.a)(pe).some(function(Ne){if(!T.isValidElement(Ne)||!Ne.type)return!1;var Ue=Ne.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var lt=Object(D.a)(Ne.props.children).every(function(ut){return!T.isValidElement(ut)||!Ne.type||ut.type.isSelectOption?!0:(Qe=ut.type,!1)});return!lt}return Qe=Ue,!0}),Qe&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Qe.displayName||Qe.name||Qe,"`.")),Object(E.a)(Ve===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=S,B=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:P,fillOptionsWithMissingValue:f.a}),H=function(N){Object(A.a)(ne,N);var Q=Object(F.a)(ne);function ne(){var pe;return Object(q.a)(this,ne),pe=Q.apply(this,arguments),pe.selectRef=T.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object(K.a)(ne,[{key:"render",value:function(){return T.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),ne}(T.Component);H.Option=u,H.OptGroup=m;var Y=H,j=at.c=Y},M8RZ:function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return R});var q=Z("fWQN"),K=Z("mtLc"),A=Z("yKVA"),F=Z("879j"),T=Z("cDcd"),M=Z.n(T),U=Z("faye"),I=Z.n(U),R=function(_){Object(A.a)(w,_);var y=Object(F.a)(w);function w(L){var O;Object(q.a)(this,w),O=y.call(this,L);var C=window.document;return O.node=C.createElement("div"),C.body.appendChild(O.node),O}return Object(K.a)(w,[{key:"render",value:function(){var O=this.props.children;return Object(U.createPortal)(O,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(M.a.Component)},OLES:function(Dt,at,Z){"use strict";var q=Z("U8pU"),K=Z("VTBJ"),A=Z("Ff2n"),F=Z("cDcd"),T=Z("uciX"),M=Z("7ixt"),U=function(L){var O=L.overlay,C=L.prefixCls,p=L.id,l=L.overlayInnerStyle;return F.createElement("div",{className:"".concat(C,"-inner"),id:p,role:"tooltip",style:l},typeof O=="function"?O():O)},I=U,R=function(L,O){var C=L.overlayClassName,p=L.trigger,l=p===void 0?["hover"]:p,a=L.mouseEnterDelay,s=a===void 0?0:a,u=L.mouseLeaveDelay,b=u===void 0?.1:u,m=L.overlayStyle,h=L.prefixCls,D=h===void 0?"rc-tooltip":h,v=L.children,c=L.onVisibleChange,f=L.afterVisibleChange,d=L.transitionName,o=L.animation,E=L.placement,g=E===void 0?"right":E,S=L.align,P=S===void 0?{}:S,B=L.destroyTooltipOnHide,H=B===void 0?!1:B,Y=L.defaultVisible,j=L.getTooltipContainer,N=L.overlayInnerStyle,Q=Object(A.a)(L,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ne=Object(F.useRef)(null);Object(F.useImperativeHandle)(O,function(){return ne.current});var pe=Object(K.a)({},Q);"visible"in L&&(pe.popupVisible=L.visible);var xe=function(){var Oe=L.arrowContent,ce=Oe===void 0?null:Oe,fe=L.overlay,Pe=L.id;return[F.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},ce),F.createElement(I,{key:"content",prefixCls:D,id:Pe,overlay:fe,overlayInnerStyle:N})]},Ie=!1,Ae=!1;if(typeof H=="boolean")Ie=H;else if(H&&Object(q.a)(H)==="object"){var De=H.keepParent;Ie=De===!0,Ae=De===!1}return F.createElement(T.a,Object.assign({popupClassName:C,prefixCls:D,popup:xe,action:l,builtinPlacements:M.a,popupPlacement:g,ref:ne,popupAlign:P,getPopupContainer:j,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:o,defaultPopupVisible:Y,destroyPopupOnHide:Ie,autoDestroy:Ae,mouseLeaveDelay:b,popupStyle:m,mouseEnterDelay:s},pe),v)},_=Object(F.forwardRef)(R),y=at.a=_},Ot1p:function(Dt,at,Z){"use strict";var q=Z("2qtc"),K=Z("kLXV"),A=Z("rAM+"),F=Z("miYZ"),T=Z("tsqr"),M=Z("9og8"),U=Z("tJVT"),I=Z("jrin"),R=Z("WmNS"),_=Z.n(R),y=Z("cDcd"),w=Z.n(y),L=Z("VrN/"),O=Z.n(L),C=Z("bdgK"),p=Z("p77/"),l=Z("Bd2K"),a=Z("ELLl"),s=Z("19Vz"),u=Z("lZu9"),b=Z("+NIl"),m=Z("kSUc"),h=Z("9Bee"),D=function(ve){var Le=ve.value,Fe=Le===void 0?"":Le,it=ve.className,xt=ve.showTextOnly,gt=ve.showLines,Zt=ve.style,Rt=Zt===void 0?{}:Zt,Tt=Object(y.useMemo)(function(){return""},[Fe]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:Tt}}))},v=Z("0Owb"),c=Z("dejd"),f=Z("C+DQ"),d=Z("1vsH"),o=Z("m3rI"),E=[{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 g(ve){var Le=ve.onActionCallback,Fe=ve.title,it=ve.icon,xt=ve.actionName,gt=ve.className,Zt=gt===void 0?"":gt,Rt=ve.children;function Tt(){Le(xt)}return w.a.createElement("a",{title:Fe,className:Zt,onClick:Tt},w.a.createElement("i",{className:"md-iconfont ".concat(it)}),Rt)}var S=function(ve){var Le=ve.watch,Fe=ve.showNullButton,it=ve.onActionCallback,xt=ve.fullScreen,gt=ve.insertTemp,Zt=ve.hidetoolBar,Rt=ve.uuid,Tt=ve.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(Rt,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var nr=[].concat(E,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!Zt&&nr.map(function(Xt,Cr){return w.a.createElement("li",{key:Cr},Xt.actionName?w.a.createElement(g,Object(v.a)({},Xt,{onActionCallback:it})):w.a.createElement("span",{className:"v-line"}))}),Fe?w.a.createElement("li",null,w.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:it},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,gt&&w.a.createElement("li",null,w.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(gt),onActionCallback:it},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(g,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:it})))},P=Z("M8RZ"),B=Z("+L6B"),H=Z("2/Rp"),Y=Z("y8nQ"),j=Z("Vl3Y"),N=Z("5NDa"),Q=Z("5rEg"),ne={labelCol:{span:4},wrapperCol:{span:20}},pe=function(ve){var Le=ve.callback,Fe=ve.onCancel;function it(xt){Le(xt)}return w.a.createElement(j.a,Object(v.a)({},ne,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:it}),w.a.createElement(j.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement(Q.a,null)),w.a.createElement(j.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement(Q.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(H.a,{type:"ghost",onClick:Fe},"\u53D6\u6D88")))},xe=Z("7ahc"),Ie=Z("HmJG"),Ae=Z("BjJ7"),De=j.a.useForm,Ce={width:280,marginRight:10},Oe={labelCol:{span:5},wrapperCol:{span:19}},ce=function(ve){var Le=ve.callback,Fe=ve.onCancel,it=De(),xt=Object(U.a)(it,1),gt=xt[0];function Zt(nr){Le(nr)}function Rt(nr,Xt){if(nr.status===-1){T.b.error(nr.message);return}gt.setFieldsValue({src:"/api/attachments/".concat(nr.id),type:Xt.type})}function Tt(nr){var Xt=nr.target.files[0];Pe(Xt,Rt)}return w.a.createElement(j.a,Object(v.a)({form:gt},Oe,{className:"upload-image-panel",onFinish:Zt}),w.a.createElement(j.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(j.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement(Q.a,{style:Ce})),w.a.createElement(fe,{onFileChange:Tt}))),w.a.createElement(j.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement(Q.a,{style:{width:264}})),w.a.createElement(j.a.Item,{style:{textAlign:"right"}},w.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(H.a,{type:"ghost",onClick:Fe},"\u53D6\u6D88")))};function fe(ve){var Le=ve.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:Le}))}function Pe(ve,Le){if(!ve)throw new String("\u6CA1\u6709\u6587\u4EF6");var Fe=new FormData;Fe.append("editormd-image-file",ve),Fe.append("file_param_name","editormd-image-file"),Fe.append("byxhr","true");var it=new window.XMLHttpRequest;it.withCredentials=!0,it.addEventListener("load",function(xt){Le(JSON.parse(xt.target.responseText),ve)},!1),it.addEventListener("error",function(xt){console.error(xt)},!1),it.open("POST","".concat(Ae.a,"/api/attachments.json")),it.send(Fe)}var qe=Z("giR+"),Ve=Z("fyUT"),Ze=Z("7Kak"),ct=Z("9yH6"),je=ct.a.Group,Be={margin:"0 8px"},Xe=function(ve){var Le=ve.callback,Fe=ve.onCancel;function it(xt){Le(xt)}return w.a.createElement(j.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:it},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:Be},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:Be},"\u884C\u6570"),w.a.createElement(j.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(Ve.a,null)),w.a.createElement("span",{style:Be},"\u5217\u6570"),w.a.createElement(j.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(Ve.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:Be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(j.a.Item,{name:"align"},w.a.createElement(je,null,w.a.createElement(ct.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(ct.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(ct.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(ct.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(H.a,{type:"ghost",onClick:Fe},"\u53D6\u6D88")))},et=Z("ErOA"),Qe=Z("7Cbv"),Ne="link",Ue="upload-image",lt="code-block",ut="add-table",ot="------------",Je={default:ot,left:":".concat(ot),center:":".concat(ot,":"),right:"".concat(ot,":")},vt=Z("9VGf"),ft,st;function _e(){}var pt=0,dt=1e4,Re="\u2581",Ke=`
|
|
**\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 be(ve){return/^\d+$/.test(ve)?"".concat(ve,"px"):ve}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,he=de?"Cmd":"Ctrl",$=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],J=(ft={},Object(I.a)(ft,he+"-B","bold"),Object(I.a)(ft,he+"-I","italic"),ft),re=(st={},Object(I.a)(st,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(st,lt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(st,Ue,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(st,ut,"\u6DFB\u52A0\u8868\u683C"),st),le=at.a=function(ve){var Le=ve.defaultValue,Fe=Le===void 0?"":Le,it=ve.onChange,xt=ve.width,gt=xt===void 0?"100%":xt,Zt=ve.height,Rt=Zt===void 0?400:Zt,Tt=ve.miniToolbar,nr=Tt===void 0?!1:Tt,Xt=ve.isFocus,Cr=Xt===void 0?!1:Xt,Or=ve.watch,It=ve.insertTemp,$r=ve.mode,tn=$r===void 0?"markdown":$r,Qr=ve.id,dn=Qr===void 0?"markdown-editor-id":Qr,bn=ve.showResizeBar,sa=bn===void 0?!1:bn,Pn=ve.noStorage,xi=Pn===void 0?!1:Pn,Ti=ve.showNullButton,Er=Ti===void 0?!1:Ti,bt=ve.hidetoolBar,Fn=bt===void 0?!1:bt,Si=ve.fullScreen,Jr=Si===void 0?!1:Si,tr=ve.onBlur,wn=ve.onCMBeforeChange,Bn=ve.onFullScreen,si=ve.className,He=si===void 0?"":si,_t=ve.disablePaste,li=_t===void 0?!1:_t,ui=ve.placeholder,wi=ui===void 0?"":ui,jn=ve.values,Ci=jn===void 0?"":jn,Pt=Object(y.useState)(null),la=Object(U.a)(Pt,2),Ye=la[0],Wn=la[1],cn=Object(y.useState)(Fe),Ki=Object(U.a)(cn,2),di=Ki[0],Cn=Ki[1],Oi=Object(y.useState)(Or),Hi=Object(U.a)(Oi,2),En=Hi[0],zi=Hi[1],ua=Object(y.useState)(Jr),Di=Object(U.a)(ua,2),On=Di[0],Gi=Di[1],ka=Object(y.useState)(""),Vi=Object(U.a)(ka,2),Kr=Vi[0],$n=Vi[1],Ia=Object(y.useState)(0),Qn=Object(U.a)(Ia,2),fn=Qn[0],Xi=Qn[1],Na=Object(y.useState)(Rt),da=Object(U.a)(Na,2),ca=da[0],Ai=da[1],Dn=Object(y.useState)(!1),Yi=Object(U.a)(Dn,2),Ua=Yi[0],$i=Yi[1],Jn=Object(y.useRef)(Object(Qe.a)()),ci=Object(y.useRef)(!1),kn=Object(y.useRef)(),In=Object(y.useRef)(),Nn=Object(y.useRef)(),Kn=Object(y.useRef)(),fi=Object(y.useRef)(),fa=function(){var Et=Object(M.a)(_.a.mark(function Mt(){var St,Wt;return _.a.wrap(function(sr){for(;;)switch(sr.prev=sr.next){case 0:return sr.next=2,Object(et.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Jn.current}});case 2:Wt=sr.sent,Wt!=null&&(St=Wt.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",Ye,In),Wt.attachments.map(function($t){$t.content_type.indexOf("image")>-1?Ye.replaceSelection(".concat($t.content_type,")")):$t.content_type.indexOf("video")>-1?Ye.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):$t.content_type.indexOf("pdf")>-1?Ye.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat($t.content_type,'&disposition=inline" target="_blank">').concat($t.name,"</a>")):Ye.replaceSelection("[".concat($t.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat($t.content_type,")"))}));case 4:case"end":return sr.stop()}},Mt)}));return function(){return Et.apply(this,arguments)}}();Object(y.useEffect)(function(){Cn(Ci),Ye==null||Ye.setValue(Ci)},[Ci]),Object(y.useEffect)(function(){Bn==null||Bn(On)},[On]),Object(y.useEffect)(function(){if(In.current){var Et=O.a.fromTextArea(In.current,{mode:tn,lineNumbers:!nr,lineWrapping:!0,value:Fe,autoCloseTags:!0,autoCloseBrackets:!0});Cr&&Et.focus();function Mt(St,Wt){if(li){Wt.preventDefault();return}var qt=Wt.clipboardData;if(qt){var sr=qt.types.toString(),$t=qt.items;if(sr==="Files"||qt.types.indexOf("Files")>-1){if(Wt.preventDefault(),tn=="stex")return;try{var Dr,nn=$t[1];((Dr=$t[0])===null||Dr===void 0?void 0:Dr.kind)==="file"&&(nn=$t[0]);var Ht=nn.getAsFile(),Hn=Ht.name.split(".").pop();Pe(Ht,function(ir){if(ir.id){var Vr,Hr,Tn;(Ht==null||((Vr=Ht.type)===null||Vr===void 0)?void 0:Vr.indexOf("image"))>-1?Et.replaceSelection(".concat(ir.content_type,")")):(Ht==null||((Hr=Ht.type)===null||Hr===void 0)?void 0:Hr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,'"></video>')):(Ht==null||((Tn=Ht.type)===null||Tn===void 0)?void 0:Tn.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(Ht.type,'&disposition=inline" target="_blank">').concat(Ht.name,"</a>")):$.includes(Hn)?Et.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,'?type=office&disposition=inline" target="_blank">').concat(Ht.name,"</a>")):Et.replaceSelection("[".concat(Ht.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(ir.content_type,")"))}else(ir==null?void 0:ir.status)===401&&(document.location.href="/user/login")})}catch(ir){T.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Et.on("paste",Mt),Et.on("dragleave",function(St,Wt){Nn.current.classList.remove("mouse-hover-md")}),Et.on("dragover",function(St,Wt){Nn.current.classList.add("mouse-hover-md")}),Et.on("drop",function(St,Wt){Nn.current.classList.add("mouse-hover-md");var qt;if(qt=Wt.dataTransfer.files,qt.length>0){Wt.preventDefault(),Wt.stopPropagation();for(var sr=function(nn){var Ht=qt[nn],Hn=Ht.name.split(".").pop();Pe(Ht,function(ir){if(ir.id){var Vr,Hr,Tn;(Ht==null||((Vr=Ht.type)===null||Vr===void 0)?void 0:Vr.indexOf("image"))>-1?Et.replaceSelection(".concat(ir.content_type,")")):(Ht==null||((Hr=Ht.type)===null||Hr===void 0)?void 0:Hr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,'"></video>')):(Ht==null||((Tn=Ht.type)===null||Tn===void 0)?void 0:Tn.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(Ht.type,'&disposition=inline" target="_blank">').concat(Ht.name,"</a>")):$.includes(Hn)?Et.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,'?type=office&disposition=inline" target="_blank">').concat(Ht.name,"</a>")):Et.replaceSelection("[".concat(Ht.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(ir.id,"?type=").concat(ir.content_type,")"))}else(ir==null?void 0:ir.status)===401&&(document.location.href="/user/login")})},$t=0;$t<qt.length;$t++)sr($t)}}),Wn(Et),function(){Et.off("paste",Mt)}}},[]);var rn=Object(y.useCallback)(function(){if(Nn.current)try{}catch(Et){console.log(Et,"---- to set md editor body height")}},[ca,Nn,On]);Object(y.useEffect)(function(){function Et(){var St=new C.default(function(Wt){var qt=Object(A.a)(Wt),sr;try{for(qt.s();!(sr=qt.n()).done;){var $t=sr.value;($t.target.offsetHeight>0||$t.target.offsetWidth>0)&&(rn(),Ye.setSize("100%","100%"),Ye.refresh())}}catch(Dr){qt.e(Dr)}finally{qt.f()}});return St.observe(In.current.parentElement),St}if(Ye){var Mt=Et();return function(){Mt.unobserve(In.current.parentElement)}}},[Ye,rn]),Object(y.useEffect)(function(){if(Ye){for(var Et=[],Mt=function(){var $t=Wt[St];qt=Object(U.a)($t,2);var Dr=qt[0],nn=qt[1],Ht=Object(I.a)({},Dr,function(){ha(nn)});Et.push(Ht),Ye.addKeyMap(Ht)},St=0,Wt=Object.entries(J);St<Wt.length;St++){var qt;Mt()}return kn.current=setInterval(function(){ci.current&&fa()},4e3),function(){clearInterval(kn.current);var sr=Object(A.a)(Et),$t;try{for(sr.s();!($t=sr.n()).done;){var Dr=$t.value;Ye.removeKeyMap(Dr)}}catch(nn){sr.e(nn)}finally{sr.f()}}}},[Ye]),Object(y.useEffect)(function(){Jr!==On&&Gi(Jr)},[Jr]),Object(vt.a)(function(){if(!xi&&fn>0){var Et=new Date().getTime(),Mt=window.sessionStorage.getItem(dn);Et>=fn+dt&&(!Mt||Mt!==di)&&(window.sessionStorage.setItem(dn,di),$i(!0))}},dt),Object(y.useEffect)(function(){zi(Or)},[Ye,Or]),Object(y.useEffect)(function(){Ye&&(Cr&&Ye.focus())},[Ye,Cr]),Object(y.useEffect)(function(){if(En&&Ye){var Et=Ye.getScrollerElement();function Mt(St){var Wt=St.target;if(fi.current){var qt=Wt.scrollTop/Wt.scrollHeight;fi.current.scrollTop=fi.current.scrollHeight*qt}}return Et.addEventListener("scroll",Mt),function(){Et.removeEventListener("scroll",Mt)}}},[Ye,En]),Object(y.useEffect)(function(){if(Ye&&wn){function Et(Mt,St){wn(Mt,St)}return Ye.on("beforeChange",Et),function(){Ye.off("beforeChange",Et)}}},[Ye,wn]),Object(y.useEffect)(function(){if(Ye&&tr){function Et(){tr(Ye.getValue())}return Ye.on("blur",Et),function(){Ye.off("blur",Et)}}},[Ye,tr]),Object(y.useEffect)(function(){if(Ye){function Et(Mt){var St=Mt.getValue();Cn(St),Xi(new Date().getTime()),Mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),it&&it(St)}return Ye.on("change",Et),function(){Ye.off("change",Et)}}},[Ye,it]),Object(y.useEffect)(function(){Ye&&(Fe==null?(Ye.setValue(""),Cn("")):Fe!==Ye.getValue()&&(Ye.setValue(Fe),Cn(Fe),Ye.setCursor(Ye.lineCount(),0)))},[Ye,Fe]);var ha=Object(y.useCallback)(function(Et){var Mt=Ye.getCursor(),St=Ye.getSelection(),Wt=St.split(`
|
|
`);switch(Et){case"bold":return Ye.replaceSelection("**"+St+"**"),St===""&&Ye.setCursor(Mt.line,Mt.ch+2),Ye.focus();case"italic":return Ye.replaceSelection("*"+St+"*"),St===""&&Ye.setCursor(Mt.line,Mt.ch+1),Ye.focus();case"code":return Ye.replaceSelection("`"+St+"`"),St===""&&Ye.setCursor(Mt.line,Mt.ch+1),Ye.focus();case"inline-latex":return Ye.replaceSelection("`$$"+St+"$$`"),St===""&&Ye.setCursor(Mt.line,Mt.ch+3),Ye.focus();case"latex":return Ye.replaceSelection("```latex\n"+St+"\n```"),Ye.setCursor(Mt.line+1,St.length+1),Ye.focus();case"line-break":return Ye.replaceSelection(`<br/>
|
|
`),Ye.focus();case"list-ul":return St===""?Ye.replaceSelection("- "+St):Ye.replaceSelection(Wt.map(function(qt){return qt===""?"":"- ".concat(qt)}).join(`
|
|
`)),Ye.focus();case"list-ol":return St===""?Ye.replaceSelection("1. "+St):Ye.replaceSelection(Wt.map(function(qt,sr){return qt===""?"":"".concat(sr+1,". ").concat(qt)}).join(`
|
|
`)),Ye.focus();case"add-null-ch":return St===""&&Ye.setCursor(Mt.line,Mt.ch+1),Ye.replaceSelection(Re),Ye.focus();case"inster-template-1":return St===""&&Ye.setCursor(Mt.line,Mt.ch),Ye.replaceSelection(Ke),Ye.focus();case"eraser":return Ye.setValue(""),Ye.focus();case"trigger-watch":return zi(!En),Ye.focus();case"trigger-full-screen":return Gi(!On),Ye.focus();case Ne:$n(Ne);return;case lt:$n(lt);return;case Ue:$n(Ue);return;case ut:$n(ut);return;default:throw new Error}},[Ye,En,On]),Li=Object(y.useCallback)(function(Et){$n("");switch(Kr){case Ne:var Mt=Et.title,St=Et.link;return Ye.replaceSelection("[".concat(Mt,"](").concat(St,")")),Ye.focus();case lt:var Wt=Et.language,qt=Et.content;return Ye.replaceSelection(["```"+Wt,qt,"```"].join(`
|
|
`)),Ye.focus();case Ue:var sr=Et.src,$t=Et.alt;return $t?Ye.replaceSelection(".concat(sr,' "').concat($t,'" )')):Ye.replaceSelection("")),Ye.focus();case ut:for(var Dr=Et.row,nn=Et.col,Ht=Et.align,Hn=`
|
|
`,ir=0;ir<Dr;ir++){for(var Vr=[],Hr=[],Tn=0;Tn<nn;Tn++)ir===1&&Hr.push(Je[Ht]),Vr.push(" ");ir===1&&(Hn+="| ".concat(Hr.join(" | "),` |
|
|
`)),Hn+="| ".concat(Vr.join(nn===1?"":" | "),` |
|
|
`)}return Ye.replaceSelection(Hn+`
|
|
`),Ye.focus();default:throw new Error}},[Ye,Kr]),Zn=Object(y.useMemo)(function(){switch(Kr){case Ne:return w.a.createElement(pe,{callback:Li,onCancel:hn});case lt:return w.a.createElement(xe.b,{callback:Li,onCancel:hn});case Ue:return w.a.createElement(ce,{callback:Li,onCancel:hn});case ut:return w.a.createElement(Xe,{callback:Li,onCancel:hn});default:return null}},[Kr]);function hn(){$n("")}Object(y.useEffect)(function(){if(Kn.current){var Et=Kn.current,Mt=!1,St=0;function Wt($t){Mt=!0,St=$t.pageY}function qt(){Mt=!1}function sr($t){if(Mt){var Dr=$t.pageY-St;Dr<0&&(Dr=0),Dr>300&&(Dr=300);var nn=Rt+Dr+"px";Ai(nn)}}return Et.addEventListener("mousedown",Wt),document.addEventListener("mousemove",sr),document.addEventListener("mouseup",qt),function(){Et.removeEventListener("mousedown",Wt),document.removeEventListener("mousemove",sr),document.removeEventListener("mouseup",qt)}}},[Ye,Kn]),Object(y.useEffect)(function(){Ai(Rt)},[Rt]);var pn=be(gt),Qi=be(ca),xn={width:pn,height:Qi},Ji=Object(y.useMemo)(function(){if(fn){var Et=new Date(fn),Mt=Et.getHours(),St=Et.getMinutes(),Wt=Et.getSeconds();return Mt=Mt<10?"0"+Mt:Mt,St=St<10?"0"+St:St,Wt=Wt<10?"0"+Wt:Wt,"".concat(Mt,":").concat(St,":").concat(Wt)}return 0},[fn]);function Zi(){window.sessionStorage.removeItem(dn),$i(!1),Xi(0)}function hi(){$i(!1),Xi(0),Ye.setValue(window.sessionStorage.getItem(dn))}function Fa(Et,Mt){var St=Ye.getValue();St=St.replace(Et,Mt),Cn(St),Ye==null||Ye.setValue(St)}return w.a.createElement(y.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Nn},w.a.createElement("div",{className:"markdown-editor-container ".concat(He," ").concat(En?"on-preview":""," ").concat(nr?"mini":""," ").concat(On?"full-screen":""),style:xn},w.a.createElement(S,{insertTemp:It,watch:En,fullScreen:On,showNullButton:Er,onActionCallback:ha,hidetoolBar:Fn,uuid:Jn.current,setOpenPhones:function(){ci.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:In,placeholder:wi})),En?w.a.createElement("div",{ref:fi,className:"preview-container"},tn==="stex"&&w.a.createElement(D,{value:di}),tn!=="stex"&&w.a.createElement(h.a,{edit:!0,value:di,replaces:Fa})):null))),sa?w.a.createElement("a",{ref:Kn,className:"editor-resize"}):null,w.a.createElement(P.a,null,re[Kr]?w.a.createElement(K.a,{centered:!0,title:re[Kr],visible:!0,onCancel:hn,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(Dt,at){/**
|
|
* @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 Z,q,K,A=!1,F,T;window.PR_SHOULD_USE_CONTINUATION=!0;var M,U;(function(){var I=window,R=["break,continue,do,else,for,if,return,while"],_=[R,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],L=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],C="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",p=[y,"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=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[R,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],b=[w,O,L,p,l,a,s,u],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",D="kwd",v="com",c="typ",f="lit",d="pun",o="pln",E="tag",g="dec",S="src",P="atn",B="atv",H="nocode",Y="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(je){for(var Be=0,Xe=!1,et=!1,Qe=0,Ne=je.length;Qe<Ne;++Qe){var Ue=je[Qe];if(Ue.ignoreCase)et=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Xe=!0,et=!1;break}}var lt={b:8,t:9,n:10,v:11,f:12,r:13};function ut(st){var _e=st.charCodeAt(0);if(_e!==92)return _e;var pt=st.charAt(1);return _e=lt[pt],_e||("0"<=pt&&pt<="7"?parseInt(st.substring(1),8):pt==="u"||pt==="x"?parseInt(st.substring(2),16):st.charCodeAt(1))}function ot(st){if(st<32)return(st<16?"\\x0":"\\x")+st.toString(16);var _e=String.fromCharCode(st);return _e==="\\"||_e==="-"||_e==="]"||_e==="^"?"\\"+_e:_e}function Je(st){var _e=st.substring(1,st.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")),pt=[],dt=_e[0]==="^",Re=["["];dt&&Re.push("^");for(var Ke=dt?1:0,be=_e.length;Ke<be;++Ke){var de=_e[Ke];if(/\\[bdsw]/i.test(de))Re.push(de);else{var he=ut(de),$;Ke+2<be&&_e[Ke+1]==="-"?($=ut(_e[Ke+2]),Ke+=2):$=he,pt.push([he,$]),$<65||he>122||($<65||he>90||pt.push([Math.max(65,he)|32,Math.min($,90)|32]),$<97||he>122||pt.push([Math.max(97,he)&~32,Math.min($,122)&~32]))}}pt.sort(function(ve,Le){return ve[0]-Le[0]||Le[1]-ve[1]});for(var J=[],re=[],Ke=0;Ke<pt.length;++Ke){var le=pt[Ke];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):J.push(re=le)}for(var Ke=0;Ke<J.length;++Ke){var le=J[Ke];Re.push(ot(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Re.push("-"),Re.push(ot(le[1])))}return Re.push("]"),Re.join("")}function vt(st){for(var _e=st.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")),pt=_e.length,dt=[],Re=0,Ke=0;Re<pt;++Re){var be=_e[Re];if(be==="(")++Ke;else if(be.charAt(0)==="\\"){var de=+be.substring(1);de&&(de<=Ke?dt[de]=-1:_e[Re]=ot(de))}}for(var Re=1;Re<dt.length;++Re)dt[Re]===-1&&(dt[Re]=++Be);for(var Re=0,Ke=0;Re<pt;++Re){var be=_e[Re];if(be==="(")++Ke,dt[Ke]||(_e[Re]="(?:");else if(be.charAt(0)==="\\"){var de=+be.substring(1);de&&de<=Ke&&(_e[Re]="\\"+dt[de])}}for(var Re=0;Re<pt;++Re)_e[Re]==="^"&&_e[Re+1]!=="^"&&(_e[Re]="");if(st.ignoreCase&&Xe)for(var Re=0;Re<pt;++Re){var be=_e[Re],he=be.charAt(0);be.length>=2&&he==="["?_e[Re]=Je(be):he!=="\\"&&(_e[Re]=be.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return _e.join("")}for(var ft=[],Qe=0,Ne=je.length;Qe<Ne;++Qe){var Ue=je[Qe];if(Ue.global||Ue.multiline)throw new Error(""+Ue);ft.push("(?:"+vt(Ue)+")")}return new RegExp(ft.join("|"),et?"gi":"g")}function N(je,Be){var Xe=/(?:^|\s)nocode(?:\s|$)/,et=[],Qe=0,Ne=[],Ue=0;function lt(ut){var ot=ut.nodeType;if(ot==1){if(Xe.test(ut.className))return;for(var Je=ut.firstChild;Je;Je=Je.nextSibling)lt(Je);var vt=ut.nodeName.toLowerCase();(vt==="br"||vt==="li")&&(et[Ue]=`
|
|
`,Ne[Ue<<1]=Qe++,Ne[Ue++<<1|1]=ut)}else if(ot==3||ot==4){var ft=ut.nodeValue;ft.length&&(Be?ft=ft.replace(/\r\n?/g,`
|
|
`):ft=ft.replace(/[ \t\r\n]+/g," "),et[Ue]=ft,Ne[Ue<<1]=Qe,Qe+=ft.length,Ne[Ue++<<1|1]=ut)}}return lt(je),{sourceCode:et.join("").replace(/\n$/,""),spans:Ne}}function Q(je,Be,Xe,et,Qe){if(!Xe)return;var Ne={sourceNode:je,pre:1,langExtension:null,numberLines:null,sourceCode:Xe,spans:null,basePos:Be,decorations:null};et(Ne),Qe.push.apply(Qe,Ne.decorations)}var ne=/\S/;function pe(je){for(var Be=void 0,Xe=je.firstChild;Xe;Xe=Xe.nextSibling){var et=Xe.nodeType;Be=et===1?Be?je:Xe:et===3&&ne.test(Xe.nodeValue)?je:Be}return Be===je?void 0:Be}function xe(je,Be){var Xe={},et;(function(){for(var Ue=je.concat(Be),lt=[],ut={},ot=0,Je=Ue.length;ot<Je;++ot){var vt=Ue[ot],ft=vt[3];if(ft)for(var st=ft.length;--st>=0;)Xe[ft.charAt(st)]=vt;var _e=vt[1],pt=""+_e;ut.hasOwnProperty(pt)||(lt.push(_e),ut[pt]=null)}lt.push(/[\0-\uffff]/),et=j(lt)})();var Qe=Be.length,Ne=function(Ue){for(var lt=Ue.sourceCode,ut=Ue.basePos,ot=Ue.sourceNode,Je=[ut,o],vt=0,ft=lt.match(et)||[],st={},_e=0,pt=ft.length;_e<pt;++_e){var dt=ft[_e],Re=st[dt],Ke=void 0,be;if(typeof Re=="string")be=!1;else{var de=Xe[dt.charAt(0)];if(de)Ke=dt.match(de[1]),Re=de[0];else{for(var he=0;he<Qe;++he)if(de=Be[he],Ke=dt.match(de[1]),Ke){Re=de[0];break}Ke||(Re=o)}be=Re.length>=5&&Re.substring(0,5)==="lang-",be&&!(Ke&&typeof Ke[1]=="string")&&(be=!1,Re=S),be||(st[dt]=Re)}var $=vt;if(vt+=dt.length,!be)Je.push(ut+$,Re);else{var J=Ke[1],re=dt.indexOf(J),le=re+J.length;Ke[2]&&(le=dt.length-Ke[2].length,re=le-J.length);var ve=Re.substring(5);Q(ot,ut+$,dt.substring(0,re),Ne,Je),Q(ot,ut+$+re,J,fe(ve,J),Je),Q(ot,ut+$+le,dt.substring(le),Ne,Je)}}Ue.decorations=Je};return Ne}function Ie(je){var Be=[],Xe=[];je.tripleQuotedStrings?Be.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):je.multiLineStrings?Be.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Be.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),je.verbatimStrings&&Xe.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var et=je.hashComments;et&&(je.cStyleComments?(et>1?Be.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Be.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Xe.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Be.push([v,/^#[^\r\n]*/,null,"#"])),je.cStyleComments&&(Xe.push([v,/^\/\/[^\r\n]*/,null]),Xe.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Qe=je.regexLiterals;if(Qe){var Ne=Qe>1?"":`
|
|
\r`,Ue=Ne?".":"[\\S\\s]",lt="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Xe.push(["lang-regex",RegExp("^"+Y+"("+lt+")")])}var ut=je.types;ut&&Xe.push([c,ut]);var ot=(""+je.keywords).replace(/^ | $/g,"");ot.length&&Xe.push([D,new RegExp("^(?:"+ot.replace(/[\s,]+/g,"|")+")\\b"),null]),Be.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var Je="^.[^\\s\\w.$@'\"`/\\\\]*";return je.regexLiterals&&(Je+="(?!s*/)"),Xe.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[f,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(Je),null]),xe(Be,Xe)}var Ae=Ie({keywords:b,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function De(je,Be,Xe){for(var et=/(?:^|\s)nocode(?:\s|$)/,Qe=/\r\n?|\n/,Ne=je.ownerDocument,Ue=Ne.createElement("li");je.firstChild;)Ue.appendChild(je.firstChild);var lt=[Ue];function ut(_e){var pt=_e.nodeType;if(pt==1&&!et.test(_e.className))if(_e.nodeName==="br")ot(_e),_e.parentNode&&_e.parentNode.removeChild(_e);else for(var dt=_e.firstChild;dt;dt=dt.nextSibling)ut(dt);else if((pt==3||pt==4)&&Xe){var Re=_e.nodeValue,Ke=Re.match(Qe);if(Ke){var be=Re.substring(0,Ke.index);_e.nodeValue=be;var de=Re.substring(Ke.index+Ke[0].length);if(de){var he=_e.parentNode;he.insertBefore(Ne.createTextNode(de),_e.nextSibling)}ot(_e),be||_e.parentNode.removeChild(_e)}}}function ot(_e){for(;!_e.nextSibling;)if(_e=_e.parentNode,!_e)return;function pt(Ke,be){var de=be?Ke.cloneNode(!1):Ke,he=Ke.parentNode;if(he){var $=pt(he,1),J=Ke.nextSibling;$.appendChild(de);for(var re=J;re;re=J)J=re.nextSibling,$.appendChild(re)}return de}for(var dt=pt(_e.nextSibling,0),Re;(Re=dt.parentNode)&&Re.nodeType===1;)dt=Re;lt.push(dt)}for(var Je=0;Je<lt.length;++Je)ut(lt[Je]);Be===(Be|0)&<[0].setAttribute("value",Be);var vt=Ne.createElement("ol");vt.className="linenums";for(var ft=Math.max(0,Be-1|0)||0,Je=0,st=lt.length;Je<st;++Je)Ue=lt[Je],Ue.className="L"+(Je+ft)%10,Ue.firstChild||Ue.appendChild(Ne.createTextNode("\xA0")),vt.appendChild(Ue);je.appendChild(vt)}function Ce(je){var Be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Be=Be&&+Be[1]<=8;var Xe=/\n/g,et=je.sourceCode,Qe=et.length,Ne=0,Ue=je.spans,lt=Ue.length,ut=0,ot=je.decorations,Je=ot.length,vt=0;ot[Je]=Qe;var ft,st;for(st=ft=0;st<Je;)ot[st]!==ot[st+2]?(ot[ft++]=ot[st++],ot[ft++]=ot[st++]):st+=2;for(Je=ft,st=ft=0;st<Je;){for(var _e=ot[st],pt=ot[st+1],dt=st+2;dt+2<=Je&&ot[dt+1]===pt;)dt+=2;ot[ft++]=_e,ot[ft++]=pt,st=dt}Je=ot.length=ft;var Re=je.sourceNode,Ke="";Re&&(Ke=Re.style.display,Re.style.display="none");try{for(var be=null;ut<lt;){var de=Ue[ut],he=Ue[ut+2]||Qe,$=ot[vt+2]||Qe,dt=Math.min(he,$),J=Ue[ut+1],re;if(J.nodeType!==1&&(re=et.substring(Ne,dt))){Be&&(re=re.replace(Xe,"\r")),J.nodeValue=re;var le=J.ownerDocument,ve=le.createElement("span");ve.className=ot[vt+1];var Le=J.parentNode;Le.replaceChild(ve,J),ve.appendChild(J),Ne<he&&(Ue[ut+1]=J=le.createTextNode(et.substring(dt,he)),Le.insertBefore(J,ve.nextSibling))}Ne=dt,Ne>=he&&(ut+=2),Ne>=$&&(vt+=2)}}finally{Re&&(Re.style.display=Ke)}}var Oe={};function ce(je,Be){for(var Xe=Be.length;--Xe>=0;){var et=Be[Xe];Oe.hasOwnProperty(et)?I.console&&console.warn("cannot override language handler %s",et):Oe[et]=je}}function fe(je,Be){return je&&Oe.hasOwnProperty(je)||(je=/^\s*</.test(Be)?"default-markup":"default-code"),Oe[je]}ce(Ae,["default-code"]),ce(xe([],[[o,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\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"]),ce(xe([[o,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!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"]),ce(xe([],[[B,/^[\s\S]+/]]),["uq.val"]),ce(Ie({keywords:w,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),ce(Ie({keywords:"null,true,false"}),["json"]),ce(Ie({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),ce(Ie({keywords:L,cStyleComments:!0}),["java"]),ce(Ie({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(Ie({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(Ie({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(Ie({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(Ie({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(Ie({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(xe([],[[h,/^[\s\S]+/]]),["regex"]);function Pe(je){var Be=je.langExtension;try{var Xe=N(je.sourceNode,je.pre),et=Xe.sourceCode;je.sourceCode=et,je.spans=Xe.spans,je.basePos=0,fe(Be,et)(je),Ce(je)}catch(Qe){I.console&&console.log(Qe&&Qe.stack||Qe)}}function qe(je,Be,Xe){var et=Xe||!1,Qe=Be||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+je+"</pre>",Ne=Ne.firstChild,et&&De(Ne,et,!0);var Ue={langExtension:Qe,numberLines:et,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Pe(Ue),Ne.innerHTML}function Ve(je,Be){var Xe=Be||document.body,et=Xe.ownerDocument||document;function Qe(de){return Xe.getElementsByTagName(de)}for(var Ne=[Qe("pre"),Qe("code"),Qe("xmp")],Ue=[],lt=0;lt<Ne.length;++lt)for(var ut=0,ot=Ne[lt].length;ut<ot;++ut)Ue.push(Ne[lt][ut]);Ne=null;var Je=Date;Je.now||(Je={now:function(){return+new Date}});var vt=0,ft=/\blang(?:uage)?-([\w.]+)(?!\S)/,st=/\bprettyprint\b/,_e=/\bprettyprinted\b/,pt=/pre|xmp/i,dt=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Ke={};function be(){for(var de=I.PR_SHOULD_USE_CONTINUATION?Je.now()+250:Infinity;vt<Ue.length&&Je.now()<de;vt++){for(var he=Ue[vt],$=Ke,J=he;J=J.previousSibling;){var re=J.nodeType,le=(re===7||re===8)&&J.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(J.nodeValue))break;if(le){$={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Or,It,$r){$[It]=$r});break}}var ve=he.className;if(($!==Ke||st.test(ve))&&!_e.test(ve)){for(var Le=!1,Fe=he.parentNode;Fe;Fe=Fe.parentNode){var it=Fe.tagName;if(Re.test(it)&&Fe.className&&st.test(Fe.className)){Le=!0;break}}if(!Le){he.className+=" prettyprinted";var xt=$.lang;if(!xt){xt=ve.match(ft);var gt;!xt&&(gt=pe(he))&&dt.test(gt.tagName)&&(xt=gt.className.match(ft)),xt&&(xt=xt[1])}var Zt;if(pt.test(he.tagName))Zt=1;else{var Rt=he.currentStyle,Tt=et.defaultView,nr=Rt?Rt.whiteSpace:Tt&&Tt.getComputedStyle?Tt.getComputedStyle(he,null).getPropertyValue("white-space"):0;Zt=nr&&nr.substring(0,3)==="pre"}var Xt=$.linenums;(Xt=Xt==="true"||+Xt)||(Xt=ve.match(/\blinenums\b(?::(\d+))?/),Xt=Xt?Xt[1]&&Xt[1].length?+Xt[1]:!0:!1),Xt&&De(he,Xt,Zt);var Cr={langExtension:xt,sourceNode:he,numberLines:Xt,pre:Zt,sourceCode:null,basePos:null,spans:null,decorations:null};Pe(Cr)}}}vt<Ue.length?I.setTimeout(be,250):typeof je=="function"&&je()}be()}var Ze=I.PR={createSimpleLexer:xe,registerLangHandler:ce,sourceDecorator:Ie,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:B,PR_COMMENT:v,PR_DECLARATION:g,PR_KEYWORD:D,PR_LITERAL:f,PR_NOCODE:H,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:S,PR_STRING:h,PR_TAG:E,PR_TYPE:c,prettyPrintOne:A?I.prettyPrintOne=qe:M=qe,prettyPrint:U=A?I.prettyPrint=Ve:U=Ve},ct=I.define;typeof ct=="function"&&ct.amd&&ct("google-code-prettify",[],function(){return Ze})})()},UUDw:function(Dt,at,Z){Dt.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return q});var q=function(A){var F=document.createElement("textarea");return F.value=A,F.value}},"VrN/":function(Dt,at,Z){(function(q,K){Dt.exports=K()})(this,function(){"use strict";var q=navigator.userAgent,K=navigator.platform,A=/gecko\/\d/i.test(q),F=/MSIE \d/.test(q),T=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),M=/Edge\/(\d+)/.exec(q),U=F||T||M,I=U&&(F?document.documentMode||6:+(M||T)[1]),R=!M&&/WebKit\//.test(q),_=R&&/Qt\/\d+\.\d+/.test(q),y=!M&&/Chrome\//.test(q),w=/Opera\//.test(q),L=/Apple Computer/.test(navigator.vendor),O=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),C=/PhantomJS/.test(q),p=!M&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),l=/Android/.test(q),a=p||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),s=p||/Mac/.test(K),u=/\bCrOS\b/.test(q),b=/win/i.test(K),m=w&&q.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(w=!1,R=!0);var h=s&&(_||w&&(m==null||m<12.11)),D=A||U&&I>=9;function v(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=v(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 f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(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 x=0;x<t.length;++x)i.appendChild(t[x]);return i}function E(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=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 S(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function B(e,t){var n=e.className;v(t).test(n)||(e.className+=(n?" ":"")+t)}function H(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!v(n[r]).test(t)&&(t+=" "+n[r]);return t}var Y=function(e){e.select()};p?Y=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:U&&(Y=function(e){try{e.select()}catch(t){}});function j(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(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 Q(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,k=i||0;;){var W=e.indexOf(" ",x);if(W<0||W>=t)return k+(t-x);k+=W-x,k+=n-k%n,x=W+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};ne.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ne.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 pe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var xe=50,Ie={toString:function(){return"CodeMirror.Pass"}},Ae={scroll:!1},De={origin:"*mouse"},Ce={origin:"+move"};function Oe(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var k=x-r;if(x==e.length||i+k>=t)return r+Math.min(k,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var ce=[""];function fe(e){for(;ce.length<=e;)ce.push(Pe(ce)+" ");return ce[e]}function Pe(e){return e[e.length-1]}function qe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ve(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ze(){}function ct(e,t){var n;return Object.create?n=Object.create(e):(Ze.prototype=e,n=new Ze),t&&N(t,n),n}var je=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||je.test(e))}function Xe(e,t){return t?t.source.indexOf("\\w")>-1&&Be(e)?!0:t.test(e):Be(e)}function et(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Qe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ne(e){return e.charCodeAt(0)>=768&&Qe.test(e)}function Ue(e,t,n){for(;(n<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=n;return t}function lt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function ut(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var k=e[x];(k.from<n&&k.to>t||t==n&&k.to==t)&&(r(Math.max(k.from,t),Math.min(k.to,n),k.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var ot=null;function Je(e,t,n){var r;ot=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:ot=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:ot=i)}return r!=null?r:ot}var vt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,x=/[LRr]/,k=/[Lb1n]/,W=/[1n]/;function z(V,ae,ue){this.level=V,this.from=ae,this.to=ue}return function(V,ae){var ue=ae=="ltr"?"L":"R";if(V.length==0||ae=="ltr"&&!r.test(V))return!1;for(var we=V.length,Te=[],ke=0;ke<we;++ke)Te.push(n(V.charCodeAt(ke)));for(var We=0,$e=ue;We<we;++We){var rt=Te[We];rt=="m"?Te[We]=$e:$e=rt}for(var ht=0,nt=ue;ht<we;++ht){var mt=Te[ht];mt=="1"&&nt=="r"?Te[ht]="n":x.test(mt)&&(nt=mt,mt=="r"&&(Te[ht]="R"))}for(var Lt=1,Ct=Te[0];Lt<we-1;++Lt){var Kt=Te[Lt];Kt=="+"&&Ct=="1"&&Te[Lt+1]=="1"?Te[Lt]="1":Kt==","&&Ct==Te[Lt+1]&&(Ct=="1"||Ct=="n")&&(Te[Lt]=Ct),Ct=Kt}for(var vr=0;vr<we;++vr){var zr=Te[vr];if(zr==",")Te[vr]="N";else if(zr=="%"){var wr=void 0;for(wr=vr+1;wr<we&&Te[wr]=="%";++wr);for(var Sn=vr&&Te[vr-1]=="!"||wr<we&&Te[wr]=="1"?"1":"N",vn=vr;vn<wr;++vn)Te[vn]=Sn;vr=wr-1}}for(var kr=0,gn=ue;kr<we;++kr){var Yr=Te[kr];gn=="L"&&Yr=="1"?Te[kr]="L":x.test(Yr)&&(gn=Yr)}for(var Wr=0;Wr<we;++Wr)if(i.test(Te[Wr])){var Ir=void 0;for(Ir=Wr+1;Ir<we&&i.test(Te[Ir]);++Ir);for(var _r=(Wr?Te[Wr-1]:ue)=="L",yn=(Ir<we?Te[Ir]:ue)=="L",Ra=_r==yn?_r?"L":"R":ue,Wi=Wr;Wi<Ir;++Wi)Te[Wi]=Ra;Wr=Ir-1}for(var en=[],oi,Gr=0;Gr<we;)if(k.test(Te[Gr])){var ps=Gr;for(++Gr;Gr<we&&k.test(Te[Gr]);++Gr);en.push(new z(0,ps,Gr))}else{var Ei=Gr,aa=en.length,oa=ae=="rtl"?1:0;for(++Gr;Gr<we&&Te[Gr]!="L";++Gr);for(var un=Ei;un<Gr;)if(W.test(Te[un])){Ei<un&&(en.splice(aa,0,new z(1,Ei,un)),aa+=oa);var Pa=un;for(++un;un<Gr&&W.test(Te[un]);++un);en.splice(aa,0,new z(2,Pa,un)),aa+=oa,Ei=un}else++un;Ei<Gr&&en.splice(aa,0,new z(1,Ei,Gr))}return ae=="ltr"&&(en[0].level==1&&(oi=V.match(/^\s+/))&&(en[0].from=oi[0].length,en.unshift(new z(0,0,oi[0].length))),Pe(en).level==1&&(oi=V.match(/\s+$/))&&(Pe(en).to-=oi[0].length,en.push(new z(0,we-oi[0].length,we)))),ae=="rtl"?en.reverse():en}}();function ft(e,t){var n=e.order;return n==null&&(n=e.order=vt(e.text,t)),n}var st=[],_e=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]||st).concat(n)}};function pt(e,t){return e._handlers&&e._handlers[t]||st}function dt(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 x=pe(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function Re(e,t){var n=pt(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 Ke(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function be(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)pe(n,t[r])==-1&&n.push(t[r])}function de(e,t){return pt(e,t).length>0}function he(e){e.prototype.on=function(t,n){_e(this,t,n)},e.prototype.off=function(t,n){dt(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function J(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){$(e),J(e)}function ve(e){return e.target||e.srcElement}function Le(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 Fe=function(){if(U&&I<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),it;function xt(e){if(it==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(U&&I<8))}var n=it?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var gt;function Zt(e){if(gt!=null)return gt;var t=d(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:gt=r.right-n.right<3}var Rt=`
|
|
|
|
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 x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),k=x.indexOf("\r");k!=-1?(n.push(x.slice(0,k)),t+=k+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Tt=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},nr=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Xt=null;function Cr(e){if(Xt!=null)return Xt;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return Xt=Math.abs(n.left-r.left)>1}var Or={},It={};function $r(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Or[e]=t}function tn(e,t){It[e]=t}function Qr(e){if(typeof e=="string"&&It.hasOwnProperty(e))e=It[e];else if(e&&typeof e.name=="string"&&It.hasOwnProperty(e.name)){var t=It[e.name];typeof t=="string"&&(t={name:t}),e=ct(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Qr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Qr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function dn(e,t){t=Qr(t);var n=Or[t.name];if(!n)return dn(e,"text/plain");var r=n(e,t);if(bn.hasOwnProperty(t.name)){var i=bn[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var k in t.modeProps)r[k]=t.modeProps[k];return r}var bn={};function sa(e,t){var n=bn.hasOwnProperty(e)?bn[e]:bn[e]={};N(t,n)}function Pn(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 xi(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 Ti(e,t,n){return e.startState?e.startState(t,n):!0}var Er=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};Er.prototype.eol=function(){return this.pos>=this.string.length},Er.prototype.sol=function(){return this.pos==this.lineStart},Er.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Er.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Er.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},Er.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Er.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Er.prototype.skipToEnd=function(){this.pos=this.string.length},Er.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Er.prototype.backUp=function(e){this.pos-=e},Er.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Q(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Q(this.string,this.lineStart,this.tabSize):0)},Er.prototype.indentation=function(){return Q(this.string,null,this.tabSize)-(this.lineStart?Q(this.string,this.lineStart,this.tabSize):0)},Er.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(k){return n?k.toLowerCase():k},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Er.prototype.current=function(){return this.string.slice(this.start,this.pos)},Er.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Er.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Er.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function bt(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],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function Fn(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var k=x.text;i==n.line&&(k=k.slice(0,n.ch)),i==t.line&&(k=k.slice(t.ch)),r.push(k),++i}),r}function Si(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Jr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function tr(e){if(e.parent==null)return null;for(var t=e.parent,n=pe(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 wn(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var k=0;k<e.lines.length;++k){var W=e.lines[k],z=W.height;if(t<z)break;t-=z}return n+k}function Bn(e,t){return t>=e.first&&t<e.first+e.size}function si(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,n){if(n===void 0&&(n=null),!(this instanceof He))return new He(e,t,n);this.line=e,this.ch=t,this.sticky=n}function _t(e,t){return e.line-t.line||e.ch-t.ch}function li(e,t){return e.sticky==t.sticky&&_t(e,t)==0}function ui(e){return He(e.line,e.ch)}function wi(e,t){return _t(e,t)<0?t:e}function jn(e,t){return _t(e,t)<0?e:t}function Ci(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 He(e.first,0);var n=e.first+e.size-1;return t.line>n?He(n,bt(e,n).text.length):la(t,bt(e,t.line).text.length)}function la(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function Ye(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Pt(e,t[r]);return n}var Wn=function(e,t){this.state=e,this.lookAhead=t},cn=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};cn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},cn.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}},cn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},cn.fromSaved=function(e,t,n){return t instanceof Wn?new cn(e,Pn(e.mode,t.state),n,t.lookAhead):new cn(e,Pn(e.mode,t),n)},cn.prototype.save=function(e){var t=e!==!1?Pn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Wn(t,this.maxLookAhead):t};function Ki(e,t,n,r){var i=[e.state.modeGen],x={};On(e,t.text,e.doc.mode,n,function(V,ae){return i.push(V,ae)},x,r);for(var k=n.state,W=function(V){n.baseTokens=i;var ae=e.state.overlays[V],ue=1,we=0;n.state=!0,On(e,t.text,ae.mode,n,function(Te,ke){for(var We=ue;we<Te;){var $e=i[ue];$e>Te&&i.splice(ue,1,Te,i[ue+1],$e),ue+=2,we=Math.min(Te,$e)}if(!ke)return;if(ae.opaque)i.splice(We,ue-We,Te,"overlay "+ke),ue=We+2;else for(;We<ue;We+=2){var rt=i[We+1];i[We+1]=(rt?rt+" ":"")+"overlay "+ke}},x),n.state=k,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)W(z);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function di(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Cn(e,tr(t)),i=t.text.length>e.options.maxHighlightLength&&Pn(e.doc.mode,r.state),x=Ki(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.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 Cn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new cn(r,!0,t);var x=Gi(e,t,n),k=x>r.first&&bt(r,x-1).stateAfter,W=k?cn.fromSaved(r,k,x):new cn(r,Ti(r.mode),x);return r.iter(x,t,function(z){Oi(e,z.text,W);var V=W.line;z.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?W.save():null,W.nextLine()}),n&&(r.modeFrontier=W.line),W}function Oi(e,t,n,r){var i=e.doc.mode,x=new Er(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Hi(i,n.state);!x.eol();)En(i,x,n.state),x.start=x.pos}function Hi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=xi(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=xi(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var zi=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ua(e,t,n,r){var i=e.doc,x=i.mode,k;t=Pt(i,t);var W=bt(i,t.line),z=Cn(e,t.line,n),V=new Er(W.text,e.options.tabSize,z),ae;for(r&&(ae=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,k=En(x,V,z.state),r&&ae.push(new zi(V,k,Pn(i.mode,z.state)));return r?ae:new zi(V,k,z.state)}function Di(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function On(e,t,n,r,i,x,k){var W=n.flattenSpans;W==null&&(W=e.options.flattenSpans);var z=0,V=null,ae=new Er(t,e.options.tabSize,r),ue,we=e.options.addModeClass&&[null];for(t==""&&Di(Hi(n,r.state),x);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(W=!1,k&&Oi(e,t,r,ae.pos),ae.pos=t.length,ue=null):ue=Di(En(n,ae,r.state,we),x),we){var Te=we[0].name;Te&&(ue="m-"+(ue?Te+" "+ue:Te))}if(!W||V!=ue){for(;z<ae.start;)z=Math.min(ae.start,z+5e3),i(z,V);V=ue}ae.start=ae.pos}for(;z<ae.pos;){var ke=Math.min(ae.pos,z+5e3);i(ke,V),z=ke}}function Gi(e,t,n){for(var r,i,x=e.doc,k=n?-1:t-(e.doc.mode.innerMode?1e3:100),W=t;W>k;--W){if(W<=x.first)return x.first;var z=bt(x,W-1),V=z.stateAfter;if(V&&(!n||W+(V instanceof Wn?V.lookAhead:0)<=x.modeFrontier))return W;var ae=Q(z.text,null,e.options.tabSize);(i==null||r>ae)&&(i=W-1,r=ae)}return i}function ka(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=bt(e,r).stateAfter;if(i&&(!(i instanceof Wn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Vi=!1,Kr=!1;function $n(){Vi=!0}function Ia(){Kr=!0}function Qn(e,t,n){this.marker=e,this.from=t,this.to=n}function fn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Xi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Na(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function da(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],k=x.marker,W=x.from==null||(k.inclusiveLeft?x.from<=t:x.from<t);if(W||x.from==t&&k.type=="bookmark"&&(!n||!x.marker.insertLeft)){var z=x.to==null||(k.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new Qn(k,x.from,z?null:x.to))}}return r}function ca(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],k=x.marker,W=x.to==null||(k.inclusiveRight?x.to>=t:x.to>t);if(W||x.from==t&&k.type=="bookmark"&&(!n||x.marker.insertLeft)){var z=x.from==null||(k.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new Qn(k,z?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Ai(e,t){if(t.full)return null;var n=Bn(e,t.from.line)&&bt(e,t.from.line).markedSpans,r=Bn(e,t.to.line)&&bt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,k=_t(t.from,t.to)==0,W=da(n,i,k),z=ca(r,x,k),V=t.text.length==1,ae=Pe(t.text).length+(V?i:0);if(W)for(var ue=0;ue<W.length;++ue){var we=W[ue];if(we.to==null){var Te=fn(z,we.marker);Te?V&&(we.to=Te.to==null?null:Te.to+ae):we.to=i}}if(z)for(var ke=0;ke<z.length;++ke){var We=z[ke];if(We.to!=null&&(We.to+=ae),We.from==null){var $e=fn(W,We.marker);$e||(We.from=ae,V&&(W||(W=[])).push(We))}else We.from+=ae,V&&(W||(W=[])).push(We)}W&&(W=Dn(W)),z&&z!=W&&(z=Dn(z));var rt=[W];if(!V){var ht=t.text.length-2,nt;if(ht>0&&W)for(var mt=0;mt<W.length;++mt)W[mt].to==null&&(nt||(nt=[])).push(new Qn(W[mt].marker,null,null));for(var Lt=0;Lt<ht;++Lt)rt.push(nt);rt.push(z)}return rt}function Dn(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 Yi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Te){if(Te.markedSpans)for(var ke=0;ke<Te.markedSpans.length;++ke){var We=Te.markedSpans[ke].marker;We.readOnly&&(!r||pe(r,We)==-1)&&(r||(r=[])).push(We)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var k=r[x],W=k.find(0),z=0;z<i.length;++z){var V=i[z];if(_t(V.to,W.from)<0||_t(V.from,W.to)>0)continue;var ae=[z,1],ue=_t(V.from,W.from),we=_t(V.to,W.to);(ue<0||!k.inclusiveLeft&&!ue)&&ae.push({from:V.from,to:W.from}),(we>0||!k.inclusiveRight&&!we)&&ae.push({from:W.to,to:V.to}),i.splice.apply(i,ae),z+=ae.length-3}return i}function Ua(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 $i(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Jn(e){return e.inclusiveLeft?-1:0}function ci(e){return e.inclusiveRight?1:0}function kn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=_t(r.from,i.from)||Jn(e)-Jn(t);if(x)return-x;var k=_t(r.to,i.to)||ci(e)-ci(t);return k||t.id-e.id}function In(e,t){var n=Kr&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||kn(r,i.marker)<0)&&(r=i.marker);return r}function Nn(e){return In(e,!0)}function Kn(e){return In(e,!1)}function fi(e,t){var n=Kr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||kn(r,x.marker)<0)&&(r=x.marker)}return r}function fa(e,t,n,r,i){var x=bt(e,t),k=Kr&&x.markedSpans;if(k)for(var W=0;W<k.length;++W){var z=k[W];if(!z.marker.collapsed)continue;var V=z.marker.find(0),ae=_t(V.from,n)||Jn(z.marker)-Jn(i),ue=_t(V.to,r)||ci(z.marker)-ci(i);if(ae>=0&&ue<=0||ae<=0&&ue>=0)continue;if(ae<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?_t(V.to,n)>=0:_t(V.to,n)>0)||ae>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?_t(V.from,r)<=0:_t(V.from,r)<0))return!0}}function rn(e){for(var t;t=Nn(e);)e=t.find(-1,!0).line;return e}function ha(e){for(var t;t=Kn(e);)e=t.find(1,!0).line;return e}function Li(e){for(var t,n;t=Kn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=bt(e,t),r=rn(n);return n==r?t:tr(r)}function hn(e,t){if(t>e.lastLine())return t;var n=bt(e,t),r;if(!pn(e,n))return t;for(;r=Kn(n);)n=r.find(1,!0).line;return tr(n)+1}function pn(e,t){var n=Kr&&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&&Qi(e,t,r))return!0}}function Qi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Qi(e,r.line,fn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Qi(e,t,i))return!0}function xn(e){e=rn(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 x=n.parent;x;n=x,x=n.parent)for(var k=0;k<x.children.length;++k){var W=x.children[k];if(W==n)break;t+=W.height}return t}function Ji(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Nn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Kn(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function Zi(e){var t=e.display,n=e.doc;t.maxLine=bt(n,n.first),t.maxLineLength=Ji(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Ji(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var hi=function(e,t,n){this.text=e,$i(this,t),this.height=n?n(this):1};hi.prototype.lineNo=function(){return tr(this)},he(hi);function Fa(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ua(e),$i(e,n);var i=r?r(e):1;i!=e.height&&Jr(e,i)}function Et(e){e.parent=null,Ua(e)}var Mt={},St={};function Wt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?St:Mt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function qt(e,t){var n=E("span",null,null,R?"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 x=i?t.rest[i-1]:t.line,k=void 0;r.pos=0,r.addToken=$t,Zt(e.display.measure)&&(k=ft(x,e.doc.direction))&&(r.addToken=nn(r.addToken,k)),r.map=[];var W=t!=e.display.externalMeasured&&tr(x);Hn(x,r,di(e,x,W)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=H(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=H(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(xt(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(R){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=H(r.pre.className,r.textClass||"")),r}function sr(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 $t(e,t,n,r,i,x,k){if(!t)return;var W=e.splitSpaces?Dr(t,e.trailingSpace):t,z=e.cm.state.specialChars,V=!1,ae;if(!z.test(t))e.col+=t.length,ae=document.createTextNode(W),e.map.push(e.pos,e.pos+t.length,ae),U&&I<9&&(V=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ue=0;;){z.lastIndex=ue;var we=z.exec(t),Te=we?we.index-ue:t.length-ue;if(Te){var ke=document.createTextNode(W.slice(ue,ue+Te));U&&I<9?ae.appendChild(o("span",[ke])):ae.appendChild(ke),e.map.push(e.pos,e.pos+Te,ke),e.col+=Te,e.pos+=Te}if(!we)break;ue+=Te+1;var We=void 0;if(we[0]==" "){var $e=e.cm.options.tabSize,rt=$e-e.col%$e;We=ae.appendChild(o("span",fe(rt),"cm-tab")),We.setAttribute("role","presentation"),We.setAttribute("cm-text"," "),e.col+=rt}else we[0]=="\r"||we[0]==`
|
|
`?(We=ae.appendChild(o("span",we[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),We.setAttribute("cm-text",we[0]),e.col+=1):(We=e.cm.options.specialCharPlaceholder(we[0]),We.setAttribute("cm-text",we[0]),U&&I<9?ae.appendChild(o("span",[We])):ae.appendChild(We),e.col+=1);e.map.push(e.pos,e.pos+1,We),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,n||r||i||V||x||k){var ht=n||"";r&&(ht+=r),i&&(ht+=i);var nt=o("span",[ae],ht,x);if(k)for(var mt in k)k.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&nt.setAttribute(mt,k[mt]);return e.content.appendChild(nt)}e.content.appendChild(ae)}function Dr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function nn(e,t){return function(n,r,i,x,k,W,z){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,ae=V+r.length;;){for(var ue=void 0,we=0;we<t.length&&!(ue=t[we],ue.to>V&&ue.from<=V);we++);if(ue.to>=ae)return e(n,r,i,x,k,W,z);e(n,r.slice(0,ue.to-V),i,x,null,W,z),x=null,r=r.slice(ue.to-V),V=ue.to}}}function Ht(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 Hn(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var k=1;k<n.length;k+=2)t.addToken(t,i.slice(x,x=n[k]),Wt(n[k+1],t.cm.options));return}for(var W=i.length,z=0,V=1,ae="",ue,we,Te=0,ke,We,$e,rt,ht;;){if(Te==z){ke=We=$e=we="",ht=null,rt=null,Te=Infinity;for(var nt=[],mt=void 0,Lt=0;Lt<r.length;++Lt){var Ct=r[Lt],Kt=Ct.marker;if(Kt.type=="bookmark"&&Ct.from==z&&Kt.widgetNode)nt.push(Kt);else if(Ct.from<=z&&(Ct.to==null||Ct.to>z||Kt.collapsed&&Ct.to==z&&Ct.from==z)){if(Ct.to!=null&&Ct.to!=z&&Te>Ct.to&&(Te=Ct.to,We=""),Kt.className&&(ke+=" "+Kt.className),Kt.css&&(we=(we?we+";":"")+Kt.css),Kt.startStyle&&Ct.from==z&&($e+=" "+Kt.startStyle),Kt.endStyle&&Ct.to==Te&&(mt||(mt=[])).push(Kt.endStyle,Ct.to),Kt.title&&((ht||(ht={})).title=Kt.title),Kt.attributes)for(var vr in Kt.attributes)(ht||(ht={}))[vr]=Kt.attributes[vr];Kt.collapsed&&(!rt||kn(rt.marker,Kt)<0)&&(rt=Ct)}else Ct.from>z&&Te>Ct.from&&(Te=Ct.from)}if(mt)for(var zr=0;zr<mt.length;zr+=2)mt[zr+1]==Te&&(We+=" "+mt[zr]);if(!rt||rt.from==z)for(var wr=0;wr<nt.length;++wr)Ht(t,0,nt[wr]);if(rt&&(rt.from||0)==z){if(Ht(t,(rt.to==null?W+1:rt.to)-z,rt.marker,rt.from==null),rt.to==null)return;rt.to==z&&(rt=!1)}}if(z>=W)break;for(var Sn=Math.min(W,Te);;){if(ae){var vn=z+ae.length;if(!rt){var kr=vn>Sn?ae.slice(0,Sn-z):ae;t.addToken(t,kr,ue?ue+ke:ke,$e,z+kr.length==Te?We:"",we,ht)}if(vn>=Sn){ae=ae.slice(Sn-z),z=Sn;break}z=vn,$e=""}ae=i.slice(x,x=n[V++]),ue=Wt(n[V++],t.cm.options)}}}function ir(e,t,n){this.line=t,this.rest=Li(t),this.size=this.rest?tr(Pe(this.rest))-n+1:1,this.node=this.text=null,this.hidden=pn(e,t)}function Vr(e,t,n){for(var r=[],i,x=t;x<n;x=i){var k=new ir(e.doc,bt(e.doc,x),x);i=x+k.size,r.push(k)}return r}var Hr=null;function Tn(e){Hr?Hr.ops.push(e):e.ownsGroup=Hr={ops:[e],delayedCallbacks:[]}}function Ba(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 Ho(e,t){var n=e.ownsGroup;if(!n)return;try{Ba(n)}finally{Hr=null,t(n)}}var _i=null;function Ar(e,t){var n=pt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Hr?i=Hr.delayedCallbacks:_i?i=_i:(i=_i=[],setTimeout(vo,0));for(var x=function(W){i.push(function(){return n[W].apply(null,r)})},k=0;k<n.length;++k)x(k)}function vo(){var e=_i;_i=null;for(var t=0;t<e.length;++t)e[t]()}function go(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?yo(e,t):x=="gutter"?Ka(e,t,n,r):x=="class"?Wa(e,t):x=="widget"&&Go(e,t,r)}t.changes=null}function qi(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),U&&I<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=qi(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ja(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):qt(e,t)}function yo(e,t){var n=t.text.className,r=ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Wa(e,t)):n&&(t.text.className=n)}function Wa(e,t){zo(e,t),t.line.wrapClass?qi(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 Ka(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=qi(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 x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var k=qi(t),W=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(W),k.insertBefore(W,t.text),t.line.gutterClass&&(W.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=W.appendChild(o("div",si(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var z=0;z<e.display.gutterSpecs.length;++z){var V=e.display.gutterSpecs[z].className,ae=x.hasOwnProperty(V)&&x[V];ae&&W.appendChild(o("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Go(e,t,n){t.alignable&&(t.alignable=null);for(var r=v("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ha(e,t,n)}function bo(e,t,n,r){var i=ja(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Wa(e,t),Ka(e,t,n,r),Ha(e,t,r),t.node}function Ha(e,t,n){if(Eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Eo(e,t.rest[r],t,n,!1)}function Eo(e,t,n,r,i){if(!t.widgets)return;for(var x=qi(n),k=0,W=t.widgets;k<W.length;++k){var z=W[k],V=o("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Vo(z,V,n,r),e.display.input.setUneditable(V),i&&z.above?x.insertBefore(V,n.gutter||n.text):x.appendChild(V),Ar(z,"redraw")}}function Vo(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(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 zn(e,t){for(var n=ve(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function za(e){return e.lineSpace.offsetTop}function te(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function me(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 ye(e){return xe-e.display.nativeBarWidth}function ie(e){return e.display.scroller.clientWidth-ye(e)-e.display.barWidth}function G(e){return e.display.scroller.clientHeight-ye(e)-e.display.barHeight}function ee(e,t,n){var r=e.options.lineWrapping,i=r&&ie(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var k=t.text.firstChild.getClientRects(),W=0;W<k.length-1;W++){var z=k[W],V=k[W+1];Math.abs(z.bottom-V.bottom)>2&&x.push((z.bottom+V.top)/2-n.top)}}x.push(n.bottom-n.top)}}function X(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(tr(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function oe(e,t){t=rn(t);var n=tr(t),r=e.display.externalMeasured=new ir(e.doc,t,n);r.lineN=n;var i=r.built=qt(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function se(e,t,n,r){return Se(e,ge(e,t),n,r)}function Ee(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[mr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function ge(e,t){var n=tr(t),r=Ee(e,n);r&&!r.text?r=null:r&&r.changes&&(go(e,r,n,xr(e)),e.curOp.forceUpdate=!0),r||(r=oe(e,t));var i=X(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Se(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),k;return t.cache.hasOwnProperty(x)?k=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(ee(e,t.view,t.rect),t.hasHeights=!0),k=tt(e,t,n,r),k.bogus||(t.cache[x]=k)),{left:k.left,right:k.right,top:i?k.rtop:k.top,bottom:i?k.rbottom:k.bottom}}var Me={left:0,right:0,top:0,bottom:0};function Ge(e,t,n){for(var r,i,x,k,W,z,V=0;V<e.length;V+=3)if(W=e[V],z=e[V+1],t<W?(i=0,x=1,k="left"):t<z?(i=t-W,x=i+1):(V==e.length-3||t==z&&e[V+3]>t)&&(x=z-W,i=x-1,t>=z&&(k="right")),i!=null){if(r=e[V+2],W==z&&n==(r.insertLeft?"left":"right")&&(k=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],k="left";if(n=="right"&&i==z-W)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],k="right";break}return{node:r,start:i,end:x,collapse:k,coverStart:W,coverEnd:z}}function ze(e,t){var n=Me;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 tt(e,t,n,r){var i=Ge(t.map,n,r),x=i.node,k=i.start,W=i.end,z=i.collapse,V;if(x.nodeType==3){for(var ae=0;ae<4;ae++){for(;k&&Ne(t.line.text.charAt(i.coverStart+k));)--k;for(;i.coverStart+W<i.coverEnd&&Ne(t.line.text.charAt(i.coverStart+W));)++W;if(U&&I<9&&k==0&&W==i.coverEnd-i.coverStart?V=x.parentNode.getBoundingClientRect():V=ze(g(x,k,W).getClientRects(),r),V.left||V.right||k==0)break;W=k,k=k-1,z="right"}U&&I<11&&(V=At(e.display.measure,V))}else{k>0&&(z=r="right");var ue;e.options.lineWrapping&&(ue=x.getClientRects()).length>1?V=ue[r=="right"?ue.length-1:0]:V=x.getBoundingClientRect()}if(U&&I<9&&!k&&(!V||!V.left&&!V.right)){var we=x.parentNode.getClientRects()[0];we?V={left:we.left,right:we.left+Nr(e.display),top:we.top,bottom:we.bottom}:V=Me}for(var Te=V.top-t.rect.top,ke=V.bottom-t.rect.top,We=(Te+ke)/2,$e=t.view.measure.heights,rt=0;rt<$e.length-1&&!(We<$e[rt]);rt++);var ht=rt?$e[rt-1]:0,nt=$e[rt],mt={left:(z=="right"?V.right:V.left)-t.rect.left,right:(z=="left"?V.left:V.right)-t.rect.left,top:ht,bottom:nt};return!V.left&&!V.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=Te,mt.rbottom=ke),mt}function At(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Cr(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 Bt(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 kt(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Bt(e.display.view[t])}function Nt(e){kt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function jt(){return y&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ft(){return y&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ut(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Mi(e.widgets[n]));return t}function Qt(e,t,n,r,i){if(!i){var x=Ut(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var k=xn(t);if(r=="local"?k+=za(e.display):k-=e.display.viewOffset,r=="page"||r=="window"){var W=e.display.lineSpace.getBoundingClientRect();k+=W.top+(r=="window"?0:Ft());var z=W.left+(r=="window"?0:jt());n.left+=z,n.right+=z}return n.top+=k,n.bottom+=k,n}function zt(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=jt(),i-=Ft();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var k=e.display.lineSpace.getBoundingClientRect();return{left:r-k.left,top:i-k.top}}function gr(e,t,n,r,i){return r||(r=bt(e.doc,t.line)),Qt(e,r,se(e,r,t.ch,i),n)}function Gt(e,t,n,r,i,x){r=r||bt(e.doc,t.line),i||(i=ge(e,r));function k(ke,We){var $e=Se(e,i,ke,We?"right":"left",x);return We?$e.left=$e.right:$e.right=$e.left,Qt(e,r,$e,n)}var W=ft(r,e.doc.direction),z=t.ch,V=t.sticky;if(z>=r.text.length?(z=r.text.length,V="before"):z<=0&&(z=0,V="after"),!W)return k(V=="before"?z-1:z,V=="before");function ae(ke,We,$e){var rt=W[We],ht=rt.level==1;return k($e?ke-1:ke,ht!=$e)}var ue=Je(W,z,V),we=ot,Te=ae(z,ue,V=="before");return we!=null&&(Te.other=ae(z,we,V!="before")),Te}function Ot(e,t){var n=0;t=Pt(e.doc,t),e.options.lineWrapping||(n=Nr(e.display)*t.ch);var r=bt(e.doc,t.line),i=xn(r)+za(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wt(e,t,n,r,i){var x=He(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function Vt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return wt(r.first,0,null,-1,-1);var i=wn(r,n),x=r.first+r.size-1;if(i>x)return wt(r.first+r.size-1,bt(r,x).text.length,null,1,1);t<0&&(t=0);for(var k=bt(r,i);;){var W=yr(e,k,i,t,n),z=fi(k,W.ch+(W.xRel>0||W.outside>0?1:0));if(!z)return W;var V=z.find(1);if(V.line==i)return V;k=bt(r,i=V.line)}}function Jt(e,t,n,r){r-=Ut(t);var i=t.text.length,x=lt(function(k){return Se(e,n,k-1).bottom<=r},i,0);return i=lt(function(k){return Se(e,n,k).top>r},x,i),{begin:x,end:i}}function yt(e,t,n,r){n||(n=ge(e,t));var i=Qt(e,t,Se(e,n,r),"line").top;return Jt(e,t,n,i)}function er(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function yr(e,t,n,r,i){i-=xn(t);var x=ge(e,t),k=Ut(t),W=0,z=t.text.length,V=!0,ae=ft(t,e.doc.direction);if(ae){var ue=(e.options.lineWrapping?cr:rr)(e,t,n,x,ae,r,i);V=ue.level!=1,W=V?ue.from:ue.to-1,z=V?ue.to:ue.from-1}var we=null,Te=null,ke=lt(function(Lt){var Ct=Se(e,x,Lt);return Ct.top+=k,Ct.bottom+=k,er(Ct,r,i,!1)?(Ct.top<=i&&Ct.left<=r&&(we=Lt,Te=Ct),!0):!1},W,z),We,$e,rt=!1;if(Te){var ht=r-Te.left<Te.right-r,nt=ht==V;ke=we+(nt?0:1),$e=nt?"after":"before",We=ht?Te.left:Te.right}else{!V&&(ke==z||ke==W)&&ke++,$e=ke==0?"after":ke==t.text.length?"before":Se(e,x,ke-(V?1:0)).bottom+k<=i==V?"after":"before";var mt=Gt(e,He(n,ke,$e),"line",t,x);We=mt.left,rt=i<mt.top?-1:i>=mt.bottom?1:0}return ke=Ue(t.text,ke,1),wt(n,ke,$e,rt,r-We)}function rr(e,t,n,r,i,x,k){var W=lt(function(ue){var we=i[ue],Te=we.level!=1;return er(Gt(e,He(n,Te?we.to:we.from,Te?"before":"after"),"line",t,r),x,k,!0)},0,i.length-1),z=i[W];if(W>0){var V=z.level!=1,ae=Gt(e,He(n,V?z.from:z.to,V?"after":"before"),"line",t,r);er(ae,x,k,!0)&&ae.top>k&&(z=i[W-1])}return z}function cr(e,t,n,r,i,x,k){var W=Jt(e,t,r,k),z=W.begin,V=W.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var ae=null,ue=null,we=0;we<i.length;we++){var Te=i[we];if(Te.from>=V||Te.to<=z)continue;var ke=Te.level!=1,We=Se(e,r,ke?Math.min(V,Te.to)-1:Math.max(z,Te.from)).right,$e=We<x?x-We+1e9:We-x;(!ae||ue>$e)&&(ae=Te,ue=$e)}return ae||(ae=i[i.length-1]),ae.from<z&&(ae={from:z,to:ae.to,level:ae.level}),ae.to>V&&(ae={from:ae.from,to:V,level:ae.level}),ae}var ur;function Lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ur==null){ur=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ur.appendChild(document.createTextNode("x")),ur.appendChild(o("br"));ur.appendChild(document.createTextNode("x"))}d(e.measure,ur);var n=ur.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function Nr(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 xr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,k=0;x;x=x.nextSibling,++k){var W=e.display.gutterSpecs[k].className;n[W]=x.offsetLeft+x.clientLeft+i,r[W]=x.clientWidth}return{fixedPos:Zr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Zr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function An(e){var t=Lr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Nr(e.display)-3);return function(i){if(pn(e.doc,i))return 0;var x=0;if(i.widgets)for(var k=0;k<i.widgets.length;k++)i.widgets[k].height&&(x+=i.widgets[k].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function an(e){var t=e.doc,n=An(e);t.iter(function(r){var i=n(r);i!=r.height&&Jr(r,i)})}function Ur(e,t,n,r){var i=e.display;if(!n&&ve(t).getAttribute("cm-not-content")=="true")return null;var x,k,W=i.lineSpace.getBoundingClientRect();try{x=t.clientX-W.left,k=t.clientY-W.top}catch(ue){return null}var z=Vt(e,x,k),V;if(r&&z.xRel>0&&(V=bt(e.doc,z.line).text).length==z.ch){var ae=Q(V,V.length,e.options.tabSize)-V.length;z=He(z.line,Math.max(0,Math.round((x-me(e.display).left)/Nr(e.display))-ae))}return z}function mr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function fr(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)Kr&&Zn(e.doc,t)<i.viewTo&&br(e);else if(n<=i.viewFrom)Kr&&hn(e.doc,n+r)>i.viewFrom?br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)br(e);else if(t<=i.viewFrom){var x=Ln(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):br(e)}else if(n>=i.viewTo){var k=Ln(e,t,t,-1);k?(i.view=i.view.slice(0,k.index),i.viewTo=k.lineN):br(e)}else{var W=Ln(e,t,t,-1),z=Ln(e,n,n+r,1);W&&z?(i.view=i.view.slice(0,W.index).concat(Vr(e,W.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):br(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Tr(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 x=r.view[mr(e,t)];if(x.node==null)return;var k=x.changes||(x.changes=[]);pe(k,n)==-1&&k.push(n)}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ln(e,t,n,r){var i=mr(e,t),x,k=e.display.view;if(!Kr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var W=e.display.viewFrom,z=0;z<i;z++)W+=k[z].size;if(W!=t){if(r>0){if(i==k.length-1)return null;x=W+k[i].size-t,i++}else x=W-t;t+=x,n+=x}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:k.length-1))return null;n+=r*k[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function qn(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Vr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Vr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(mr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Vr(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,mr(e,n)))),r.viewTo=n}function ei(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 dr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Un(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),k=0;k<n.sel.ranges.length;k++){if(!t&&k==n.sel.primIndex)continue;var W=n.sel.ranges[k];if(W.from().line>=e.display.viewTo||W.to().line<e.display.viewFrom)continue;var z=W.empty();(z||e.options.showCursorWhenSelecting)&&ti(e,W.head,i),z||lr(e,W,x)}return r}function ti(e,t,n){var r=Gt(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 x=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function pr(e,t){return e.top-t.top||e.left-t.left}function lr(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),k=me(e.display),W=k.left,z=Math.max(r.sizerWidth,ie(e)-r.sizer.offsetLeft)-k.right,V=i.direction=="ltr";function ae(nt,mt,Lt,Ct){mt<0&&(mt=0),mt=Math.round(mt),Ct=Math.round(Ct),x.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
|
|
top: `+mt+"px; width: "+(Lt==null?z-nt:Lt)+`px;
|
|
height: `+(Ct-mt)+"px"))}function ue(nt,mt,Lt){var Ct=bt(i,nt),Kt=Ct.text.length,vr,zr;function wr(kr,gn){return gr(e,He(nt,kr),"div",Ct,gn)}function Sn(kr,gn,Yr){var Wr=yt(e,Ct,null,kr),Ir=gn=="ltr"==(Yr=="after")?"left":"right",_r=Yr=="after"?Wr.begin:Wr.end-(/\s/.test(Ct.text.charAt(Wr.end-1))?2:1);return wr(_r,Ir)[Ir]}var vn=ft(Ct,i.direction);return ut(vn,mt||0,Lt==null?Kt:Lt,function(kr,gn,Yr,Wr){var Ir=Yr=="ltr",_r=wr(kr,Ir?"left":"right"),yn=wr(gn-1,Ir?"right":"left"),Ra=mt==null&&kr==0,Wi=Lt==null&&gn==Kt,en=Wr==0,oi=!vn||Wr==vn.length-1;if(yn.top-_r.top<=3){var Gr=(V?Ra:Wi)&&en,ps=(V?Wi:Ra)&&oi,Ei=Gr?W:(Ir?_r:yn).left,aa=ps?z:(Ir?yn:_r).right;ae(Ei,_r.top,aa-Ei,_r.bottom)}else{var oa,un,Pa,ms;Ir?(oa=V&&Ra&&en?W:_r.left,un=V?z:Sn(kr,Yr,"before"),Pa=V?W:Sn(gn,Yr,"after"),ms=V&&Wi&&oi?z:yn.right):(oa=V?Sn(kr,Yr,"before"):W,un=!V&&Ra&&en?z:_r.right,Pa=!V&&Wi&&oi?W:yn.left,ms=V?Sn(gn,Yr,"after"):z),ae(oa,_r.top,un-oa,_r.bottom),_r.bottom<yn.top&&ae(W,_r.bottom,null,yn.top),ae(Pa,yn.top,ms-Pa,yn.bottom)}(!vr||pr(_r,vr)<0)&&(vr=_r),pr(yn,vr)<0&&(vr=yn),(!zr||pr(_r,zr)<0)&&(zr=_r),pr(yn,zr)<0&&(zr=yn)}),{start:vr,end:zr}}var we=t.from(),Te=t.to();if(we.line==Te.line)ue(we.line,we.ch,Te.ch);else{var ke=bt(i,we.line),We=bt(i,Te.line),$e=rn(ke)==rn(We),rt=ue(we.line,we.ch,$e?ke.text.length+1:null).end,ht=ue(Te.line,$e?0:null,Te.ch).start;$e&&(rt.top<ht.top-2?(ae(rt.right,rt.top,null,rt.bottom),ae(W,ht.top,ht.left,ht.bottom)):ae(rt.right,rt.top,ht.left-rt.right,rt.bottom)),rt.bottom<ht.top&&ae(W,rt.bottom,null,ht.top)}n.appendChild(x)}function Fr(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()||Ri(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(),ri(e))}function Ga(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ri(e))},100)}function ri(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Fr(e)}function Ri(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function pa(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,k=void 0,W=0;if(i.hidden)continue;if(U&&I<8){var z=i.node.offsetTop+i.node.offsetHeight;k=z-n,n=z}else{var V=i.node.getBoundingClientRect();k=V.bottom-V.top,!x&&i.text.firstChild&&(W=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var ae=i.line.height-k;if((ae>.005||ae<-.005)&&(Jr(i.line,k),Va(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)Va(i.rest[ue]);if(W>e.display.sizerWidth){var we=Math.ceil(W/Nr(e.display));we>e.display.maxLineLength&&(e.display.maxLineLength=we,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Va(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ma(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-za(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=wn(t,r),k=wn(t,i);if(n&&n.ensure){var W=n.ensure.from.line,z=n.ensure.to.line;W<x?(x=W,k=wn(t,xn(bt(t,W))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=k&&(x=wn(t,xn(bt(t,z))-e.wrapper.clientHeight),k=z)}return{from:x,to:Math.max(k,x+1)}}function Xo(e,t){if(Ke(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&&!C){var x=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-za(e.display))+`px;
|
|
height: `+(t.bottom-t.top+ye(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}function Yo(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var k=!1,W=Gt(e,t),z=!n||n==t?W:Gt(e,n);i={left:Math.min(W.left,z.left),top:Math.min(W.top,z.top)-r,right:Math.max(W.left,z.left),bottom:Math.max(W.bottom,z.bottom)+r};var V=Xa(e,i),ae=e.doc.scrollTop,ue=e.doc.scrollLeft;if(V.scrollTop!=null&&(Ii(e,V.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(k=!0)),V.scrollLeft!=null&&(_n(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(k=!0)),!k)break}return i}function To(e,t){var n=Xa(e,t);n.scrollTop!=null&&Ii(e,n.scrollTop),n.scrollLeft!=null&&_n(e,n.scrollLeft)}function Xa(e,t){var n=e.display,r=Lr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=G(e),k={};t.bottom-t.top>x&&(t.bottom=t.top+x);var W=e.doc.height+te(n),z=t.top<r,V=t.bottom>W-r;if(t.top<i)k.scrollTop=z?0:t.top;else if(t.bottom>i+x){var ae=Math.min(t.top,(V?W:t.bottom)-x);ae!=i&&(k.scrollTop=ae)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,we=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,Te=ie(e)-n.gutters.offsetWidth,ke=t.right-t.left>Te;return ke&&(t.right=t.left+Te),t.left<10?k.scrollLeft=0:t.left<we?k.scrollLeft=Math.max(0,t.left+ue-(ke?0:10)):t.right>Te+we-3&&(k.scrollLeft=t.right+(ke?0:10)-Te),k}function Ya(e,t){if(t==null)return;va(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Pi(e){va(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ki(e,t,n){(t!=null||n!=null)&&va(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function $o(e,t){va(e),e.curOp.scrollToPos=t}function va(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Ot(e,t.from),r=Ot(e,t.to);ea(e,n,r,t.margin)}}function ea(e,t,n,r){var i=Xa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ki(e,i.scrollLeft,i.scrollTop)}function Ii(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||na(e,{top:t}),Ni(e,t,!0),A&&na(e),ra(e,100)}function Ni(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 _n(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,Yt(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function pi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+te(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+ye(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var ni=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),_e(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),_e(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,U&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ni.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 x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"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}},ni.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ni.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ni.prototype.zeroWidthHack=function(){var e=s&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ne,this.disableVert=new ne},ni.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ni.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ta=function(){};ta.prototype.update=function(){return{bottom:0,right:0}},ta.prototype.setScrollLeft=function(){},ta.prototype.setScrollTop=function(){},ta.prototype.clear=function(){};function mi(e,t){t||(t=pi(e));var n=e.display.barWidth,r=e.display.barHeight;ga(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&pa(e),ga(e,pi(e)),n=e.display.barWidth,r=e.display.barHeight}function ga(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var $a={native:ni,null:ta};function ya(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $a[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),_e(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"?_n(e,t):Ii(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Qa=0;function ii(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qa},Tn(e.curOp)}function vi(e){var t=e.curOp;t&&Ho(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;So(n)})}function So(e){for(var t=e.ops,n=0;n<t.length;n++)Qo(t[n]);for(var r=0;r<t.length;r++)Jo(t[r]);for(var i=0;i<t.length;i++)Zo(t[i]);for(var x=0;x<t.length;x++)Ja(t[x]);for(var k=0;k<t.length;k++)qo(t[k])}function Qo(e){var t=e.cm,n=t.display;wo(t),e.updateMaxLine&&Zi(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 Mn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Jo(e){e.updatedDisplay=e.mustUpdate&&gi(e.cm,e.update)}function Zo(e){var t=e.cm,n=t.display;e.updatedDisplay&&pa(t),e.barMeasure=pi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=se(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+ye(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ie(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Ja(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&_n(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&mi(t,e.barMeasure),e.updatedDisplay&&or(t,e.barMeasure),e.selectionChanged&&Fr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&xo(e.cm)}function qo(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&ba(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Ni(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&_n(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Yo(t,Pt(r,e.scrollToPos.from),Pt(r,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,i)}var x=e.maybeHiddenMarkers,k=e.maybeUnhiddenMarkers;if(x)for(var W=0;W<x.length;++W)x[W].lines.length||Re(x[W],"hide");if(k)for(var z=0;z<k.length;++z)k[z].lines.length&&Re(k[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function on(e,t){if(e.curOp)return t();ii(e);try{return t()}finally{vi(e)}}function Mr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ii(e);try{return t.apply(e,arguments)}finally{vi(e)}}}function Xr(e){return function(){if(this.curOp)return e.apply(this,arguments);ii(this);try{return e.apply(this,arguments)}finally{vi(this)}}}function Rr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ii(t);try{return e.apply(this,arguments)}finally{vi(t)}}}function ra(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,j(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Cn(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var k=x.styles,W=x.text.length>e.options.maxHighlightLength?Pn(t.mode,r.state):null,z=Ki(e,x,r,!0);W&&(r.state=W),x.styles=z.styles;var V=x.styleClasses,ae=z.classes;ae?x.styleClasses=ae:V&&(x.styleClasses=null);for(var ue=!k||k.length!=x.styles.length||V!=ae&&(!V||!ae||V.bgClass!=ae.bgClass||V.textClass!=ae.textClass),we=0;!ue&&we<k.length;++we)ue=k[we]!=x.styles[we];ue&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&Oi(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ra(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&on(e,function(){for(var x=0;x<i.length;x++)Tr(e,i[x],"text")})}var Mn=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ma(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ie(e),this.force=n,this.dims=xr(e),this.events=[]};Mn.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Mn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function wo(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ye(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ye(e)+"px",t.scrollbarsClipped=!0)}function Co(e){if(e.hasFocus())return null;var t=P();if(!t||!S(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Oo(e){if(!e||!e.activeElt||e.activeElt==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(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 gi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return br(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&ei(e)==0)return!1;Br(e)&&(br(e),t.dims=xr(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),k=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>k&&n.viewTo-k<20&&(k=Math.min(i,n.viewTo)),Kr&&(x=Zn(e.doc,x),k=hn(e.doc,k));var W=x!=n.viewFrom||k!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;qn(e,x,k),n.viewOffset=xn(bt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=ei(e);if(!W&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=Co(e);return z>4&&(n.lineDiv.style.display="none"),Do(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Oo(V),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,W&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ra(e,400)),n.updateLineNumbers=null,!0}function ba(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ie(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+te(e.display)-G(e),n.top)}),t.visible=ma(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ma(e.display,e.doc,n));if(!gi(e,t))break;pa(e);var i=pi(e);dr(e),mi(e,i),or(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 na(e,t){var n=new Mn(e,t);if(gi(e,n)){pa(e),ba(e,n);var r=pi(e);dr(e),mi(e,r),or(e,r),n.finish()}}function Do(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,k=x.firstChild;function W(ke){var We=ke.nextSibling;return R&&s&&e.display.currentWheelTarget==ke?ke.style.display="none":ke.parentNode.removeChild(ke),We}for(var z=r.view,V=r.viewFrom,ae=0;ae<z.length;ae++){var ue=z[ae];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=x){var we=bo(e,ue,V,n);x.insertBefore(we,k)}else{for(;k!=ue.node;)k=W(k);var Te=i&&t!=null&&t<=V&&ue.lineNumber;ue.changes&&(pe(ue.changes,"gutter")>-1&&(Te=!1),go(e,ue,V,n)),Te&&(f(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(si(e.options,V)))),k=ue.node.nextSibling}V+=ue.size}for(;k;)k=W(k)}function Ea(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function or(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+ye(e)+"px"}function Yt(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Zr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",k=0;k<n.length;k++)if(!n[k].hidden){e.options.fixedGutter&&(n[k].gutter&&(n[k].gutter.style.left=x),n[k].gutterBackground&&(n[k].gutterBackground.style.left=x));var W=n[k].alignable;if(W)for(var z=0;z<W.length;z++)W[z].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Br(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=si(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")),x=i.firstChild.offsetWidth,k=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-k)+1,r.lineNumWidth=r.lineNumInnerWidth+k,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ea(e.display),!0}return!1}function sn(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],k=null;if(typeof x!="string"&&(k=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:k})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ui(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,k=i.style,W=t.appendChild(o("div",null,"CodeMirror-gutter "+x));k&&(W.style.cssText=k),x=="CodeMirror-linenumbers"&&(e.lineGutter=W,W.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ea(e)}function Gn(e){Ui(e.display),fr(e),Yt(e)}function ia(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 x=E("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[x],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+xe+"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"),U&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(A&&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=sn(r.gutters,r.lineNumbers),Ui(i),n.init(i)}var ai=0,jr=null;U?jr=-.53:A?jr=15:y?jr=-.7:L&&(jr=-1/3);function xa(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 Za(e){var t=xa(e);return t.x*=jr,t.y*=jr,t}function qa(e,t){var n=xa(t),r=n.x,i=n.y,x=e.display,k=x.scroller,W=k.scrollWidth>k.clientWidth,z=k.scrollHeight>k.clientHeight;if(!(r&&W||i&&z))return;if(i&&s&&R){e:for(var V=t.target,ae=x.view;V!=k;V=V.parentNode)for(var ue=0;ue<ae.length;ue++)if(ae[ue].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!w&&jr!=null){i&&z&&Ii(e,Math.max(0,k.scrollTop+i*jr)),_n(e,Math.max(0,k.scrollLeft+r*jr)),(!i||i&&z)&&$(t),x.wheelStartX=null;return}if(i&&jr!=null){var we=i*jr,Te=e.doc.scrollTop,ke=Te+x.wrapper.clientHeight;we<0?Te=Math.max(0,Te+we-50):ke=Math.min(e.doc.height,ke+we+50),na(e,{top:Te,bottom:ke})}ai<20&&(x.wheelStartX==null?(x.wheelStartX=k.scrollLeft,x.wheelStartY=k.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var We=k.scrollLeft-x.wheelStartX,$e=k.scrollTop-x.wheelStartY,rt=$e&&x.wheelDY&&$e/x.wheelDY||We&&x.wheelDX&&We/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!rt)return;jr=(jr*ai+rt)/(ai+1),++ai},200)):(x.wheelDX+=r,x.wheelDY+=i))}var ln=function(e,t){this.ranges=e,this.primIndex=t};ln.prototype.primary=function(){return this.ranges[this.primIndex]},ln.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(!li(n.anchor,r.anchor)||!li(n.head,r.head))return!1}return!0},ln.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ar(ui(this.ranges[t].anchor),ui(this.ranges[t].head));return new ln(e,this.primIndex)},ln.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ln.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(_t(t,r.from())>=0&&_t(e,r.to())<=0)return n}return-1};var ar=function(e,t){this.anchor=e,this.head=t};ar.prototype.from=function(){return jn(this.anchor,this.head)},ar.prototype.to=function(){return wi(this.anchor,this.head)},ar.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Rn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(we,Te){return _t(we.from(),Te.from())}),n=pe(t,i);for(var x=1;x<t.length;x++){var k=t[x],W=t[x-1],z=_t(W.to(),k.from());if(r&&!k.empty()?z>0:z>=0){var V=jn(W.from(),k.from()),ae=wi(W.to(),k.to()),ue=W.empty()?k.from()==k.head:W.from()==W.head;x<=n&&--n,t.splice(--x,2,new ar(ue?ae:V,ue?V:ae))}}return new ln(t,n)}function Vn(e,t){return new ln([new ar(e,t||e)],0)}function Xn(e){return e.text?He(e.from.line+e.text.length-1,Pe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function eo(e,t){if(_t(e,t.from)<0)return e;if(_t(e,t.to)<=0)return Xn(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+=Xn(t).ch-t.to.ch),He(n,r)}function Ta(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new ar(eo(i.anchor,t),eo(i.head,t)))}return Rn(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?He(n.line,e.ch-t.ch+n.ch):He(n.line+(e.line-t.line),e.ch)}function Lo(e,t,n){for(var r=[],i=He(e.first,0),x=i,k=0;k<t.length;k++){var W=t[k],z=Ao(W.from,i,x),V=Ao(Xn(W),i,x);if(i=W.to,x=V,n=="around"){var ae=e.sel.ranges[k],ue=_t(ae.head,ae.anchor)<0;r[k]=new ar(ue?V:z,ue?z:V)}else r[k]=new ar(z,z)}return new ln(r,e.sel.primIndex)}function yi(e){e.doc.mode=dn(e.options,e.doc.modeOption),to(e)}function to(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ra(e,100),e.state.modeGen++,e.curOp&&fr(e)}function vs(e,t){return t.from.ch==0&&t.to.ch==0&&Pe(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,n,r){function i(ht){return n?n[ht]:null}function x(ht,nt,mt){Fa(ht,nt,mt,r),Ar(ht,"change",ht,t)}function k(ht,nt){for(var mt=[],Lt=ht;Lt<nt;++Lt)mt.push(new hi(V[Lt],i(Lt),r));return mt}var W=t.from,z=t.to,V=t.text,ae=bt(e,W.line),ue=bt(e,z.line),we=Pe(V),Te=i(V.length-1),ke=z.line-W.line;if(t.full)e.insert(0,k(0,V.length)),e.remove(V.length,e.size-V.length);else if(vs(e,t)){var We=k(0,V.length-1);x(ue,ue.text,Te),ke&&e.remove(W.line,ke),We.length&&e.insert(W.line,We)}else if(ae==ue)if(V.length==1)x(ae,ae.text.slice(0,W.ch)+we+ae.text.slice(z.ch),Te);else{var $e=k(1,V.length-1);$e.push(new hi(we+ae.text.slice(z.ch),Te,r)),x(ae,ae.text.slice(0,W.ch)+V[0],i(0)),e.insert(W.line+1,$e)}else if(V.length==1)x(ae,ae.text.slice(0,W.ch)+V[0]+ue.text.slice(z.ch),i(0)),e.remove(W.line+1,ke);else{x(ae,ae.text.slice(0,W.ch)+V[0],i(0)),x(ue,we+ue.text.slice(z.ch),Te);var rt=k(1,V.length-1);ke>1&&e.remove(W.line+1,ke-1),e.insert(W.line+1,rt)}Ar(e,"change",e,t)}function Fi(e,t,n){function r(i,x,k){if(i.linked)for(var W=0;W<i.linked.length;++W){var z=i.linked[W];if(z.doc==x)continue;var V=k&&z.sharedHist;if(n&&!V)continue;t(z.doc,V),r(z.doc,i,V)}}r(e,null,!0)}function gs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,an(e),yi(e),ys(e),e.options.lineWrapping||Zi(e),e.options.mode=t.modeOption,fr(e)}function ys(e){(e.doc.direction=="rtl"?B:c)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){on(e,function(){ys(e),fr(e)})}function _o(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function rs(e,t){var n={from:ui(t.from),to:Xn(t),text:Fn(e,t.from,t.to)};return xs(e,n,t.from.line,t.to.line+1),Fi(e,function(r){return xs(r,n,t.from.line,t.to.line+1)},!0),n}function bs(e){for(;e.length;){var t=Pe(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),Pe(e.done);if(e.done.length&&!Pe(e.done).ranges)return Pe(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Pe(e.done)}function Es(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,k,W;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(k=pl(i,i.lastOp==r)))W=Pe(k.changes),_t(t.from,t.to)==0&&_t(t.from,W.to)==0?W.to=Xn(t):k.changes.push(rs(e,t));else{var z=Pe(i.done);for((!z||!z.ranges)&&Mo(e.sel,i.done),k={changes:[rs(e,t)],generation:i.generation},i.done.push(k);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=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,W||Re(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 vl(e,t,n,r){var i=e.history,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||ml(e,x,Pe(i.done),t))?i.done[i.done.length-1]=t:Mo(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&bs(i.undone)}function Mo(e,t){var n=Pe(t);n&&n.ranges&&n.equals(e)||t.push(e)}function xs(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(k){k.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=k.markedSpans),++x})}function gl(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(gl(n[i]));return r}function Ts(e,t){var n=yl(e,t),r=Ai(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],k=r[i];if(x&&k){e:for(var W=0;W<k.length;++W){for(var z=k[W],V=0;V<x.length;++V)if(x[V].marker==z.marker)continue e;x.push(z)}}else k&&(n[i]=k)}return n}function Sa(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?ln.prototype.deepCopy.call(x):x);continue}var k=x.changes,W=[];r.push({changes:W});for(var z=0;z<k.length;++z){var V=k[z],ae=void 0;if(W.push({from:V.from,to:V.to,text:V.text}),t)for(var ue in V)(ae=ue.match(/^spans_(\d+)$/))&&(pe(t,Number(ae[1]))>-1&&(Pe(W)[ue]=V[ue],delete V[ue]))}}return r}function ns(e,t,n,r){if(r){var i=e.anchor;if(n){var x=_t(t,i)<0;x!=_t(n,i)<0?(i=t,t=n):x!=_t(t,n)<0&&(t=n)}return new ar(i,t)}else return new ar(n||t,t)}function Ro(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),qr(e,new ln([ns(e.sel.primary(),t,n,i)],0),r)}function Ss(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=ns(e.sel.ranges[x],t[x],null,i);var k=Rn(e.cm,r,e.sel.primIndex);qr(e,k,n)}function is(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,qr(e,Rn(e.cm,i,e.sel.primIndex),r)}function ws(e,t,n,r){qr(e,Vn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new ar(Pt(e,i[x].anchor),Pt(e,i[x].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Rn(e.cm,r.ranges,r.ranges.length-1):t}function Cs(e,t,n){var r=e.history.done,i=Pe(r);i&&i.ranges?(r[r.length-1]=t,Po(e,t,n)):qr(e,t,n)}function qr(e,t,n){Po(e,t,n),vl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Po(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(_t(t.primary().head,e.sel.primary().head)<0?-1:1);Os(e,As(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Pi(e.cm)}function Os(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,be(e.cm)),Ar(e,"cursorActivity",e)}function Ds(e){Os(e,As(e,e.sel,null,!1))}function As(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var k=t.ranges[x],W=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],z=ko(e,k.anchor,W&&W.anchor,n,r),V=ko(e,k.head,W&&W.head,n,r);(i||z!=k.anchor||V!=k.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new ar(z,V))}return i?Rn(e.cm,i,t.primIndex):t}function wa(e,t,n,r,i){var x=bt(e,t.line);if(x.markedSpans)for(var k=0;k<x.markedSpans.length;++k){var W=x.markedSpans[k],z=W.marker,V="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ae="selectRight"in z?!z.selectRight:z.inclusiveRight;if((W.from==null||(V?W.from<=t.ch:W.from<t.ch))&&(W.to==null||(ae?W.to>=t.ch:W.to>t.ch))){if(i&&(Re(z,"beforeCursorEnter"),z.explicitlyCleared))if(x.markedSpans){--k;continue}else break;if(!z.atomic)continue;if(n){var ue=z.find(r<0?1:-1),we=void 0;if((r<0?ae:V)&&(ue=Ls(e,ue,-r,ue&&ue.line==t.line?x:null)),ue&&ue.line==t.line&&(we=_t(ue,n))&&(r<0?we<0:we>0))return wa(e,ue,t,r,i)}var Te=z.find(r<0?-1:1);return(r<0?V:ae)&&(Te=Ls(e,Te,r,Te.line==t.line?x:null)),Te?wa(e,Te,t,r,i):null}}return t}function ko(e,t,n,r,i){var x=r||1,k=wa(e,t,n,x,i)||!i&&wa(e,t,n,x,!0)||wa(e,t,n,-x,i)||!i&&wa(e,t,n,-x,!0);return k||(e.cantEdit=!0,He(e.first,0))}function Ls(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?Pt(e,He(t.line-1)):null:n>0&&t.ch==(r||bt(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+n)}function _s(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),Ae)}function Ms(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,x,k,W){i&&(r.from=Pt(e,i)),x&&(r.to=Pt(e,x)),k&&(r.text=k),W!==void 0&&(r.origin=W)}),Re(e,"beforeChange",e,r),e.cm&&Re(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 Ca(e,t,n){if(e.cm){if(!e.cm.curOp)return Mr(e.cm,Ca)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Ms(e,t,!0),!t))return;var r=Vi&&!n&&Yi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Rs(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Rs(e,t)}function Rs(e,t){if(t.text.length==1&&t.text[0]==""&&_t(t.from,t.to)==0)return;var n=Ta(e,t);Es(e,t,n,e.cm?e.cm.curOp.id:NaN),ro(e,t,n,Ai(e,t));var r=[];Fi(e,function(i,x){!x&&pe(r,i.history)==-1&&(Ns(i.history,t),r.push(i.history)),ro(i,t,null,Ai(i,t))})}function Io(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,k=e.sel,W=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,V=0;V<W.length&&!(x=W[V],n?x.ranges&&!x.equals(e.sel):!x.ranges);V++);if(V==W.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=W.pop(),x.ranges){if(Mo(x,z),n&&!x.equals(e.sel)){qr(e,x,{clearRedo:!1});return}k=x}else if(r){W.push(x);return}else break;var ae=[];Mo(k,z),z.push({changes:ae,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var ue=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),we=function(We){var $e=x.changes[We];if($e.origin=t,ue&&!Ms(e,$e,!1))return W.length=0,{};ae.push(rs(e,$e));var rt=We?Ta(e,$e):Pe(W);ro(e,$e,rt,Ts(e,$e)),!We&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:Xn($e)});var ht=[];Fi(e,function(nt,mt){!mt&&pe(ht,nt.history)==-1&&(Ns(nt.history,$e),ht.push(nt.history)),ro(nt,$e,null,Ts(nt,$e))})},Te=x.changes.length-1;Te>=0;--Te){var ke=we(Te);if(ke)return ke.v}}function Ps(e,t){if(t==0)return;if(e.first+=t,e.sel=new ln(qe(e.sel.ranges,function(i){return new ar(He(i.anchor.line+t,i.anchor.ch),He(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){fr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Tr(e.cm,r,"gutter")}}function ro(e,t,n,r){if(e.cm&&!e.cm.curOp)return Mr(e.cm,ro)(e,t,n,r);if(t.to.line<e.first){Ps(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);Ps(e,i),t={from:He(e.first,0),to:He(t.to.line+i,t.to.ch),text:[Pe(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:He(x,bt(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Fn(e,t.from,t.to),n||(n=Ta(e,t)),e.cm?El(e.cm,t,r):ts(e,t,r),Po(e,n,Ae),e.cantEdit&&ko(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,k=t.to,W=!1,z=x.line;e.options.lineWrapping||(z=tr(rn(bt(r,x.line))),r.iter(z,k.line+1,function(Te){if(Te==i.maxLine)return W=!0,!0})),r.sel.contains(t.from,t.to)>-1&&be(e),ts(r,t,n,An(e)),e.options.lineWrapping||(r.iter(z,x.line+t.text.length,function(Te){var ke=Ji(Te);ke>i.maxLineLength&&(i.maxLine=Te,i.maxLineLength=ke,i.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),ka(r,x.line),ra(e,400);var V=t.text.length-(k.line-x.line)-1;t.full?fr(e):x.line==k.line&&t.text.length==1&&!vs(e.doc,t)?Tr(e,x.line,"text"):fr(e,x.line,k.line+1,V);var ae=de(e,"changes"),ue=de(e,"change");if(ue||ae){var we={from:x,to:k,text:t.text,removed:t.removed,origin:t.origin};ue&&Ar(e,"change",e,we),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(we)}e.display.selForContextMenu=null}function Oa(e,t,n,r,i){var x;r||(r=n),_t(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),Ca(e,{from:n,to:r,text:t,origin:i})}function ks(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],k=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var W=0;W<x.ranges.length;W++)ks(x.ranges[W].anchor,t,n,r),ks(x.ranges[W].head,t,n,r);continue}for(var z=0;z<x.changes.length;++z){var V=x.changes[z];if(n<V.from.line)V.from=He(V.from.line+r,V.from.ch),V.to=He(V.to.line+r,V.to.ch);else if(t<=V.to.line){k=!1;break}}k||(e.splice(0,i+1),i=0)}}function Ns(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Is(e.done,n,r,i),Is(e.undone,n,r,i)}function no(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=bt(e,Ci(e,t)):i=tr(t),i==null?null:(r(x,i)&&e.cm&&Tr(e.cm,i,n),x)}function io(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}io.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Et(i),Ar(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ao(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ao.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var x=Math.min(t,i-e),k=r.height;if(r.removeInner(e,x),this.height-=k-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof io))){var W=[];this.collapse(W),this.children=[new io(W)],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],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var k=i.lines.length%25+25,W=k;W<i.lines.length;){var z=new io(i.lines.slice(W,W+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,k),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ao(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=pe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ao(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],x=i.chunkSize();if(e<x){var k=Math.min(t,x-e);if(i.iterN(e,k,n))return!0;if((t-=k)==0)break;e=0}else e-=x}}};var oo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};oo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=tr(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 x=Mi(this);Jr(n,Math.max(0,n.height-x)),e&&(on(e,function(){Us(e,n,-x),Tr(e,r,"widget")}),Ar(e,"lineWidgetCleared",e,this,r))},oo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Mi(this)-t;if(!i)return;pn(this.doc,r)||Jr(r,r.height+i),n&&on(n,function(){n.curOp.forceUpdate=!0,Us(n,r,i),Ar(n,"lineWidgetChanged",n,e,tr(r))})},he(oo);function Us(e,t,n){xn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ya(e,n)}function xl(e,t,n,r){var i=new oo(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),no(e,t,"widget",function(k){var W=k.widgets||(k.widgets=[]);if(i.insertAt==null?W.push(i):W.splice(Math.min(W.length-1,Math.max(0,i.insertAt)),0,i),i.line=k,x&&!pn(e,k)){var z=xn(k)<e.scrollTop;Jr(k,k.height+Mi(i)),z&&Ya(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&Ar(x,"lineWidgetAdded",x,i,typeof t=="number"?t:tr(t)),i}var Fs=0,Bi=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Fs};Bi.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ii(e),de(this,"clear")){var n=this.find();n&&Ar(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var k=this.lines[x],W=fn(k.markedSpans,this);e&&!this.collapsed?Tr(e,tr(k),"text"):e&&(W.to!=null&&(i=tr(k)),W.from!=null&&(r=tr(k))),k.markedSpans=Xi(k.markedSpans,W),W.from==null&&this.collapsed&&!pn(this.doc,k)&&e&&Jr(k,Lr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var V=rn(this.lines[z]),ae=Ji(V);ae>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&fr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ds(e.doc)),e&&Ar(e,"markerCleared",e,this,r,i),t&&vi(e),this.parent&&this.parent.clear()},Bi.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],k=fn(x.markedSpans,this);if(k.from!=null&&(n=He(t?x:tr(x),k.from),e==-1))return n;if(k.to!=null&&(r=He(t?x:tr(x),k.to),e==1))return r}return n&&{from:n,to:r}},Bi.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;on(r,function(){var i=t.line,x=tr(t.line),k=Ee(r,x);if(k&&(Bt(k),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!pn(n.doc,i)&&n.height!=null){var W=n.height;n.height=null;var z=Mi(n)-W;z&&Jr(i,i.height+z)}Ar(r,"markerChanged",r,e)})},Bi.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||pe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Bi.prototype.detachLine=function(e){if(this.lines.splice(pe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},he(Bi);function Da(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Mr(e.cm,Da)(e,t,n,r,i);var x=new Bi(e,i),k=_t(t,n);if(r&&N(r,x,!1),k>0||k==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=E("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(fa(e,t.line,t,n,x)||t.line!=n.line&&fa(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ia()}x.addToHistory&&Es(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var W=t.line,z=e.cm,V;if(e.iter(W,n.line+1,function(ue){z&&x.collapsed&&!z.options.lineWrapping&&rn(ue)==z.display.maxLine&&(V=!0),x.collapsed&&W!=t.line&&Jr(ue,0),Na(ue,new Qn(x,W==t.line?t.ch:null,W==n.line?n.ch:null)),++W}),x.collapsed&&e.iter(t.line,n.line+1,function(ue){pn(e,ue)&&Jr(ue,0)}),x.clearOnEnter&&_e(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&($n(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++Fs,x.atomic=!0),z){if(V&&(z.curOp.updateMaxLine=!0),x.collapsed)fr(z,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var ae=t.line;ae<=n.line;ae++)Tr(z,ae,"text");x.atomic&&Ds(z.doc),Ar(z,"markerAdded",z,x)}return x}var so=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};so.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ar(this,"clear")},so.prototype.find=function(e,t){return this.primary.find(e,t)},he(so);function Tl(e,t,n,r,i){r=N(r),r.shared=!1;var x=[Da(e,t,n,r,i)],k=x[0],W=r.widgetNode;return Fi(e,function(z){W&&(r.widgetNode=W.cloneNode(!0)),x.push(Da(z,Pt(z,t),Pt(z,n),r,i));for(var V=0;V<z.linked.length;++V)if(z.linked[V].isParent)return;k=Pe(x)}),new so(x,k)}function Bs(e){return e.findMarks(He(e.first,0),e.clipPos(He(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(),x=e.clipPos(i.from),k=e.clipPos(i.to);if(_t(x,k)){var W=Da(e,x,k,r.primary,r.primary.type);r.markers.push(W),W.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Fi(i.primary.doc,function(z){return x.push(z)});for(var k=0;k<i.markers.length;k++){var W=i.markers[k];pe(x,W.doc)==-1&&(W.parent=null,i.markers.splice(k--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,mn=function(e,t,n,r,i){if(!(this instanceof mn))return new mn(e,t,n,r,i);n==null&&(n=0),ao.call(this,[new io([new hi("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=He(n,0);this.sel=Vn(x),this.history=new _o(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)),ts(this,{from:x,to:x,text:e}),qr(this,Vn(x),Ae)};mn.prototype=ct(ao.prototype,{constructor:mn,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=Si(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Rr(function(e){var t=He(this.first,0),n=this.first+this.size-1;Ca(this,{from:t,to:He(n,bt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ki(this.cm,0,0),qr(this,Vn(t),Ae)}),replaceRange:function(e,t,n,r){t=Pt(this,t),n=n?Pt(this,n):t,Oa(this,e,t,n,r)},getRange:function(e,t,n){var r=Fn(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(Bn(this,e))return bt(this,e)},getLineNumber:function(e){return tr(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=bt(this,e)),rn(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:Rr(function(e,t,n){ws(this,Pt(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:Rr(function(e,t,n){ws(this,Pt(this,e),Pt(this,t||e),n)}),extendSelection:Rr(function(e,t,n){Ro(this,Pt(this,e),t&&Pt(this,t),n)}),extendSelections:Rr(function(e,t){Ss(this,Ye(this,e),t)}),extendSelectionsBy:Rr(function(e,t){var n=qe(this.sel.ranges,e);Ss(this,Ye(this,n),t)}),setSelections:Rr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new ar(Pt(this,e[i].anchor),Pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),qr(this,Rn(this.cm,r,t),n)}),addSelection:Rr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new ar(Pt(this,e),Pt(this,t||e))),qr(this,Rn(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=Fn(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=Fn(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:Rr(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var k=i.ranges[x];r[x]={from:k.from(),to:k.to(),text:this.splitLines(e[x]),origin:n}}for(var W=t&&t!="end"&&Lo(this,r,t),z=r.length-1;z>=0;z--)Ca(this,r[z]);W?Cs(this,W):this.cm&&Pi(this.cm)}),undo:Rr(function(){Io(this,"undo")}),redo:Rr(function(){Io(this,"redo")}),undoSelection:Rr(function(){Io(this,"undo",!0)}),redoSelection:Rr(function(){Io(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new _o(this.history.maxGeneration),Fi(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:Sa(this.history.done),undone:Sa(this.history.undone)}},setHistory:function(e){var t=this.history=new _o(this.history.maxGeneration);t.done=Sa(e.done.slice(0),null,!0),t.undone=Sa(e.undone.slice(0),null,!0)},setGutterMarker:Rr(function(e,t,n){return no(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&et(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Rr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&no(t,n,"gutter",function(){return n.gutterMarkers[e]=null,et(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Bn(this,e))return null;if(t=e,e=bt(this,e),!e)return null}else if(t=tr(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:Rr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(v(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Rr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var k=x.match(v(n));if(!k)return!1;var W=k.index+k[0].length;r[i]=x.slice(0,k.index)+(!k.index||W==x.length?"":" ")+x.slice(W)||null}else return!1;return!0})}),addLineWidget:Rr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Da(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),Da(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Pt(this,e);var t=[],n=bt(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(x){var k=x.markedSpans;if(k)for(var W=0;W<k.length;W++){var z=k[W];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),Pt(this,He(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 mn(Si(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 mn(Si(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,Bs(this)),r},unlinkDoc:function(e){if(e instanceof Sr&&(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(Bs(this));break}if(e.history==this.history){var r=[e.id];Fi(e,function(i){return r.push(i.id)},!0),e.history=new _o(null),e.history.done=Sa(this.history.done,r),e.history.undone=Sa(this.history.undone,r)}},iterLinkedDocs:function(e){Fi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Rt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Rr(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)})}),mn.prototype.eachLine=mn.prototype.iter;var js=0;function Ol(e){var t=this;if(Ws(t),Ke(t,e)||zn(t.display,e))return;$(e),U&&(js=+new Date);var n=Ur(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,x=Array(i),k=0,W=function(){++k==i&&Mr(t,function(){n=Pt(t.doc,n);var Te={from:n,to:n,text:t.doc.splitLines(x.filter(function(ke){return ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ca(t.doc,Te),Cs(t.doc,Vn(Pt(t.doc,n),Pt(t.doc,Xn(Te))))})()},z=function(Te,ke){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,Te.type)==-1){W();return}var We=new FileReader;We.onerror=function(){return W()},We.onload=function(){var $e=We.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){W();return}x[ke]=$e,W()},We.readAsText(Te)},V=0;V<r.length;V++)z(r[V],V);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 ae=e.dataTransfer.getData("Text");if(ae){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Po(t.doc,Vn(n,n)),ue)for(var we=0;we<ue.length;++we)Oa(t.doc,"",ue[we].anchor,ue[we].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(Te){}}}function Dl(e,t){if(U&&(!e.state.draggingText||+new Date-js<100)){le(t);return}if(Ke(e,t)||zn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!L){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),w&&n.parentNode.removeChild(n)}}function Al(e,t){var n=Ur(e,t);if(!n)return;var r=document.createDocumentFragment();ti(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 Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ks(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 x=0;x<n.length;x++)e(n[x])})}var Hs=!1;function Ll(){if(Hs)return;_l(),Hs=!0}function _l(){var e;_e(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Ks(Ml)},100))}),_e(window,"blur",function(){return Ks(Ri)})}function Ml(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ji={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},lo=0;lo<10;lo++)ji[lo+48]=ji[lo+96]=String(lo);for(var No=65;No<=90;No++)ji[No]=String.fromCharCode(No);for(var uo=1;uo<=12;uo++)ji[uo+111]=ji[uo+63235]="F"+uo;var bi={};bi.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"},bi.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"},bi.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"},bi.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"]},bi.default=s?bi.macDefault:bi.pcDefault;function Rl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,k=0;k<t.length-1;k++){var W=t[k];if(/^(cmd|meta|m)$/i.test(W))x=!0;else if(/^a(lt)?$/i.test(W))n=!0;else if(/^(c|ctrl|control)$/i.test(W))r=!0;else if(/^s(hift)?$/i.test(W))i=!0;else throw new Error("Unrecognized modifier name: "+W)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=qe(n.split(" "),Rl),x=0;x<i.length;x++){var k=void 0,W=void 0;x==i.length-1?(W=i.join(" "),k=r):(W=i.slice(0,x+1).join(" "),k="...");var z=t[W];if(!z)t[W]=k;else if(z!=k)throw new Error("Inconsistent bindings for "+W)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Aa(e,t,n,r){t=Uo(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Aa(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var k=Aa(e,t.fallthrough[x],n,r);if(k)return k}}}function zs(e){var t=typeof e=="string"?e:ji[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(w&&e.keyCode==34&&e.char)return!1;var n=ji[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Gs(n,e,t))}function Uo(e){return typeof e=="string"?bi[e]:e}function La(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&_t(x.from,Pe(r).to)<=0;){var k=r.pop();if(_t(k.from,x.from)<0){x.from=k.from;break}}r.push(x)}on(e,function(){for(var W=r.length-1;W>=0;W--)Oa(e.doc,"",r[W].from,r[W].to,"+delete");Pi(e)})}function as(e,t,n){var r=Ue(e.text,t+n,n);return r<0||r>e.text.length?null:r}function os(e,t,n){var r=as(e,t.ch,n);return r==null?null:new He(t.line,r,n<0?"after":"before")}function ss(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=ft(n,t.doc.direction);if(x){var k=i<0?Pe(x):x[0],W=i<0==(k.level==1),z=W?"after":"before",V;if(k.level>0||t.doc.direction=="rtl"){var ae=ge(t,n);V=i<0?n.text.length-1:0;var ue=Se(t,ae,V).top;V=lt(function(we){return Se(t,ae,we).top==ue},i<0==(k.level==1)?k.from:k.to-1,V),z=="before"&&(V=as(n,V,1))}else V=i<0?k.to:k.from;return new He(r,V,z)}}return new He(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=ft(t,e.doc.direction);if(!i)return os(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var x=Je(i,n.ch,n.sticky),k=i[x];if(e.doc.direction=="ltr"&&k.level%2==0&&(r>0?k.to>n.ch:k.from<n.ch))return os(t,n,r);var W=function(rt,ht){return as(t,rt instanceof He?rt.ch:rt,ht)},z,V=function(rt){return e.options.lineWrapping?(z=z||ge(e,t),yt(e,t,z,rt)):{begin:0,end:t.text.length}},ae=V(n.sticky=="before"?W(n,-1):n.ch);if(e.doc.direction=="rtl"||k.level==1){var ue=k.level==1==r<0,we=W(n,ue?1:-1);if(we!=null&&(ue?we<=k.to&&we<=ae.end:we>=k.from&&we>=ae.begin)){var Te=ue?"before":"after";return new He(n.line,we,Te)}}var ke=function(rt,ht,nt){for(var mt=function(vr,zr){return zr?new He(n.line,W(vr,1),"before"):new He(n.line,vr,"after")};rt>=0&&rt<i.length;rt+=ht){var Lt=i[rt],Ct=ht>0==(Lt.level!=1),Kt=Ct?nt.begin:W(nt.end,-1);if(Lt.from<=Kt&&Kt<Lt.to)return mt(Kt,Ct);if(Kt=Ct?Lt.from:W(Lt.to,-1),nt.begin<=Kt&&Kt<nt.end)return mt(Kt,Ct)}},We=ke(x+r,r,ae);if(We)return We;var $e=r>0?ae.end:W(ae.begin,-1);return $e!=null&&!(r>0&&$e==t.text.length)&&(We=ke(r>0?0:i.length-1,r,V($e)),We)?We:null}var co={selectAll:_s,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ae)},killLine:function(e){return La(e,function(t){if(t.empty()){var n=bt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return La(e,function(t){return{from:He(t.from().line,0),to:Pt(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return La(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return La(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 La(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(He(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(He(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ce)},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")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ys(e,t.head):r},Ce)},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 x=n[i].from(),k=Q(e.getLine(x.line),x.ch,r);t.push(fe(r-k%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return on(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=bt(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new He(i.line,i.ch-1)),i.ch>0)i=new He(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),He(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var k=bt(e.doc,i.line-1).text;k&&(i=new He(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+k.charAt(k.length-1),He(i.line-1,k.length-1),i,"+transpose"))}}n.push(new ar(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return on(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);Pi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var n=bt(e.doc,t),r=rn(n);return r!=n&&(t=tr(r)),ss(!0,e,r,t,1)}function Il(e,t){var n=bt(e.doc,t),r=ha(n);return r!=n&&(t=tr(r)),ss(!0,e,n,t,-1)}function Ys(e,t){var n=Xs(e,t.line),r=bt(e.doc,n.line),i=ft(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),k=t.line==n.line&&t.ch<=x&&t.ch;return He(n.line,k?0:x,n.sticky)}return n}function Fo(e,t,n){if(typeof t=="string"&&(t=co[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ie}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=Aa(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Aa(t,e.options.extraKeys,n,e)||Aa(t,e.options.keyMap,n,e)}var Ul=new ne;function fo(e,t,n,r){var i=e.state.keySeq;if(i){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,i+" "+t,n,r))return!0}return $s(e,t,n,r)}function $s(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ar(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),Fr(e)),!!i}function Qs(e,t){var n=Vs(t,!0);return n?t.shiftKey&&!e.state.keySeq?fo(e,"Shift-"+n,t,function(r){return Fo(e,r,!0)})||fo(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Fo(e,r)}):fo(e,n,t,function(r){return Fo(e,r)}):!1}function Fl(e,t,n){return fo(e,"'"+n+"'",t,function(r){return Fo(e,r,!0)})}var ls=null;function Js(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),Ke(t,e))return;U&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Qs(t,e);w&&(ls=r?n:null,!r&&n==88&&!nr&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!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;B(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),dt(document,"keyup",n),dt(document,"mouseover",n))}_e(document,"keyup",n),_e(document,"mouseover",n)}function Zs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(zn(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(w&&n==ls){ls=null,$(e);return}if(w&&(!e.which||e.which<10)&&Qs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,n){this.time=e,this.pos=t,this.button=n};us.prototype.compare=function(e,t,n){return this.time+jl>e&&_t(t,this.pos)==0&&n==this.button};var ho,po;function Wl(e,t){var n=+new Date;return po&&po.compare(n,e,t)?(ho=po=null,"triple"):ho&&ho.compare(n,e,t)?(po=new us(n,e,t),ho=null,"double"):(ho=new us(n,e,t),po=null,"single")}function el(e){var t=this,n=t.display;if(Ke(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,zn(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(ds(t,e))return;var r=Ur(t,e),i=Le(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Kl(t,i,r,x,e))return;i==1?r?zl(t,r,x,e):ve(e)==n.scroller&&$(e):i==2?(r&&Ro(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(D?t.display.input.onContextMenu(e):Ga(t))}function Kl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,fo(e,Gs(x,i),i,function(k){if(typeof k=="string"&&(k=co[k]),!k)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=k(e,n)!=Ie}finally{e.state.suppressEdits=!1}return W})}function Hl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){U?setTimeout(j(xo,e),0):e.curOp.focus=P();var i=Hl(e,n,r),x=e.doc.sel,k;e.options.dragDrop&&Fe&&!e.isReadOnly()&&n=="single"&&(k=x.contains(t))>-1&&(_t((k=x.ranges[k]).from(),t)<0||t.xRel>0)&&(_t(k.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,x=!1,k=Mr(e,function(V){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,dt(i.wrapper.ownerDocument,"mouseup",k),dt(i.wrapper.ownerDocument,"mousemove",W),dt(i.scroller,"dragstart",z),dt(i.scroller,"drop",k),x||($(V),r.addNew||Ro(e.doc,n,null,null,r.extend),R&&!L||U&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),W=function(V){x=x||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},z=function(){return x=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=k,k.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),_e(i.wrapper.ownerDocument,"mouseup",k),_e(i.wrapper.ownerDocument,"mousemove",W),_e(i.scroller,"dragstart",z),_e(i.scroller,"drop",k),Ga(e),setTimeout(function(){return i.input.focus()},20)}function tl(e,t,n){if(n=="char")return new ar(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new ar(He(t.line,0),Pt(e.doc,He(t.line+1,0)));var r=n(e,t);return new ar(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;$(t);var k,W,z=x.sel,V=z.ranges;if(r.addNew&&!r.extend?(W=x.sel.contains(n),W>-1?k=V[W]:k=new ar(n,n)):(k=x.sel.primary(),W=x.sel.primIndex),r.unit=="rectangle")r.addNew||(k=new ar(n,n)),n=Ur(e,t,!0,!0),W=-1;else{var ae=tl(e,n,r.unit);r.extend?k=ns(k,ae.anchor,ae.head,r.extend):k=ae}r.addNew?W==-1?(W=V.length,qr(x,Rn(e,V.concat([k]),W),{scroll:!1,origin:"*mouse"})):V.length>1&&V[W].empty()&&r.unit=="char"&&!r.extend?(qr(x,Rn(e,V.slice(0,W).concat(V.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),z=x.sel):is(x,W,k,De):(W=0,qr(x,new ln([k],0),De),z=x.sel);var ue=n;function we(nt){if(_t(ue,nt)==0)return;if(ue=nt,r.unit=="rectangle"){for(var mt=[],Lt=e.options.tabSize,Ct=Q(bt(x,n.line).text,n.ch,Lt),Kt=Q(bt(x,nt.line).text,nt.ch,Lt),vr=Math.min(Ct,Kt),zr=Math.max(Ct,Kt),wr=Math.min(n.line,nt.line),Sn=Math.min(e.lastLine(),Math.max(n.line,nt.line));wr<=Sn;wr++){var vn=bt(x,wr).text,kr=Oe(vn,vr,Lt);vr==zr?mt.push(new ar(He(wr,kr),He(wr,kr))):vn.length>kr&&mt.push(new ar(He(wr,kr),He(wr,Oe(vn,zr,Lt))))}mt.length||mt.push(new ar(n,n)),qr(x,Rn(e,z.ranges.slice(0,W).concat(mt),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var gn=k,Yr=tl(e,nt,r.unit),Wr=gn.anchor,Ir;_t(Yr.anchor,Wr)>0?(Ir=Yr.head,Wr=jn(gn.from(),Yr.anchor)):(Ir=Yr.anchor,Wr=wi(gn.to(),Yr.head));var _r=z.ranges.slice(0);_r[W]=Xl(e,new ar(Pt(x,Wr),Ir)),qr(x,Rn(e,_r,W),De)}}var Te=i.wrapper.getBoundingClientRect(),ke=0;function We(nt){var mt=++ke,Lt=Ur(e,nt,!0,r.unit=="rectangle");if(!Lt)return;if(_t(Lt,ue)!=0){e.curOp.focus=P(),we(Lt);var Ct=ma(i,x);(Lt.line>=Ct.to||Lt.line<Ct.from)&&setTimeout(Mr(e,function(){ke==mt&&We(nt)}),150)}else{var Kt=nt.clientY<Te.top?-20:nt.clientY>Te.bottom?20:0;Kt&&setTimeout(Mr(e,function(){if(ke!=mt)return;i.scroller.scrollTop+=Kt,We(nt)}),50)}}function $e(nt){e.state.selectingText=!1,ke=Infinity,nt&&($(nt),i.input.focus()),dt(i.wrapper.ownerDocument,"mousemove",rt),dt(i.wrapper.ownerDocument,"mouseup",ht),x.history.lastSelOrigin=null}var rt=Mr(e,function(nt){nt.buttons===0||!Le(nt)?$e(nt):We(nt)}),ht=Mr(e,$e);e.state.selectingText=ht,_e(i.wrapper.ownerDocument,"mousemove",rt),_e(i.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var n=t.anchor,r=t.head,i=bt(e.doc,n.line);if(_t(n,r)==0&&n.sticky==r.sticky)return t;var x=ft(i);if(!x)return t;var k=Je(x,n.ch,n.sticky),W=x[k];if(W.from!=n.ch&&W.to!=n.ch)return t;var z=k+(W.from==n.ch==(W.level!=1)?0:1);if(z==0||z==x.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Je(x,r.ch,r.sticky),ue=ae-k||(r.ch-n.ch)*(W.level==1?-1:1);ae==z-1||ae==z?V=ue<0:V=ue>0}var we=x[z+(V?-1:0)],Te=V==(we.level==1),ke=Te?we.from:we.to,We=Te?"after":"before";return n.ch==ke&&n.sticky==We?t:new ar(new He(n.line,ke,We),r)}function rl(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(we){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var k=e.display,W=k.lineDiv.getBoundingClientRect();if(x>W.bottom||!de(e,n))return re(t);x-=W.top-k.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var V=k.gutters.childNodes[z];if(V&&V.getBoundingClientRect().right>=i){var ae=wn(e.doc,x),ue=e.display.gutterSpecs[z];return Re(e,n,e,ae,ue.className,t),re(t)}}}function ds(e,t){return rl(e,t,"gutterClick",!0)}function nl(e,t){if(zn(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Nt(e)}var _a={toString:function(){return"CodeMirror.Init"}},al={},Bo={};function $l(e){var t=e.optionHandlers;function n(r,i,x,k){e.defaults[r]=i,x&&(t[r]=k?function(W,z,V){V!=_a&&x(W,z,V)}:x)}e.defineOption=n,e.Init=_a,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,yi(r)},!0),n("indentUnit",2,yi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){to(r),Nt(r),fr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],k=r.doc.first;r.doc.iter(function(z){for(var V=0;;){var ae=z.text.indexOf(i,V);if(ae==-1)break;V=ae+i.length,x.push(He(k,ae))}k++});for(var W=x.length-1;W>=0;W--)Oa(r.doc,i,x[W],He(x[W].line,x[W].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=_a&&r.refresh()}),n("specialCharPlaceholder",sr,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",!b),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){il(r),Gn(r)},!0),n("keyMap","default",function(r,i,x){var k=Uo(i),W=x!=_a&&Uo(x);W&&W.detach&&W.detach(r,k),k.attach&&k.attach(r,W||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=sn(i,r.options.lineNumbers),Gn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Zr(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return mi(r)},!0),n("scrollbarStyle","native",function(r){ya(r),mi(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=sn(r.options.gutters,i),Gn(r)},!0),n("firstLineNumber",1,Gn,!0),n("lineNumberFormatter",function(r){return r},Gn,!0),n("showCursorWhenSelecting",!1,dr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ri(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,dr,!0),n("singleCursorHeightPerLine",!0,dr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,to,!0),n("addModeClass",!1,to,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,to,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=_a;if(!t!=!r){var i=e.display.dragFunctions,x=t?_e:dt;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),Zi(e)),an(e),fr(e),Nt(e),setTimeout(function(){return mi(e)},100)}function Sr(e,t){var n=this;if(!(this instanceof Sr))return new Sr(e,t);this.options=t=t?N(t):{},N(al,t,!1);var r=t.value;typeof r=="string"?r=new mn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Sr.inputStyles[t.inputStyle](this),x=this.display=new ia(e,r,i,t);x.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ya(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 ne,keySeq:null,specialChars:null},t.autofocus&&!a&&x.input.focus(),U&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ll(),ii(this),this.curOp.forceUpdate=!0,gs(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ri(n)},20):Ri(this);for(var k in Bo)Bo.hasOwnProperty(k)&&Bo[k](this,t[k],_a);Br(this),t.finishInit&&t.finishInit(this);for(var W=0;W<cs.length;++W)cs[W](this);vi(this),R&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}Sr.defaults=al,Sr.optionHandlers=Bo;function Zl(e){var t=e.display;_e(t.scroller,"mousedown",Mr(e,el)),U&&I<11?_e(t.scroller,"dblclick",Mr(e,function(z){if(Ke(e,z))return;var V=Ur(e,z);if(!V||ds(e,z)||zn(e.display,z))return;$(z);var ae=e.findWordAt(V);Ro(e.doc,ae.anchor,ae.head)})):_e(t.scroller,"dblclick",function(z){return Ke(e,z)||$(z)}),_e(t.scroller,"contextmenu",function(z){return nl(e,z)}),_e(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||nl(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function x(z){if(z.touches.length!=1)return!1;var V=z.touches[0];return V.radiusX<=1&&V.radiusY<=1}function k(z,V){if(V.left==null)return!0;var ae=V.left-z.left,ue=V.top-z.top;return ae*ae+ue*ue>20*20}_e(t.scroller,"touchstart",function(z){if(!Ke(e,z)&&!x(z)&&!ds(e,z)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),_e(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),_e(t.scroller,"touchend",function(z){var V=t.activeTouch;if(V&&!zn(t,z)&&V.left!=null&&!V.moved&&new Date-V.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ue;!V.prev||k(V,V.prev)?ue=new ar(ae,ae):!V.prev.prev||k(V,V.prev.prev)?ue=e.findWordAt(ae):ue=new ar(He(ae.line,0),Pt(e.doc,He(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),$(z)}i()}),_e(t.scroller,"touchcancel",i),_e(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ii(e,t.scroller.scrollTop),_n(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),_e(t.scroller,"mousewheel",function(z){return qa(e,z)}),_e(t.scroller,"DOMMouseScroll",function(z){return qa(e,z)}),_e(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Ke(e,z)||le(z)},over:function(z){Ke(e,z)||(Al(e,z),le(z))},start:function(z){return Dl(e,z)},drop:Mr(e,Ol),leave:function(z){Ke(e,z)||Ws(e)}};var W=t.input.getField();_e(W,"keyup",function(z){return Zs.call(e,z)}),_e(W,"keydown",Mr(e,Js)),_e(W,"keypress",Mr(e,qs)),_e(W,"focus",function(z){return ri(e,z)}),_e(W,"blur",function(z){return Ri(e,z)})}var cs=[];Sr.defineInitHook=function(e){return cs.push(e)};function mo(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=Cn(e,t).state:n="prev");var k=e.options.tabSize,W=bt(i,t),z=Q(W.text,null,k);W.stateAfter&&(W.stateAfter=null);var V=W.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(W.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(x,W.text.slice(V.length),W.text),ae==Ie||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=Q(bt(i,t-1).text,null,k):ae=0:n=="add"?ae=z+e.options.indentUnit:n=="subtract"?ae=z-e.options.indentUnit:typeof n=="number"&&(ae=z+n),ae=Math.max(0,ae);var ue="",we=0;if(e.options.indentWithTabs)for(var Te=Math.floor(ae/k);Te;--Te)we+=k,ue+=" ";if(we<ae&&(ue+=fe(ae-we)),ue!=V)return Oa(i,ue,He(t,0),He(t,V.length),"+input"),W.stateAfter=null,!0;for(var ke=0;ke<i.sel.ranges.length;ke++){var We=i.sel.ranges[ke];if(We.head.line==t&&We.head.ch<V.length){var $e=He(t,V.length);is(i,ke,new ar($e,$e));break}}}var Yn=null;function jo(e){Yn=e}function fs(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var k=+new Date-200,W=i=="paste"||e.state.pasteIncoming>k,z=Rt(t),V=null;if(W&&r.ranges.length>1)if(Yn&&Yn.text.join(`
|
|
`)==t){if(r.ranges.length%Yn.text.length==0){V=[];for(var ae=0;ae<Yn.text.length;ae++)V.push(x.splitLines(Yn.text[ae]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=qe(z,function(rt){return[rt]}));for(var ue=e.curOp.updateInput,we=r.ranges.length-1;we>=0;we--){var Te=r.ranges[we],ke=Te.from(),We=Te.to();Te.empty()&&(n&&n>0?ke=He(ke.line,ke.ch-n):e.state.overwrite&&!W?We=He(We.line,Math.min(bt(x,We.line).text.length,We.ch+Pe(z).length)):W&&Yn&&Yn.lineWise&&Yn.text.join(`
|
|
`)==z.join(`
|
|
`)&&(ke=We=He(ke.line,0)));var $e={from:ke,to:We,text:V?V[we%V.length]:z,origin:i||(W?"paste":e.state.cutIncoming>k?"cut":"+input")};Ca(e.doc,$e),Ar(e,"inputRead",e,$e)}t&&!W&&sl(e,t),Pi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&on(t,function(){return fs(t,n,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var x=e.getModeAt(i.head),k=!1;if(x.electricChars){for(var W=0;W<x.electricChars.length;W++)if(t.indexOf(x.electricChars.charAt(W))>-1){k=mo(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(bt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(k=mo(e,i.head.line,"smart")));k&&Ar(e,"electricInput",e,i.head.line)}}function ll(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:He(i,0),head:He(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function ul(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var x=this.options,k=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&Mr(this,t[r])(this,i,k),Re(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Uo(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:Xr(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Ve(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(k){return k.priority}),this.state.modeGen++,fr(this)}),removeOverlay:Xr(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var k=i[x].modeSpec;if(k==r||typeof r=="string"&&k.name==r){i.splice(x,1),this.state.modeGen++,fr(this);return}}}),indentLine:Xr(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Bn(this.doc,r)&&mo(this,r,i,x)}),indentSelection:Xr(function(r){for(var i=this.doc.sel.ranges,x=-1,k=0;k<i.length;k++){var W=i[k];if(W.empty())W.head.line>x&&(mo(this,W.head.line,r,!0),x=W.head.line,k==this.doc.sel.primIndex&&Pi(this));else{var z=W.from(),V=W.to(),ae=Math.max(x,z.line);x=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ue=ae;ue<x;++ue)mo(this,ue,r);var we=this.doc.sel.ranges;z.ch==0&&i.length==we.length&&we[k].from().ch>0&&is(this.doc,k,new ar(z,we[k].to()),Ae)}}}),getTokenAt:function(r,i){return ua(this,r,i)},getLineTokens:function(r,i){return ua(this,He(r),i,!0)},getTokenTypeAt:function(r){r=Pt(this.doc,r);var i=di(this,bt(this.doc,r.line)),x=0,k=(i.length-1)/2,W=r.ch,z;if(W==0)z=i[2];else for(;;){var V=x+k>>1;if((V?i[V*2-1]:0)>=W)k=V;else if(i[V*2+1]<W)x=V+1;else{z=i[V*2+2];break}}var ae=z?z.indexOf("overlay "):-1;return ae<0?z:ae==0?null:z.slice(0,ae-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 x=[];if(!n.hasOwnProperty(i))return x;var k=n[i],W=this.getModeAt(r);if(typeof W[i]=="string")k[W[i]]&&x.push(k[W[i]]);else if(W[i])for(var z=0;z<W[i].length;z++){var V=k[W[i][z]];V&&x.push(V)}else W.helperType&&k[W.helperType]?x.push(k[W.helperType]):k[W.name]&&x.push(k[W.name]);for(var ae=0;ae<k._global.length;ae++){var ue=k._global[ae];ue.pred(W,this)&&pe(x,ue.val)==-1&&x.push(ue.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=Ci(x,r==null?x.first+x.size-1:r),Cn(this,r+1,i).state},cursorCoords:function(r,i){var x,k=this.doc.sel.primary();return r==null?x=k.head:typeof r=="object"?x=Pt(this.doc,r):x=r?k.from():k.to(),Gt(this,x,i||"page")},charCoords:function(r,i){return gr(this,Pt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=zt(this,r,i||"page"),Vt(this,r.left,r.top)},lineAtHeight:function(r,i){return r=zt(this,{top:r,left:0},i||"page").top,wn(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var k=!1,W;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,k=!0),W=bt(this.doc,r)}else W=r;return Qt(this,W,{top:0,left:0},i||"page",x||k).top+(k?this.doc.height-xn(W):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Nr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,k,W){var z=this.display;r=Gt(this,Pt(this.doc,r));var V=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),k=="over")V=r.top;else if(k=="above"||k=="near"){var ue=Math.max(z.wrapper.clientHeight,this.doc.height),we=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(k=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(V=r.bottom),ae+i.offsetWidth>we&&(ae=we-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",W=="right"?(ae=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(W=="left"?ae=0:W=="middle"&&(ae=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),x&&To(this,{left:ae,top:V,right:ae+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:Xr(Js),triggerOnKeyPress:Xr(qs),triggerOnKeyUp:Zs,triggerOnMouseDown:Xr(el),execCommand:function(r){if(co.hasOwnProperty(r))return co[r].call(null,this)},triggerElectric:Xr(function(r){sl(this,r)}),findPosH:function(r,i,x,k){var W=1;i<0&&(W=-1,i=-i);for(var z=Pt(this.doc,r),V=0;V<i&&!(z=hs(this.doc,z,W,x,k),z.hitSide);++V);return z},moveH:Xr(function(r,i){var x=this;this.extendSelectionsBy(function(k){return x.display.shift||x.doc.extend||k.empty()?hs(x.doc,k.head,r,i,x.options.rtlMoveVisually):r<0?k.from():k.to()},Ce)}),deleteH:Xr(function(r,i){var x=this.doc.sel,k=this.doc;x.somethingSelected()?k.replaceSelection("",null,"+delete"):La(this,function(W){var z=hs(k,W.head,r,i,!1);return r<0?{from:z,to:W.head}:{from:W.head,to:z}})}),findPosV:function(r,i,x,k){var W=1,z=k;i<0&&(W=-1,i=-i);for(var V=Pt(this.doc,r),ae=0;ae<i;++ae){var ue=Gt(this,V,"div");if(z==null?z=ue.left:ue.left=z,V=cl(this,ue,W,x),V.hitSide)break}return V},moveV:Xr(function(r,i){var x=this,k=this.doc,W=[],z=!this.display.shift&&!k.extend&&k.sel.somethingSelected();if(k.extendSelectionsBy(function(ae){if(z)return r<0?ae.from():ae.to();var ue=Gt(x,ae.head,"div");ae.goalColumn!=null&&(ue.left=ae.goalColumn),W.push(ue.left);var we=cl(x,ue,r,i);return i=="page"&&ae==k.sel.primary()&&Ya(x,gr(x,we,"div").top-ue.top),we},Ce),W.length)for(var V=0;V<k.sel.ranges.length;V++)k.sel.ranges[V].goalColumn=W[V]}),findWordAt:function(r){var i=this.doc,x=bt(i,r.line).text,k=r.ch,W=r.ch;if(x){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||W==x.length)&&k?--k:++W;for(var V=x.charAt(k),ae=Xe(V,z)?function(ue){return Xe(ue,z)}:/\s/.test(V)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Xe(ue)};k>0&&ae(x.charAt(k-1));)--k;for(;W<x.length&&ae(x.charAt(W));)++W}return new ar(He(r.line,k),He(r.line,W))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Xr(function(r,i){ki(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ye(this)-this.display.barHeight,width:r.scrollWidth-ye(this)-this.display.barWidth,clientHeight:G(this),clientWidth:ie(this)}},scrollIntoView:Xr(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:He(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?$o(this,r):ea(this,r.from,r.to,r.margin)}),setSize:Xr(function(r,i){var x=this,k=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=k(r)),i!=null&&(this.display.wrapper.style.height=k(i)),this.options.lineWrapping&&kt(this);var W=this.display.viewFrom;this.doc.iter(W,this.display.viewTo,function(z){if(z.widgets){for(var V=0;V<z.widgets.length;V++)if(z.widgets[V].noHScroll){Tr(x,W,"widget");break}}++W}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return on(this,r)},startOperation:function(){return ii(this)},endOperation:function(){return vi(this)},refresh:Xr(function(){var r=this.display.cachedTextHeight;fr(this),this.curOp.forceUpdate=!0,Nt(this),ki(this,this.doc.scrollLeft,this.doc.scrollTop),Ea(this.display),(r==null||Math.abs(r-Lr(this.display))>.5||this.options.lineWrapping)&&an(this),Re(this,"refresh",this)}),swapDoc:Xr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),gs(this,r),Nt(this),this.display.input.reset(),ki(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ar(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},he(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,k){e.registerHelper(r,i,k),n[r]._global.push({pred:x,val:k})}}function hs(e,t,n,r,i){var x=t,k=n,W=bt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function V(){var ht=t.line+z;return ht<e.first||ht>=e.first+e.size?!1:(t=new He(ht,t.ch,t.sticky),W=bt(e,ht))}function ae(ht){var nt;if(r=="codepoint"){var mt=W.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?nt=null:nt=new He(t.line,Math.max(0,Math.min(W.text.length,t.ch+n*(mt>=55296&&mt<56320?2:1))),-n)}else i?nt=kl(e.cm,W,t,n):nt=os(W,t,n);if(nt==null)if(!ht&&V())t=ss(i,e.cm,W,t.line,z);else return!1;else t=nt;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ue=null,we=r=="group",Te=e.cm&&e.cm.getHelper(t,"wordChars"),ke=!0;!(n<0&&!ae(!ke));ke=!1){var We=W.text.charAt(t.ch)||`
|
|
`,$e=Xe(We,Te)?"w":we&&We==`
|
|
`?"n":!we||/\s/.test(We)?null:"p";if(we&&!ke&&!$e&&($e="s"),ue&&ue!=$e){n<0&&(n=1,ae(),t.sticky="after");break}if($e&&(ue=$e),n>0&&!ae(!ke))break}var rt=ko(e,t,x,k,!0);return li(x,rt)&&(rt.hitSide=!0),rt}function cl(e,t,n,r){var i=e.doc,x=t.left,k;if(r=="page"){var W=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(W-.5*Lr(e.display),3);k=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(k=n>0?t.bottom+3:t.top-3);for(var V;!(V=Vt(e,x,k),!V.outside);){if(n<0?k<=0:k>=i.height){V.hitSide=!0;break}k+=n*5}return V}var hr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ne,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};hr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ul(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(W){for(var z=W.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}_e(i,"paste",function(W){if(!x(W)||Ke(r,W)||ol(W,r))return;I<=11&&setTimeout(Mr(r,function(){return t.updateFromDOM()}),20)}),_e(i,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),_e(i,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),_e(i,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),_e(i,"touchstart",function(){return n.forceCompositionEnd()}),_e(i,"input",function(){t.composing||t.readFromDOMSoon()});function k(W){if(!x(W)||Ke(r,W))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()}),W.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=ll(r);jo({lineWise:!0,text:z.text}),W.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,Ae),r.replaceSelection("",null,"cut")})}else return;if(W.clipboardData){W.clipboardData.clearData();var V=Yn.text.join(`
|
|
`);if(W.clipboardData.setData("Text",V),W.clipboardData.getData("Text")==V){W.preventDefault();return}}var ae=dl(),ue=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ue.value=Yn.text.join(`
|
|
`);var we=document.activeElement;Y(ue),setTimeout(function(){r.display.lineSpace.removeChild(ae),we.focus(),we==i&&n.showPrimarySelection()},50)}_e(i,"copy",k),_e(i,"cut",k)},hr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},hr.prototype.prepareSelection=function(){var e=Un(this.cm,!1);return e.focus=document.activeElement==this.div,e},hr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},hr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},hr.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 x=Wo(t,e.anchorNode,e.anchorOffset),k=Wo(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&k&&!k.bad&&_t(jn(x,k),r)==0&&_t(wi(x,k),i)==0)return;var W=t.display.view,z=r.line>=t.display.viewFrom&&fl(t,r)||{node:W[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&fl(t,i);if(!V){var ae=W[W.length-1].measure,ue=ae.maps?ae.maps[ae.maps.length-1]:ae.map;V={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!z||!V){e.removeAllRanges();return}var we=e.rangeCount&&e.getRangeAt(0),Te;try{Te=g(z.node,z.offset,V.offset,V.node)}catch(ke){}Te&&(!A&&t.state.focused?(e.collapse(z.node,z.offset),Te.collapsed||(e.removeAllRanges(),e.addRange(Te))):(e.removeAllRanges(),e.addRange(Te)),we&&e.anchorNode==null?e.addRange(we):A&&this.startGracePeriod()),this.rememberSelection()},hr.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)},hr.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},hr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},hr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},hr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},hr.prototype.blur=function(){this.div.blur()},hr.prototype.getField=function(){return this.div},hr.prototype.supportsTouch=function(){return!0},hr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():on(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)},hr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},hr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=Wo(t,e.anchorNode,e.anchorOffset),r=Wo(t,e.focusNode,e.focusOffset);n&&r&&on(t,function(){qr(t.doc,Vn(n,r),Ae),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},hr.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=He(r.line-1,bt(e.doc,r.line-1).length)),i.ch==bt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=He(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,k,W;r.line==t.viewFrom||(x=mr(e,r.line))==0?(k=tr(t.view[0].line),W=t.view[0].node):(k=tr(t.view[x].line),W=t.view[x-1].node.nextSibling);var z=mr(e,i.line),V,ae;if(z==t.view.length-1?(V=t.viewTo-1,ae=t.lineDiv.lastChild):(V=tr(t.view[z+1].line)-1,ae=t.view[z+1].node.previousSibling),!W)return!1;for(var ue=e.doc.splitLines(tu(e,W,ae,k,V)),we=Fn(e.doc,He(k,0),He(V,bt(e.doc,V).text.length));ue.length>1&&we.length>1;)if(Pe(ue)==Pe(we))ue.pop(),we.pop(),V--;else if(ue[0]==we[0])ue.shift(),we.shift(),k++;else break;for(var Te=0,ke=0,We=ue[0],$e=we[0],rt=Math.min(We.length,$e.length);Te<rt&&We.charCodeAt(Te)==$e.charCodeAt(Te);)++Te;for(var ht=Pe(ue),nt=Pe(we),mt=Math.min(ht.length-(ue.length==1?Te:0),nt.length-(we.length==1?Te:0));ke<mt&&ht.charCodeAt(ht.length-ke-1)==nt.charCodeAt(nt.length-ke-1);)++ke;if(ue.length==1&&we.length==1&&k==r.line)for(;Te&&Te>r.ch&&ht.charCodeAt(ht.length-ke-1)==nt.charCodeAt(nt.length-ke-1);)Te--,ke++;ue[ue.length-1]=ht.slice(0,ht.length-ke).replace(/^\u200b+/,""),ue[0]=ue[0].slice(Te).replace(/\u200b+$/,"");var Lt=He(k,Te),Ct=He(V,we.length?Pe(we).length-ke:0);if(ue.length>1||ue[0]||_t(Lt,Ct))return Oa(e.doc,ue,Lt,Ct,"+input"),!0},hr.prototype.ensurePolled=function(){this.forceCompositionEnd()},hr.prototype.reset=function(){this.forceCompositionEnd()},hr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},hr.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)},hr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&on(this.cm,function(){return fr(e.cm)})},hr.prototype.setUneditable=function(e){e.contentEditable="false"},hr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Mr(this.cm,fs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},hr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},hr.prototype.onContextMenu=function(){},hr.prototype.resetPosition=function(){},hr.prototype.needsContentAttribute=!0;function fl(e,t){var n=Ee(e,t.line);if(!n||n.hidden)return null;var r=bt(e.doc,t.line),i=X(n,r,t.line),x=ft(r,e.doc.direction),k="left";if(x){var W=Je(x,t.ch);k=W%2?"right":"left"}var z=Ge(i.map,t.ch,k);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ma(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",k=!1,W=e.doc.lineSeparator(),z=!1;function V(Te){return function(ke){return ke.id==Te}}function ae(){k&&(x+=W,z&&(x+=W),k=z=!1)}function ue(Te){Te&&(ae(),x+=Te)}function we(Te){if(Te.nodeType==1){var ke=Te.getAttribute("cm-text");if(ke){ue(ke);return}var We=Te.getAttribute("cm-marker"),$e;if(We){var rt=e.findMarks(He(r,0),He(i+1,0),V(+We));rt.length&&($e=rt[0].find(0))&&ue(Fn(e.doc,$e.from,$e.to).join(W));return}if(Te.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(Te.nodeName);if(!/^br$/i.test(Te.nodeName)&&Te.textContent.length==0)return;ht&&ae();for(var nt=0;nt<Te.childNodes.length;nt++)we(Te.childNodes[nt]);/^(pre|p)$/i.test(Te.nodeName)&&(z=!0),ht&&(k=!0)}else Te.nodeType==3&&ue(Te.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(we(t),t==n);)t=t.nextSibling,z=!1;return x}function Wo(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Ma(e.clipPos(He(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 x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!S(r,t))return Ma(He(tr(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?Pe(e.rest):e.line;return Ma(He(tr(x),x.text.length),i)}var k=t.nodeType==3?t:null,W=t;for(!k&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(k=t.firstChild,n&&(n=k.nodeValue.length));W.parentNode!=r;)W=W.parentNode;var z=e.measure,V=z.maps;function ae($e,rt,ht){for(var nt=-1;nt<(V?V.length:0);nt++)for(var mt=nt<0?z.map:V[nt],Lt=0;Lt<mt.length;Lt+=3){var Ct=mt[Lt+2];if(Ct==$e||Ct==rt){var Kt=tr(nt<0?e.line:e.rest[nt]),vr=mt[Lt]+ht;return(ht<0||Ct!=$e)&&(vr=mt[Lt+(ht?1:0)]),He(Kt,vr)}}}var ue=ae(k,W,n);if(ue)return Ma(ue,i);for(var we=W.nextSibling,Te=k?k.nodeValue.length-n:0;we;we=we.nextSibling){if(ue=ae(we,we.firstChild,0),ue)return Ma(He(ue.line,ue.ch-Te),i);Te+=we.textContent.length}for(var ke=W.previousSibling,We=n;ke;ke=ke.previousSibling){if(ue=ae(ke,ke.firstChild,-1),ue)return Ma(He(ue.line,ue.ch+We),i);We+=ke.textContent.length}}var Pr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ne,this.hasSelection=!1,this.composing=null};Pr.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),p&&(i.style.width="0px"),_e(i,"input",function(){U&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),_e(i,"paste",function(k){if(Ke(r,k)||ol(k,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(k){if(Ke(r,k))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var W=ll(r);jo({lineWise:!0,text:W.text}),k.type=="cut"?r.setSelections(W.ranges,null,Ae):(n.prevInput="",i.value=W.text.join(`
|
|
`),Y(i))}else return;k.type=="cut"&&(r.state.cutIncoming=+new Date)}_e(i,"cut",x),_e(i,"copy",x),_e(e.scroller,"paste",function(k){if(zn(e,k)||Ke(r,k))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var W=new Event("paste");W.clipboardData=k.clipboardData,i.dispatchEvent(W)}),_e(e.lineSpace,"selectstart",function(k){zn(e,k)||$(k)}),_e(i,"compositionstart",function(){var k=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:k,range:r.markText(k,r.getCursor("to"),{className:"CodeMirror-composing"})}}),_e(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Pr.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},Pr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Un(e);if(e.options.moveInputWithCursor){var i=Gt(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),k=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+k.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+k.left-x.left))}return r},Pr.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")},Pr.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&&Y(this.textarea),U&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",U&&I>=9&&(this.hasSelection=null))},Pr.prototype.getField=function(){return this.textarea},Pr.prototype.supportsTouch=function(){return!1},Pr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pr.prototype.blur=function(){this.textarea.blur()},Pr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pr.prototype.receivedFocus=function(){this.slowPoll()},Pr.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()})},Pr.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)},Pr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Tt(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(U&&I>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var k=0,W=Math.min(r.length,i.length);k<W&&r.charCodeAt(k)==i.charCodeAt(k);)++k;return on(t,function(){fs(t,i.slice(k),r.length-k,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},Pr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pr.prototype.onKeyPress=function(){U&&I>=9&&(this.hasSelection=null),this.fastPoll()},Pr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=Ur(n,e),k=r.scroller.scrollTop;if(!x||w)return;var W=n.options.resetSelectionOnContextMenu;W&&n.doc.sel.contains(x)==-1&&Mr(n,qr)(n.doc,Vn(x),Ae);var z=i.style.cssText,V=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.left-5)+`px;
|
|
z-index: 1000; background: `+(U?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;R&&(ue=window.scrollY),r.input.focus(),R&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Te,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function we(){if(i.selectionStart!=null){var We=n.somethingSelected(),$e="\u200B"+(We?i.value:"");i.value="\u21DA",i.value=$e,t.prevInput=We?"":"\u200B",i.selectionStart=1,i.selectionEnd=$e.length,r.selForContextMenu=n.doc.sel}}function Te(){if(t.contextMenuPending!=Te)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=z,U&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=k),i.selectionStart!=null){(!U||U&&I<9)&&we();var We=0,$e=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Mr(n,_s)(n):We++<10?r.detectingSelectAll=setTimeout($e,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout($e,200)}}if(U&&I>=9&&we(),D){le(e);var ke=function(){dt(window,"mouseup",ke),setTimeout(Te,20)};_e(window,"mouseup",ke)}else setTimeout(Te,50)},Pr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pr.prototype.setUneditable=function(){},Pr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=W.getValue()}var i;if(e.form&&(_e(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var k=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=k}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(dt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var W=Sr(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return W}function iu(e){e.off=dt,e.on=_e,e.wheelEventPixels=Za,e.Doc=mn,e.splitLines=Rt,e.countColumn=Q,e.findColumn=Oe,e.isWordChar=Be,e.Pass=Ie,e.signal=Re,e.Line=hi,e.changeEnd=Xn,e.scrollbarModel=$a,e.Pos=He,e.cmpPos=_t,e.modes=Or,e.mimeModes=It,e.resolveMode=Qr,e.getMode=dn,e.modeExtensions=bn,e.extendMode=sa,e.copyState=Pn,e.startState=Ti,e.innerMode=xi,e.commands=co,e.keyMap=bi,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=Aa,e.normalizeKeyMap=Pl,e.StringStream=Er,e.SharedTextMarker=so,e.TextMarker=Bi,e.LineWidget=oo,e.e_preventDefault=$,e.e_stopPropagation=J,e.e_stop=le,e.addClass=B,e.contains=S,e.rmClass=c,e.keyNames=ji}$l(Sr),ql(Sr);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ko in mn.prototype)mn.prototype.hasOwnProperty(Ko)&&pe(au,Ko)<0&&(Sr.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(mn.prototype[Ko]));return he(mn),Sr.inputStyles={textarea:Pr,contenteditable:hr},Sr.defineMode=function(e){!Sr.defaults.mode&&e!="null"&&(Sr.defaults.mode=e),$r.apply(this,arguments)},Sr.defineMIME=tn,Sr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Sr.defineMIME("text/plain","null"),Sr.defineExtension=function(e,t){Sr.prototype[e]=t},Sr.defineDocExtension=function(e,t){mn.prototype[e]=t},Sr.fromTextArea=nu,iu(Sr),Sr.version="5.58.2",Sr})},Y1PL:function(Dt,at,Z){"use strict";Z.r(at),Z.d(at,"ResizableTextArea",function(){return pe});var q=Z("wx14"),K=Z("1OyB"),A=Z("vuIU"),F=Z("Ji7U"),T=Z("LK+K"),M=Z("cDcd"),U=Z("VTBJ"),I=Z("rePB"),R=Z("Zm9Q"),_=Z("Kwbf"),y=Z("c+Xe"),w=Z("m+aA"),L=Z("bdgK"),O=new Map;function C(Ae){Ae.forEach(function(De){var Ce,Oe=De.target;(Ce=O.get(Oe))===null||Ce===void 0||Ce.forEach(function(ce){return ce(Oe)})})}var p=new L.default(C),l=null,a=null;function s(Ae,De){O.has(Ae)||(O.set(Ae,new Set),p.observe(Ae)),O.get(Ae).add(De)}function u(Ae,De){O.has(Ae)&&(O.get(Ae).delete(De),O.get(Ae).size||(p.unobserve(Ae),O.delete(Ae)))}var b=function(Ae){Object(F.a)(Ce,Ae);var De=Object(T.a)(Ce);function Ce(){return Object(K.a)(this,Ce),De.apply(this,arguments)}return Object(A.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(M.Component),m=M.createContext(null);function h(Ae){var De=Ae.children,Ce=Ae.onBatchResize,Oe=M.useRef(0),ce=M.useRef([]),fe=M.useContext(m),Pe=M.useCallback(function(qe,Ve,Ze){Oe.current+=1;var ct=Oe.current;ce.current.push({size:qe,element:Ve,data:Ze}),Promise.resolve().then(function(){ct===Oe.current&&(Ce==null||Ce(ce.current),ce.current=[])}),fe==null||fe(qe,Ve,Ze)},[Ce,fe]);return M.createElement(m.Provider,{value:Pe},De)}function D(Ae){var De=Ae.children,Ce=Ae.disabled,Oe=M.useRef(null),ce=M.useRef(null),fe=M.useContext(m),Pe=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),qe=M.isValidElement(De)&&Object(y.c)(De),Ve=qe?De.ref:null,Ze=M.useMemo(function(){return Object(y.a)(Ve,Oe)},[Ve,Oe]),ct=M.useRef(Ae);ct.current=Ae;var je=M.useCallback(function(Be){var Xe=ct.current,et=Xe.onResize,Qe=Xe.data,Ne=Be.getBoundingClientRect(),Ue=Ne.width,lt=Ne.height,ut=Be.offsetWidth,ot=Be.offsetHeight,Je=Math.floor(Ue),vt=Math.floor(lt);if(Pe.current.width!==Je||Pe.current.height!==vt||Pe.current.offsetWidth!==ut||Pe.current.offsetHeight!==ot){var ft={width:Je,height:vt,offsetWidth:ut,offsetHeight:ot};Pe.current=ft;var st=ut===Math.round(Ue)?Ue:ut,_e=ot===Math.round(lt)?lt:ot,pt=Object(U.a)(Object(U.a)({},ft),{},{offsetWidth:st,offsetHeight:_e});fe==null||fe(pt,Be,Qe),et&&Promise.resolve().then(function(){et(pt,Be)})}},[]);return M.useEffect(function(){var Be=Object(w.a)(Oe.current)||Object(w.a)(ce.current);return Be&&!Ce&&s(Be,je),function(){return u(Be,je)}},[Oe.current,Ce]),M.createElement(b,{ref:ce},qe?M.cloneElement(De,{ref:Ze}):De)}var v="rc-observer-key";function c(Ae){var De=Ae.children,Ce=Object(R.a)(De);return Ce.map(function(Oe,ce){var fe=(Oe==null?void 0:Oe.key)||"".concat(v,"-").concat(ce);return M.createElement(D,Object(q.a)({},Ae,{key:fe}),Oe)})}c.Collection=h;var f=c,d=Z("bT9E"),o=Z("TSYQ"),E=Z.n(o),g=`
|
|
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
|
|
`,S=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},B;function H(Ae){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=Ae.getAttribute("id")||Ae.getAttribute("data-reactid")||Ae.getAttribute("name");if(De&&P[Ce])return P[Ce];var Oe=window.getComputedStyle(Ae),ce=Oe.getPropertyValue("box-sizing")||Oe.getPropertyValue("-moz-box-sizing")||Oe.getPropertyValue("-webkit-box-sizing"),fe=parseFloat(Oe.getPropertyValue("padding-bottom"))+parseFloat(Oe.getPropertyValue("padding-top")),Pe=parseFloat(Oe.getPropertyValue("border-bottom-width"))+parseFloat(Oe.getPropertyValue("border-top-width")),qe=S.map(function(Ze){return"".concat(Ze,":").concat(Oe.getPropertyValue(Ze))}).join(";"),Ve={sizingStyle:qe,paddingSize:fe,borderSize:Pe,boxSizing:ce};return De&&Ce&&(P[Ce]=Ve),Ve}function Y(Ae){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),Ae.getAttribute("wrap")?B.setAttribute("wrap",Ae.getAttribute("wrap")):B.removeAttribute("wrap");var ce=H(Ae,De),fe=ce.paddingSize,Pe=ce.borderSize,qe=ce.boxSizing,Ve=ce.sizingStyle;B.setAttribute("style","".concat(Ve,";").concat(g)),B.value=Ae.value||Ae.placeholder||"";var Ze=Number.MIN_SAFE_INTEGER,ct=Number.MAX_SAFE_INTEGER,je=B.scrollHeight,Be;if(qe==="border-box"?je+=Pe:qe==="content-box"&&(je-=fe),Ce!==null||Oe!==null){B.value=" ";var Xe=B.scrollHeight-fe;Ce!==null&&(Ze=Xe*Ce,qe==="border-box"&&(Ze=Ze+fe+Pe),je=Math.max(Ze,je)),Oe!==null&&(ct=Xe*Oe,qe==="border-box"&&(ct=ct+fe+Pe),Be=je>ct?"":"hidden",je=Math.min(ct,je))}return{height:je,minHeight:Ze,maxHeight:ct,overflowY:Be,resize:"none"}}var j=Z("Gytx"),N=Z.n(j),Q;(function(Ae){Ae[Ae.NONE=0]="NONE",Ae[Ae.RESIZING=1]="RESIZING",Ae[Ae.RESIZED=2]="RESIZED"})(Q||(Q={}));var ne=function(Ae){Object(F.a)(Ce,Ae);var De=Object(T.a)(Ce);function Ce(Oe){var ce;return Object(K.a)(this,Ce),ce=De.call(this,Oe),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(fe){ce.textArea=fe},ce.handleResize=function(fe){var Pe=ce.state.resizeStatus,qe=ce.props,Ve=qe.autoSize,Ze=qe.onResize;if(Pe!==Q.NONE)return;typeof Ze=="function"&&Ze(fe),Ve&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var fe=ce.props.autoSize;if(!fe||!ce.textArea)return;var Pe=fe.minRows,qe=fe.maxRows,Ve=Y(ce.textArea,!1,Pe,qe);ce.setState({textareaStyles:Ve,resizeStatus:Q.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:Q.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:Q.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var fe=ce.props,Pe=fe.prefixCls,qe=Pe===void 0?"rc-textarea":Pe,Ve=fe.autoSize,Ze=fe.onResize,ct=fe.className,je=fe.disabled,Be=ce.state,Xe=Be.textareaStyles,et=Be.resizeStatus,Qe=Object(d.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=E()(qe,ct,Object(I.a)({},"".concat(qe,"-disabled"),je));"value"in Qe&&(Qe.value=Qe.value||"");var Ue=Object(U.a)(Object(U.a)(Object(U.a)({},ce.props.style),Xe),et===Q.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(f,{onResize:ce.handleResize,disabled:!(Ve||Ze)},M.createElement("textarea",Object(q.a)({},Qe,{className:Ne,style:Ue,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:Q.NONE},ce}return Object(A.a)(Ce,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!N()(ce.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 ce=this.textArea.selectionStart,fe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,fe)}}catch(Pe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(M.Component),pe=ne,xe=function(Ae){Object(F.a)(Ce,Ae);var De=Object(T.a)(Ce);function Ce(Oe){var ce;Object(K.a)(this,Ce),ce=De.call(this,Oe),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(Pe){ce.resizableTextArea=Pe},ce.handleChange=function(Pe){var qe=ce.props.onChange;ce.setValue(Pe.target.value,function(){ce.resizableTextArea.resizeTextarea()}),qe&&qe(Pe)},ce.handleKeyDown=function(Pe){var qe=ce.props,Ve=qe.onPressEnter,Ze=qe.onKeyDown;Pe.keyCode===13&&Ve&&Ve(Pe),Ze&&Ze(Pe)};var fe=typeof Oe.value=="undefined"||Oe.value===null?Oe.defaultValue:Oe.value;return ce.state={value:fe},ce}return Object(A.a)(Ce,[{key:"setValue",value:function(ce,fe){"value"in this.props||this.setState({value:ce},fe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(pe,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),Ce}(M.Component),Ie=at.default=xe},ZpRC:function(Dt,at,Z){"use strict";function q(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function K(y,w){return(!w||y!=="hidden")&&y!=="visible"&&y!=="clip"}function A(y,w){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var L=getComputedStyle(y,null);return K(L.overflowY,w)||K(L.overflowX,w)||function(O){var C=function(p){if(!p.ownerDocument||!p.ownerDocument.defaultView)return null;try{return p.ownerDocument.defaultView.frameElement}catch(l){return null}}(O);return!!C&&(C.clientHeight<O.scrollHeight||C.clientWidth<O.scrollWidth)}(y)}return!1}function F(y,w,L,O,C,p,l,a){return p<y&&l>w||p>y&&l<w?0:p<=y&&a<=L||l>=w&&a>=L?p-y-O:l>w&&a<L||p<y&&a>L?l-w+C:0}var T=function(y,w){var L=window,O=w.scrollMode,C=w.block,p=w.inline,l=w.boundary,a=w.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Xe){return Xe!==l};if(!q(y))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,b=[],m=y;q(m)&&s(m);){if((m=m.parentElement)===u){b.push(m);break}m!=null&&m===document.body&&A(m)&&!A(document.documentElement)||m!=null&&A(m,a)&&b.push(m)}for(var h=L.visualViewport?L.visualViewport.width:innerWidth,D=L.visualViewport?L.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=y.getBoundingClientRect(),d=f.height,o=f.width,E=f.top,g=f.right,S=f.bottom,P=f.left,B=C==="start"||C==="nearest"?E:C==="end"?S:E+d/2,H=p==="center"?P+o/2:p==="end"?g:P,Y=[],j=0;j<b.length;j++){var N=b[j],Q=N.getBoundingClientRect(),ne=Q.height,pe=Q.width,xe=Q.top,Ie=Q.right,Ae=Q.bottom,De=Q.left;if(O==="if-needed"&&E>=0&&P>=0&&S<=D&&g<=h&&E>=xe&&S<=Ae&&P>=De&&g<=Ie)return Y;var Ce=getComputedStyle(N),Oe=parseInt(Ce.borderLeftWidth,10),ce=parseInt(Ce.borderTopWidth,10),fe=parseInt(Ce.borderRightWidth,10),Pe=parseInt(Ce.borderBottomWidth,10),qe=0,Ve=0,Ze="offsetWidth"in N?N.offsetWidth-N.clientWidth-Oe-fe:0,ct="offsetHeight"in N?N.offsetHeight-N.clientHeight-ce-Pe:0;if(u===N)qe=C==="start"?B:C==="end"?B-D:C==="nearest"?F(c,c+D,D,ce,Pe,c+B,c+B+d,d):B-D/2,Ve=p==="start"?H:p==="center"?H-h/2:p==="end"?H-h:F(v,v+h,h,Oe,fe,v+H,v+H+o,o),qe=Math.max(0,qe+c),Ve=Math.max(0,Ve+v);else{qe=C==="start"?B-xe-ce:C==="end"?B-Ae+Pe+ct:C==="nearest"?F(xe,Ae,ne,ce,Pe+ct,B,B+d,d):B-(xe+ne/2)+ct/2,Ve=p==="start"?H-De-Oe:p==="center"?H-(De+pe/2)+Ze/2:p==="end"?H-Ie+fe+Ze:F(De,Ie,pe,Oe,fe+Ze,H,H+o,o);var je=N.scrollLeft,Be=N.scrollTop;B+=Be-(qe=Math.max(0,Math.min(Be+qe,N.scrollHeight-ne+ct))),H+=je-(Ve=Math.max(0,Math.min(je+Ve,N.scrollWidth-pe+Ze)))}Y.push({el:N,top:qe,left:Ve})}return Y};function M(y){return y===Object(y)&&Object.keys(y).length!==0}function U(y,w){w===void 0&&(w="auto");var L="scrollBehavior"in document.body.style;y.forEach(function(O){var C=O.el,p=O.top,l=O.left;C.scroll&&L?C.scroll({top:p,left:l,behavior:w}):(C.scrollTop=p,C.scrollLeft=l)})}function I(y){return y===!1?{block:"end",inline:"nearest"}:M(y)?y:{block:"start",inline:"nearest"}}function R(y,w){var L=!y.ownerDocument.documentElement.contains(y);if(M(w)&&typeof w.behavior=="function")return w.behavior(L?[]:T(y,w));if(L)return;var O=I(w);return U(T(y,O),O.behavior)}var _=at.a=R},bT9E:function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return K});var q=Z("VTBJ");function K(A,F){var T=Object(q.a)({},A);return Array.isArray(F)&&F.forEach(function(M){delete T[M]}),T}},c5Ni:function(Dt,at,Z){},dejd:function(Dt,at,Z){},dmUQ:function(Dt,at,Z){"use strict";var q=Z("Ff2n"),K=Z("rePB"),A=Z("1OyB"),F=Z("vuIU"),T=Z("Ji7U"),M=Z("md7G"),U=Z("foSv"),I=Z("cDcd"),R=Z.n(I),_=Z("TSYQ"),y=Z.n(_),w=Z("4IlW");function L(d,o){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);o&&(g=g.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),E.push.apply(E,g)}return E}function O(d){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?L(Object(E),!0).forEach(function(g){Object(K.a)(d,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):L(Object(E)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(E,g))})}return d}function C(d){var o=p();return function(){var g=Object(U.a)(d),S;if(o){var P=Object(U.a)(this).constructor;S=Reflect.construct(g,arguments,P)}else S=g.apply(this,arguments);return Object(M.a)(this,S)}}function p(){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,b=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(o){return o!=null},D=function(o,E){return E===o||typeof E=="number"&&typeof o=="number"&&isNaN(E)&&isNaN(o)},v=function(d){Object(T.a)(E,d);var o=C(E);function E(g){var S;Object(A.a)(this,E),S=o.call(this,g),S.onKeyDown=function(H){var Y=S.props,j=Y.onKeyDown,N=Y.onPressEnter;if(H.keyCode===w.a.UP){var Q=S.getRatio(H);S.up(H,Q,null),S.stop()}else if(H.keyCode===w.a.DOWN){var ne=S.getRatio(H);S.down(H,ne,null),S.stop()}else H.keyCode===w.a.ENTER&&N&&N(H);if(S.recordCursorPosition(),S.lastKeyCode=H.keyCode,j){for(var pe=arguments.length,xe=new Array(pe>1?pe-1:0),Ie=1;Ie<pe;Ie++)xe[Ie-1]=arguments[Ie];j.apply(void 0,[H].concat(xe))}},S.onKeyUp=function(H){var Y=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),Y){for(var j=arguments.length,N=new Array(j>1?j-1:0),Q=1;Q<j;Q++)N[Q-1]=arguments[Q];Y.apply(void 0,[H].concat(N))}},S.onChange=function(H){var Y=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(H)),S.setState({inputValue:S.rawInput}),Y(S.toNumber(S.rawInput))},S.onMouseUp=function(){var H=S.props.onMouseUp;S.recordCursorPosition(),H&&H.apply(void 0,arguments)},S.onFocus=function(){var H;S.setState({focused:!0}),(H=S.props).onFocus.apply(H,arguments)},S.onBlur=function(){var H=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var Y=S.getCurrentValidValue(S.state.inputValue),j=S.setValue(Y,l);if(H){var N=S.input.value,Q=S.getInputDisplayValue({focus:!1,value:j});S.input.value=Q&&Number(Q),H.apply(void 0,arguments),S.input.value=N}},S.getRatio=function(H){var Y=1;return H.metaKey||H.ctrlKey?Y=.1:H.shiftKey&&(Y=10),Y},S.getFullNum=function(H){return isNaN(H)?H:/e/i.test(String(H))?Number(H).toFixed(18).replace(/\.?0+$/,""):H},S.getPrecision=function(H){if(h(S.props.precision))return S.props.precision;var Y=String(H);if(Y.indexOf("e-")>=0)return parseInt(Y.slice(Y.indexOf("e-")+2),10);var j=0;return Y.indexOf(".")>=0&&(j=Y.length-Y.indexOf(".")-1),j},S.getInputDisplayValue=function(H){var Y=H||S.state,j=Y.focused,N=Y.inputValue,Q=Y.value,ne;j?ne=N:ne=S.toPrecisionAsStep(Q),ne==null&&(ne="");var pe=S.formatWrapper(ne);return h(S.props.decimalSeparator)&&(pe=pe.toString().replace(".",S.props.decimalSeparator)),pe},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(H){}},S.restoreByAfter=function(H){if(H===void 0)return!1;var Y=S.input.value,j=Y.lastIndexOf(H);if(j===-1)return!1;var N=S.cursorBefore.length;return S.lastKeyCode===w.a.DELETE&&S.cursorBefore.charAt(N-1)===H[0]?(S.fixCaret(N,N),!0):j+H.length===Y.length?(S.fixCaret(j,j),!0):!1},S.partRestoreByAfter=function(H){return H===void 0?!1:Array.prototype.some.call(H,function(Y,j){var N=H.substring(j);return S.restoreByAfter(N)})},S.isNotCompleteNumber=function(H){return isNaN(H)||H===""||H===null||H&&H.toString().indexOf(".")===H.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(H,Y,j){S.pressingUpOrDown=!0,S.step("down",H,Y,j)},S.up=function(H,Y,j){S.pressingUpOrDown=!0,S.step("up",H,Y,j)},S.saveInput=function(H){S.input=H};var P=g.value;P===void 0&&(P=g.defaultValue),S.state={focused:g.autoFocus};var B=S.getValidValue(S.toNumber(P));return S.state=O(O({},S.state),{},{inputValue:S.toPrecisionAsStep(B),value:B}),S}return Object(F.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var P=this.props,B=P.value,H=P.onChange,Y=P.max,j=P.min,N=this.state.focused;if(S){if(!D(S.value,B)||!D(S.max,Y)||!D(S.min,j)){var Q=N?B:this.getValidValue(B),ne;this.pressingUpOrDown?ne=Q:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep(Q),this.setState({value:Q,inputValue:ne})}var pe="value"in this.props?B:this.state.value;"max"in this.props&&S.max!==Y&&typeof pe=="number"&&pe>Y&&H&&H(Y),"min"in this.props&&S.min!==j&&typeof pe=="number"&&pe<j&&H&&H(j)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var xe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?xe=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(xe=this.cursorStart):xe=this.input.value.length,this.fixCaret(xe,xe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ie){}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(S){var P=S;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(S){var P=S.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(S){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,H=parseFloat(S);return isNaN(H)?S:(H<P&&(H=P),H>B&&(H=B),H)}},{key:"setValue",value:function(S,P){var B=this.props.precision,H=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),Y=this.state.value,j=Y===void 0?null:Y,N=this.state.inputValue,Q=N===void 0?null:N,ne=typeof H=="number"?H.toFixed(B):"".concat(H),pe=H!==j||ne!=="".concat(Q);return"value"in this.props?(Q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Q},P)):this.setState({value:H,inputValue:this.toPrecisionAsStep(S)},P),pe&&this.props.onChange(H),H}},{key:"getMaxPrecision",value:function(S){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,H=B.precision,Y=B.step;if(h(H))return H;var j=this.getPrecision(P),N=this.getPrecision(Y),Q=this.getPrecision(S);return S?Math.max(Q,j+N):j+N}},{key:"getPrecisionFactor",value:function(S){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(S,P);return Math.pow(10,B)}},{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(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var P=Math.abs(this.getMaxPrecision(S));return isNaN(P)?S.toString():Number(S).toFixed(P)}},{key:"toNumber",value:function(S){var P=this.props.precision,B=this.state.focused,H=S&&S.length>16&&B;return this.isNotCompleteNumber(S)||H?S:h(P)?Math.round(S*Math.pow(10,P))/Math.pow(10,P):Number(S)}},{key:"upStep",value:function(S,P){var B=this.props.step,H=this.getPrecisionFactor(S,P),Y=Math.abs(this.getMaxPrecision(S,P)),j=((H*S+H*B*P)/H).toFixed(Y);return this.toNumber(j)}},{key:"downStep",value:function(S,P){var B=this.props.step,H=this.getPrecisionFactor(S,P),Y=Math.abs(this.getMaxPrecision(S,P)),j=((H*S-H*B*P)/H).toFixed(Y);return this.toNumber(j)}},{key:"step",value:function(S,P){var B=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Y=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var j=this.props;if(j.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Q=this["".concat(S,"Step")](N,H),ne=Q>j.max||Q<j.min;if(Q>j.max?Q=j.max:Q<j.min&&(Q=j.min),this.setValue(Q,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),ne)return;this.autoStepTimer=setTimeout(function(){B[S](P,H,!0)},Y?u:b)}},{key:"fixCaret",value:function(S,P){if(S===void 0||P===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,H=this.input.selectionEnd;(S!==B||P!==H)&&this.input.setSelectionRange(S,P)}catch(Y){}}},{key:"render",value:function(){var S,P=this.props,B=P.prefixCls,H=P.disabled,Y=P.readOnly,j=P.useTouch,N=P.autoComplete,Q=P.upHandler,ne=P.downHandler,pe=P.className,xe=P.max,Ie=P.min,Ae=P.style,De=P.title,Ce=P.onMouseEnter,Oe=P.onMouseLeave,ce=P.onMouseOver,fe=P.onMouseOut,Pe=P.required,qe=P.onClick,Ve=P.tabIndex,Ze=P.type,ct=P.placeholder,je=P.id,Be=P.inputMode,Xe=P.pattern,et=P.step,Qe=P.maxLength,Ne=P.autoFocus,Ue=P.name,lt=P.onPaste,ut=P.onInput,ot=Object(q.a)(P,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Je=this.state,vt=Je.value,ft=Je.focused,st=y()(B,(S={},Object(K.a)(S,pe,!!pe),Object(K.a)(S,"".concat(B,"-disabled"),H),Object(K.a)(S,"".concat(B,"-focused"),ft),S)),_e={};Object.keys(ot).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(_e[le]=ot[le])});var pt=!Y&&!H,dt=this.getInputDisplayValue(null),Re=(vt||vt===0)&&(isNaN(vt)||Number(vt)>=xe),Ke=(vt||vt===0)&&(isNaN(vt)||Number(vt)<=Ie),be=Re||H||Y,de=Ke||H||Y,he=y()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(K.a)({},"".concat(B,"-handler-up-disabled"),be)),$=y()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(K.a)({},"".concat(B,"-handler-down-disabled"),de)),J=j?{onTouchStart:be?l:this.up,onTouchEnd:this.stop}:{onMouseDown:be?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=j?{onTouchStart:de?l:this.down,onTouchEnd:this.stop}:{onMouseDown:de?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:st,style:Ae,title:De,onMouseEnter:Ce,onMouseLeave:Oe,onMouseOver:ce,onMouseOut:fe,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(B,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":be,className:he}),Q||R.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:a})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:$}),ne||R.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:a}))),R.a.createElement("div",{className:"".concat(B,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ie,"aria-valuemax":xe,"aria-valuenow":vt,required:Pe,type:Ze,placeholder:ct,onPaste:lt,onClick:qe,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:Ve,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:pt?this.onKeyDown:l,onKeyUp:pt?this.onKeyUp:l,autoFocus:Ne,maxLength:Qe,readOnly:Y,disabled:H,max:xe,min:Ie,step:et,name:Ue,title:De,id:je,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(dt),pattern:Xe,inputMode:Be,onInput:ut},_e))))}}]),E}(R.a.Component);v.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var c=v,f=at.a=c},k3GJ:function(Dt,at,Z){"use strict";Z.d(at,"a",function(){return bo});var q=Z("rePB"),K=Z("ODXe"),A=Z("Ff2n"),F=Z("VTBJ"),T=Z("cDcd"),M=Z("TSYQ"),U=Z.n(M),I=Z("Zm9Q"),R=Z("6cGi"),_=Z("KQm4"),y=Z("xEkU"),w=Z.n(y),L=Z("t23M");function O(te){var me=Object(T.useRef)(),ye=Object(T.useRef)(!1);function ie(){for(var G=arguments.length,ee=new Array(G),X=0;X<G;X++)ee[X]=arguments[X];ye.current||(w.a.cancel(me.current),me.current=w()(function(){te.apply(void 0,ee)}))}return Object(T.useEffect)(function(){return function(){ye.current=!0,w.a.cancel(me.current)}},[]),ie}function C(te){var me=Object(T.useRef)([]),ye=Object(T.useState)({}),ie=Object(K.a)(ye,2),G=ie[1],ee=Object(T.useRef)(typeof te=="function"?te():te),X=O(function(){var se=ee.current;me.current.forEach(function(Ee){se=Ee(se)}),me.current=[],ee.current=se,G({})});function oe(se){me.current.push(se),X()}return[ee.current,oe]}var p=Z("4IlW");function l(te,me){var ye,ie=te.prefixCls,G=te.id,ee=te.active,X=te.rtl,oe=te.tab,se=oe.key,Ee=oe.tab,ge=oe.disabled,Se=oe.closeIcon,Me=te.tabBarGutter,Ge=te.tabPosition,ze=te.closable,tt=te.renderWrapper,At=te.removeAriaLabel,Bt=te.editable,kt=te.onClick,Nt=te.onRemove,jt=te.onFocus,Ft="".concat(ie,"-tab");T.useEffect(function(){return Nt},[]);var Ut={};Ge==="top"||Ge==="bottom"?Ut[X?"marginLeft":"marginRight"]=Me:Ut.marginBottom=Me;var Qt=Bt&&ze!==!1&&!ge;function zt(Ot){if(ge)return;kt(Ot)}function gr(Ot){Ot.preventDefault(),Ot.stopPropagation(),Bt.onEdit("remove",{key:se,event:Ot})}var Gt=T.createElement("div",{key:se,ref:me,className:U()(Ft,(ye={},Object(q.a)(ye,"".concat(Ft,"-with-remove"),Qt),Object(q.a)(ye,"".concat(Ft,"-active"),ee),Object(q.a)(ye,"".concat(Ft,"-disabled"),ge),ye)),style:Ut,onClick:zt},T.createElement("div",{role:"tab","aria-selected":ee,id:G&&"".concat(G,"-tab-").concat(se),className:"".concat(Ft,"-btn"),"aria-controls":G&&"".concat(G,"-panel-").concat(se),"aria-disabled":ge,tabIndex:ge?null:0,onClick:function(wt){wt.stopPropagation(),zt(wt)},onKeyDown:function(wt){[p.a.SPACE,p.a.ENTER].includes(wt.which)&&(wt.preventDefault(),zt(wt))},onFocus:jt},Ee),Qt&&T.createElement("button",{type:"button","aria-label":At||"remove",tabIndex:0,className:"".concat(Ft,"-remove"),onClick:function(wt){wt.stopPropagation(),gr(wt)}},Se||Bt.removeIcon||"\xD7"));return tt&&(Gt=tt(Gt)),Gt}var a=T.forwardRef(l),s={width:0,height:0,left:0,top:0};function u(te,me,ye){return Object(T.useMemo)(function(){for(var ie,G=new Map,ee=me.get((ie=te[0])===null||ie===void 0?void 0:ie.key)||s,X=ee.left+ee.width,oe=0;oe<te.length;oe+=1){var se=te[oe].key,Ee=me.get(se);if(!Ee){var ge;Ee=me.get((ge=te[oe-1])===null||ge===void 0?void 0:ge.key)||s}var Se=G.get(se)||Object(F.a)({},Ee);Se.right=X-Se.left-Se.width,G.set(se,Se)}return G},[te.map(function(ie){return ie.key}).join("_"),me,ye])}var b={width:0,height:0,left:0,top:0,right:0};function m(te,me,ye,ie,G){var ee=G.tabs,X=G.tabPosition,oe=G.rtl,se,Ee,ge;["top","bottom"].includes(X)?(se="width",Ee=oe?"right":"left",ge=Math.abs(me.left)):(se="height",Ee="top",ge=-me.top);var Se=me[se],Me=ye[se],Ge=ie[se],ze=Se;return Me+Ge>Se&&(ze=Se-Ge),Object(T.useMemo)(function(){if(!ee.length)return[0,0];for(var tt=ee.length,At=tt,Bt=0;Bt<tt;Bt+=1){var kt=te.get(ee[Bt].key)||b;if(kt[Ee]+kt[se]>ge+ze){At=Bt-1;break}}for(var Nt=0,jt=tt-1;jt>=0;jt-=1){var Ft=te.get(ee[jt].key)||b;if(Ft[Ee]<ge){Nt=jt+1;break}}return[Nt,At]},[te,ge,ze,X,ee.map(function(tt){return tt.key}).join("_"),oe])}var h=Z("wx14"),D=Z("1OyB"),v=Z("vuIU"),c=Z("JX7q"),f=Z("Ji7U"),d=Z("LK+K"),o=Z("I8Z2"),E=Z("bT9E"),g=Z("2GS6"),S=Z("Gytx"),P=Z.n(S),B=Z("U8pU"),H=/iPhone/i,Y=/iPod/i,j=/iPad/i,N=/\bAndroid(?:.+)Mobile\b/i,Q=/Android/i,ne=/\bAndroid(?:.+)SD4930UR\b/i,pe=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,xe=/Windows Phone/i,Ie=/\bWindows(?:.+)ARM\b/i,Ae=/BlackBerry/i,De=/BB10/i,Ce=/Opera Mini/i,Oe=/\b(CriOS|Chrome)(?:.+)Mobile/i,ce=/Mobile(?:.+)Firefox\b/i;function fe(te,me){return te.test(me)}function Pe(te){var me=te||(typeof navigator!="undefined"?navigator.userAgent:""),ye=(me||"").split("[FBAN");if(typeof ye[1]!="undefined"){var ie=ye,G=Object(K.a)(ie,1);me=G[0]}if(ye=me.split("Twitter"),typeof ye[1]!="undefined"){var ee=ye,X=Object(K.a)(ee,1);me=X[0]}var oe={apple:{phone:fe(H,me)&&!fe(xe,me),ipod:fe(Y,me),tablet:!fe(H,me)&&fe(j,me)&&!fe(xe,me),device:(fe(H,me)||fe(Y,me)||fe(j,me))&&!fe(xe,me)},amazon:{phone:fe(ne,me),tablet:!fe(ne,me)&&fe(pe,me),device:fe(ne,me)||fe(pe,me)},android:{phone:!fe(xe,me)&&fe(ne,me)||!fe(xe,me)&&fe(N,me),tablet:!fe(xe,me)&&!fe(ne,me)&&!fe(N,me)&&(fe(pe,me)||fe(Q,me)),device:!fe(xe,me)&&(fe(ne,me)||fe(pe,me)||fe(N,me)||fe(Q,me))||fe(/\bokhttp\b/i,me)},windows:{phone:fe(xe,me),tablet:fe(Ie,me),device:fe(xe,me)||fe(Ie,me)},other:{blackberry:fe(Ae,me),blackberry10:fe(De,me),opera:fe(Ce,me),firefox:fe(ce,me),chrome:fe(Oe,me),device:fe(Ae,me)||fe(De,me)||fe(Ce,me)||fe(ce,me)||fe(Oe,me)},any:null,phone:null,tablet:null};return oe.any=oe.apple.device||oe.android.device||oe.windows.device||oe.other.device,oe.phone=oe.apple.phone||oe.android.phone||oe.windows.phone,oe.tablet=oe.apple.tablet||oe.android.tablet||oe.windows.tablet,oe}var qe=Object(F.a)(Object(F.a)({},Pe()),{},{isMobile:Pe}),Ve=qe;function Ze(){}function ct(te,me,ye){var ie=me||"";return te.key||"".concat(ie,"item_").concat(ye)}function je(te){return"".concat(te,"-menu-")}function Be(te,me){var ye=-1;T.Children.forEach(te,function(ie){ye+=1,ie&&ie.type&&ie.type.isMenuItemGroup?T.Children.forEach(ie.props.children,function(G){ye+=1,me(G,ye)}):me(ie,ye)})}function Xe(te,me,ye){if(!te||ye.find)return;T.Children.forEach(te,function(ie){if(ie){var G=ie.type;if(!G||!(G.isSubMenu||G.isMenuItem||G.isMenuItemGroup))return;me.indexOf(ie.key)!==-1?ye.find=!0:ie.props.children&&Xe(ie.props.children,me,ye)}})}var et=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],Qe=function(me){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=me&&typeof me.getBoundingClientRect=="function"&&me.getBoundingClientRect().width;if(ie){if(ye){var G=getComputedStyle(me),ee=G.marginLeft,X=G.marginRight;ie+=+ee.replace("px","")+ +X.replace("px","")}ie=+ie.toFixed(6)}return ie||0},Ne=function(me,ye,ie){me&&Object(B.a)(me.style)==="object"&&(me.style[ye]=ie)},Ue=function(){return Ve.any},lt=Z("bdgK"),ut=Z("faye"),ot=Z.n(ut),Je=Z("wgJM"),vt=Z("l4aY"),ft=Z("m+aA"),st=Z("c+Xe"),_e=Z("zT1h"),pt=Z("QC+M");function dt(te,me,ye){return ye?te[0]===me[0]:te[0]===me[0]&&te[1]===me[1]}function Re(te,me,ye){var ie=te[me]||{};return Object(F.a)(Object(F.a)({},ie),ye)}function Ke(te,me,ye,ie){for(var G=ye.points,ee=Object.keys(te),X=0;X<ee.length;X+=1){var oe=ee[X];if(dt(te[oe].points,G,ie))return"".concat(me,"-placement-").concat(oe)}return""}var be=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var te=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(te)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(te==null?void 0:te.substr(0,4)))},de=Z("MNnm");function he(te,me){var ye={};return ye[te.toLowerCase()]=me.toLowerCase(),ye["Webkit".concat(te)]="webkit".concat(me),ye["Moz".concat(te)]="moz".concat(me),ye["ms".concat(te)]="MS".concat(me),ye["O".concat(te)]="o".concat(me.toLowerCase()),ye}function $(te,me){var ye={animationend:he("Animation","AnimationEnd"),transitionend:he("Transition","TransitionEnd")};return te&&("AnimationEvent"in me||delete ye.animationend.animation,"TransitionEvent"in me||delete ye.transitionend.transition),ye}var J=$(Object(de.a)(),typeof window!="undefined"?window:{}),re={};if(Object(de.a)()){var le=document.createElement("div");re=le.style}var ve={};function Le(te){if(ve[te])return ve[te];var me=J[te];if(me)for(var ye=Object.keys(me),ie=ye.length,G=0;G<ie;G+=1){var ee=ye[G];if(Object.prototype.hasOwnProperty.call(me,ee)&&ee in re)return ve[te]=me[ee],ve[te]}return""}var Fe=Le("animationend"),it=Le("transitionend"),xt=!!(Fe&&it),gt=Fe||"animationend",Zt=it||"transitionend";function Rt(te,me){if(!te)return null;if(Object(B.a)(te)==="object"){var ye=me.replace(/-\w/g,function(ie){return ie[1].toUpperCase()});return te[ye]}return"".concat(te,"-").concat(me)}var Tt="none",nr="appear",Xt="enter",Cr="leave",Or="none",It="prepare",$r="start",tn="active",Qr="end";function dn(te){var me=Object(T.useRef)(!1),ye=Object(T.useState)(te),ie=Object(K.a)(ye,2),G=ie[0],ee=ie[1];function X(oe){me.current||ee(oe)}return Object(T.useEffect)(function(){return function(){me.current=!0}},[]),[G,X]}var bn=Object(de.a)()?T.useLayoutEffect:T.useEffect,sa=bn,Pn=function(){var te=T.useRef(null);function me(){Je.a.cancel(te.current)}function ye(ie){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;me();var ee=Object(Je.a)(function(){G<=1?ie({isCanceled:function(){return ee!==te.current}}):ye(ie,G-1)});te.current=ee}return T.useEffect(function(){return function(){me()}},[]),[ye,me]},xi=[It,$r,tn,Qr],Ti=!1,Er=!0;function bt(te){return te===tn||te===Qr}var Fn=function(te,me){var ye=T.useState(Or),ie=Object(K.a)(ye,2),G=ie[0],ee=ie[1],X=Pn(),oe=Object(K.a)(X,2),se=oe[0],Ee=oe[1];function ge(){ee(It)}return sa(function(){if(G!==Or&&G!==Qr){var Se=xi.indexOf(G),Me=xi[Se+1],Ge=me(G);Ge===Ti?ee(Me):se(function(ze){function tt(){if(ze.isCanceled())return;ee(Me)}Ge===!0?tt():Promise.resolve(Ge).then(tt)})}},[te,G]),T.useEffect(function(){return function(){Ee()}},[]),[ge,G]},Si=function(te){var me=Object(T.useRef)(),ye=Object(T.useRef)(te);ye.current=te;var ie=T.useCallback(function(X){ye.current(X)},[]);function G(X){X&&(X.removeEventListener(Zt,ie),X.removeEventListener(gt,ie))}function ee(X){me.current&&me.current!==X&&G(me.current),X&&X!==me.current&&(X.addEventListener(Zt,ie),X.addEventListener(gt,ie),me.current=X)}return T.useEffect(function(){return function(){G(me.current)}},[]),[ee,G]};function Jr(te,me,ye,ie){var G=ie.motionEnter,ee=G===void 0?!0:G,X=ie.motionAppear,oe=X===void 0?!0:X,se=ie.motionLeave,Ee=se===void 0?!0:se,ge=ie.motionDeadline,Se=ie.motionLeaveImmediately,Me=ie.onAppearPrepare,Ge=ie.onEnterPrepare,ze=ie.onLeavePrepare,tt=ie.onAppearStart,At=ie.onEnterStart,Bt=ie.onLeaveStart,kt=ie.onAppearActive,Nt=ie.onEnterActive,jt=ie.onLeaveActive,Ft=ie.onAppearEnd,Ut=ie.onEnterEnd,Qt=ie.onLeaveEnd,zt=ie.onVisibleChanged,gr=dn(),Gt=Object(K.a)(gr,2),Ot=Gt[0],wt=Gt[1],Vt=dn(Tt),Jt=Object(K.a)(Vt,2),yt=Jt[0],er=Jt[1],yr=dn(null),rr=Object(K.a)(yr,2),cr=rr[0],ur=rr[1],Lr=Object(T.useRef)(!1),Nr=Object(T.useRef)(null),xr=Object(T.useRef)(!1),Zr=Object(T.useRef)(null);function An(){var pr=ye();return pr||Zr.current}var an=Object(T.useRef)(!1);function Ur(pr){var lr=An();if(pr&&!pr.deadline&&pr.target!==lr)return;var Fr;yt===nr&&an.current?Fr=Ft==null?void 0:Ft(lr,pr):yt===Xt&&an.current?Fr=Ut==null?void 0:Ut(lr,pr):yt===Cr&&an.current&&(Fr=Qt==null?void 0:Qt(lr,pr)),Fr!==!1&&!xr.current&&(er(Tt),ur(null))}var mr=Si(Ur),fr=Object(K.a)(mr,1),Tr=fr[0],br=T.useMemo(function(){var pr,lr,Fr;switch(yt){case"appear":return pr={},Object(q.a)(pr,It,Me),Object(q.a)(pr,$r,tt),Object(q.a)(pr,tn,kt),pr;case"enter":return lr={},Object(q.a)(lr,It,Ge),Object(q.a)(lr,$r,At),Object(q.a)(lr,tn,Nt),lr;case"leave":return Fr={},Object(q.a)(Fr,It,ze),Object(q.a)(Fr,$r,Bt),Object(q.a)(Fr,tn,jt),Fr;default:return{}}},[yt]),Ln=Fn(yt,function(pr){if(pr===It){var lr=br[It];return lr?lr(An()):Ti}if(dr in br){var Fr;ur(((Fr=br[dr])===null||Fr===void 0?void 0:Fr.call(br,An(),null))||null)}return dr===tn&&(Tr(An()),ge>0&&(clearTimeout(Nr.current),Nr.current=setTimeout(function(){Ur({deadline:!0})},ge))),Er}),qn=Object(K.a)(Ln,2),ei=qn[0],dr=qn[1],Un=bt(dr);an.current=Un,sa(function(){wt(me);var pr=Lr.current;if(Lr.current=!0,!te)return;var lr;!pr&&me&&oe&&(lr=nr),pr&&me&&ee&&(lr=Xt),(pr&&!me&&Ee||!pr&&Se&&!me&&Ee)&&(lr=Cr),lr&&(er(lr),ei())},[me]),Object(T.useEffect)(function(){(yt===nr&&!oe||yt===Xt&&!ee||yt===Cr&&!Ee)&&er(Tt)},[oe,ee,Ee]),Object(T.useEffect)(function(){return function(){clearTimeout(Nr.current),xr.current=!0}},[]),Object(T.useEffect)(function(){Ot!==void 0&&yt===Tt&&(zt==null||zt(Ot))},[Ot,yt]);var ti=cr;return br[It]&&dr===$r&&(ti=Object(F.a)({transition:"none"},ti)),[yt,dr,ti,Ot!=null?Ot:me]}var tr=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(){return Object(D.a)(this,ye),me.apply(this,arguments)}return Object(v.a)(ye,[{key:"render",value:function(){return this.props.children}}]),ye}(T.Component),wn=tr;function Bn(te){var me=te;Object(B.a)(te)==="object"&&(me=te.transitionSupport);function ye(G){return!!(G.motionName&&me)}var ie=T.forwardRef(function(G,ee){var X=G.visible,oe=X===void 0?!0:X,se=G.removeOnLeave,Ee=se===void 0?!0:se,ge=G.forceRender,Se=G.children,Me=G.motionName,Ge=G.leavedClassName,ze=G.eventProps,tt=ye(G),At=Object(T.useRef)(),Bt=Object(T.useRef)();function kt(){try{return Object(ft.a)(At.current||Bt.current)}catch(er){return null}}var Nt=Jr(tt,oe,kt,G),jt=Object(K.a)(Nt,4),Ft=jt[0],Ut=jt[1],Qt=jt[2],zt=jt[3],gr=T.useRef(zt);zt&&(gr.current=!0);var Gt=Object(T.useRef)(ee);Gt.current=ee;var Ot=T.useCallback(function(er){At.current=er,Object(st.b)(Gt.current,er)},[]),wt,Vt=Object(F.a)(Object(F.a)({},ze),{},{visible:oe});if(!Se)wt=null;else if(Ft===Tt||!ye(G))zt?wt=Se(Object(F.a)({},Vt),Ot):!Ee&&gr.current?wt=Se(Object(F.a)(Object(F.a)({},Vt),{},{className:Ge}),Ot):ge?wt=Se(Object(F.a)(Object(F.a)({},Vt),{},{style:{display:"none"}}),Ot):wt=null;else{var Jt,yt;Ut===It?yt="prepare":bt(Ut)?yt="active":Ut===$r&&(yt="start"),wt=Se(Object(F.a)(Object(F.a)({},Vt),{},{className:U()(Rt(Me,Ft),(Jt={},Object(q.a)(Jt,Rt(Me,"".concat(Ft,"-").concat(yt)),yt),Object(q.a)(Jt,Me,typeof Me=="string"),Jt)),style:Qt}),Ot)}return T.createElement(wn,{ref:Bt},wt)});return ie.displayName="CSSMotion",ie}var si=Bn(xt),He="add",_t="keep",li="remove",ui="removed";function wi(te){var me;return te&&Object(B.a)(te)==="object"&&"key"in te?me=te:me={key:te},Object(F.a)(Object(F.a)({},me),{},{key:String(me.key)})}function jn(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return te.map(wi)}function Ci(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ye=[],ie=0,G=me.length,ee=jn(te),X=jn(me);ee.forEach(function(Ee){for(var ge=!1,Se=ie;Se<G;Se+=1){var Me=X[Se];if(Me.key===Ee.key){ie<Se&&(ye=ye.concat(X.slice(ie,Se).map(function(Ge){return Object(F.a)(Object(F.a)({},Ge),{},{status:He})})),ie=Se),ye.push(Object(F.a)(Object(F.a)({},Me),{},{status:_t})),ie+=1,ge=!0;break}}ge||ye.push(Object(F.a)(Object(F.a)({},Ee),{},{status:li}))}),ie<G&&(ye=ye.concat(X.slice(ie).map(function(Ee){return Object(F.a)(Object(F.a)({},Ee),{},{status:He})})));var oe={};ye.forEach(function(Ee){var ge=Ee.key;oe[ge]=(oe[ge]||0)+1});var se=Object.keys(oe).filter(function(Ee){return oe[Ee]>1});return se.forEach(function(Ee){ye=ye.filter(function(ge){var Se=ge.key,Me=ge.status;return Se!==Ee||Me!==li}),ye.forEach(function(ge){ge.key===Ee&&(ge.status=_t)})}),ye}var Pt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function la(te){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:si,ye=function(ie){Object(f.a)(ee,ie);var G=Object(d.a)(ee);function ee(){var X;return Object(D.a)(this,ee),X=G.apply(this,arguments),X.state={keyEntities:[]},X.removeKey=function(oe){X.setState(function(se){var Ee=se.keyEntities;return{keyEntities:Ee.map(function(ge){return ge.key!==oe?ge:Object(F.a)(Object(F.a)({},ge),{},{status:ui})})}})},X}return Object(v.a)(ee,[{key:"render",value:function(){var oe=this,se=this.state.keyEntities,Ee=this.props,ge=Ee.component,Se=Ee.children,Me=Ee.onVisibleChanged,Ge=Object(A.a)(Ee,["component","children","onVisibleChanged"]),ze=ge||T.Fragment,tt={};return Pt.forEach(function(At){tt[At]=Ge[At],delete Ge[At]}),delete Ge.keys,T.createElement(ze,Ge,se.map(function(At){var Bt=At.status,kt=Object(A.a)(At,["status"]),Nt=Bt===He||Bt===_t;return T.createElement(me,Object(h.a)({},tt,{key:kt.key,visible:Nt,eventProps:kt,onVisibleChanged:function(Ft){Me==null||Me(Ft,{key:kt.key}),Ft||oe.removeKey(kt.key)}}),Se)}))}}],[{key:"getDerivedStateFromProps",value:function(oe,se){var Ee=oe.keys,ge=se.keyEntities,Se=jn(Ee),Me=Ci(ge,Se);return{keyEntities:Me.filter(function(Ge){var ze=ge.find(function(tt){var At=tt.key;return Ge.key===At});return!(ze&&ze.status===ui&&Ge.status===li)})}}}]),ee}(T.Component);return ye.defaultProps={component:"div"},ye}var Ye=la(xt),Wn=si;function cn(te){var me=te.prefixCls,ye=te.motion,ie=te.animation,G=te.transitionName;return ye||(ie?{motionName:"".concat(me,"-").concat(ie)}:G?{motionName:G}:null)}function Ki(te){var me=te.prefixCls,ye=te.visible,ie=te.zIndex,G=te.mask,ee=te.maskMotion,X=te.maskAnimation,oe=te.maskTransitionName;if(!G)return null;var se={};return(ee||oe||X)&&(se=Object(F.a)({motionAppear:!0},cn({motion:ee,prefixCls:me,transitionName:oe,animation:X}))),T.createElement(Wn,Object(h.a)({},se,{visible:ye,removeOnLeave:!0}),function(Ee){var ge=Ee.className;return T.createElement("div",{style:{zIndex:ie},className:U()("".concat(me,"-mask"),ge)})})}var di=Z("9mu1"),Cn=Z("o0o1"),Oi=Z.n(Cn),Hi=Z("HaE+"),En=["measure","align",null,"motion"],zi=function(te,me){var ye=Object(T.useState)(null),ie=Object(K.a)(ye,2),G=ie[0],ee=ie[1],X=Object(T.useRef)(),oe=Object(T.useRef)(!1);function se(Se){oe.current||ee(Se)}function Ee(){Je.a.cancel(X.current)}function ge(Se){Ee(),X.current=Object(Je.a)(function(){se(function(Me){switch(G){case"align":return"motion";case"motion":return"stable";default:}return Me}),Se==null||Se()})}return Object(T.useEffect)(function(){se("measure")},[te]),Object(T.useEffect)(function(){switch(G){case"measure":me();break;default:}G&&(X.current=Object(Je.a)(Object(Hi.a)(Oi.a.mark(function Se(){var Me,Ge;return Oi.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:Me=En.indexOf(G),Ge=En[Me+1],Ge&&Me!==-1&&se(Ge);case 3:case"end":return tt.stop()}},Se)}))))},[G]),Object(T.useEffect)(function(){return function(){oe.current=!0,Ee()}},[]),[G,ge]},ua=function(te){var me=T.useState({width:0,height:0}),ye=Object(K.a)(me,2),ie=ye[0],G=ye[1];function ee(oe){G({width:oe.offsetWidth,height:oe.offsetHeight})}var X=T.useMemo(function(){var oe={};if(te){var se=ie.width,Ee=ie.height;te.indexOf("height")!==-1&&Ee?oe.height=Ee:te.indexOf("minHeight")!==-1&&Ee&&(oe.minHeight=Ee),te.indexOf("width")!==-1&&se?oe.width=se:te.indexOf("minWidth")!==-1&&se&&(oe.minWidth=se)}return oe},[te,ie]);return[X,ee]},Di=T.forwardRef(function(te,me){var ye=te.visible,ie=te.prefixCls,G=te.className,ee=te.style,X=te.children,oe=te.zIndex,se=te.stretch,Ee=te.destroyPopupOnHide,ge=te.forceRender,Se=te.align,Me=te.point,Ge=te.getRootDomNode,ze=te.getClassNameFromAlign,tt=te.onAlign,At=te.onMouseEnter,Bt=te.onMouseLeave,kt=te.onMouseDown,Nt=te.onTouchStart,jt=Object(T.useRef)(),Ft=Object(T.useRef)(),Ut=Object(T.useState)(),Qt=Object(K.a)(Ut,2),zt=Qt[0],gr=Qt[1],Gt=ua(se),Ot=Object(K.a)(Gt,2),wt=Ot[0],Vt=Ot[1];function Jt(){se&&Vt(Ge())}var yt=zi(ye,Jt),er=Object(K.a)(yt,2),yr=er[0],rr=er[1],cr=Object(T.useRef)();function ur(){return Me||Ge}function Lr(){var mr;(mr=jt.current)===null||mr===void 0||mr.forceAlign()}function Nr(mr,fr){var Tr=ze(fr);zt!==Tr&&gr(Tr),yr==="align"&&(zt!==Tr?Promise.resolve().then(function(){Lr()}):rr(function(){var br;(br=cr.current)===null||br===void 0||br.call(cr)}),tt==null||tt(mr,fr))}var xr=Object(F.a)({},cn(te));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(mr){var fr=xr[mr];xr[mr]=function(Tr,br){return rr(),fr==null?void 0:fr(Tr,br)}});function Zr(){return new Promise(function(mr){cr.current=mr})}T.useEffect(function(){!xr.motionName&&yr==="motion"&&rr()},[xr.motionName,yr]),T.useImperativeHandle(me,function(){return{forceAlign:Lr,getElement:function(){return Ft.current}}});var An=Object(F.a)(Object(F.a)({},wt),{},{zIndex:oe,opacity:yr==="motion"||yr==="stable"||!ye?void 0:0,pointerEvents:yr==="stable"?void 0:"none"},ee),an=!0;(Se==null?void 0:Se.points)&&(yr==="align"||yr==="stable")&&(an=!1);var Ur=X;return T.Children.count(X)>1&&(Ur=T.createElement("div",{className:"".concat(ie,"-content")},X)),T.createElement(Wn,Object(h.a)({visible:ye,ref:Ft,leavedClassName:"".concat(ie,"-hidden")},xr,{onAppearPrepare:Zr,onEnterPrepare:Zr,removeOnLeave:Ee,forceRender:ge}),function(mr,fr){var Tr=mr.className,br=mr.style,Ln=U()(ie,G,zt,Tr);return T.createElement(di.a,{target:ur(),key:"popup",ref:jt,monitorWindowResize:!0,disabled:an,align:Se,onAlign:Nr},T.createElement("div",{ref:fr,className:Ln,onMouseEnter:At,onMouseLeave:Bt,onMouseDownCapture:kt,onTouchStartCapture:Nt,style:Object(F.a)(Object(F.a)({},br),An)},Ur))})});Di.displayName="PopupInner";var On=Di,Gi=T.forwardRef(function(te,me){var ye=te.prefixCls,ie=te.visible,G=te.zIndex,ee=te.children,X=te.mobile;X=X===void 0?{}:X;var oe=X.popupClassName,se=X.popupStyle,Ee=X.popupMotion,ge=Ee===void 0?{}:Ee,Se=X.popupRender,Me=T.useRef();T.useImperativeHandle(me,function(){return{forceAlign:function(){},getElement:function(){return Me.current}}});var Ge=Object(F.a)({zIndex:G},se),ze=ee;return T.Children.count(ee)>1&&(ze=T.createElement("div",{className:"".concat(ye,"-content")},ee)),Se&&(ze=Se(ze)),T.createElement(Wn,Object(h.a)({visible:ie,ref:Me,removeOnLeave:!0},ge),function(tt,At){var Bt=tt.className,kt=tt.style,Nt=U()(ye,oe,Bt);return T.createElement("div",{ref:At,className:Nt,style:Object(F.a)(Object(F.a)({},kt),Ge)},ze)})});Gi.displayName="MobilePopupInner";var ka=Gi,Vi=["visible","mobile"],Kr=T.forwardRef(function(te,me){var ye=te.visible,ie=te.mobile,G=Object(A.a)(te,Vi),ee=Object(T.useState)(ye),X=Object(K.a)(ee,2),oe=X[0],se=X[1],Ee=Object(T.useState)(!1),ge=Object(K.a)(Ee,2),Se=ge[0],Me=ge[1],Ge=Object(F.a)(Object(F.a)({},G),{},{visible:oe});Object(T.useEffect)(function(){se(ye),ye&&ie&&Me(be())},[ye,ie]);var ze=Se?T.createElement(ka,Object(h.a)({},Ge,{mobile:ie,ref:me})):T.createElement(On,Object(h.a)({},Ge,{ref:me}));return T.createElement("div",null,T.createElement(Ki,Ge),ze)});Kr.displayName="Popup";var $n=Kr,Ia=T.createContext(null),Qn=Ia;function fn(){}function Xi(){return""}function Na(te){return te?te.ownerDocument:window.document}var da=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function ca(te){var me=function(ye){Object(f.a)(G,ye);var ie=Object(d.a)(G);function G(ee){var X;Object(D.a)(this,G),X=ie.call(this,ee),X.popupRef=T.createRef(),X.triggerRef=T.createRef(),X.attachId=void 0,X.clickOutsideHandler=void 0,X.touchOutsideHandler=void 0,X.contextMenuOutsideHandler1=void 0,X.contextMenuOutsideHandler2=void 0,X.mouseDownTimeout=void 0,X.focusTime=void 0,X.preClickTime=void 0,X.preTouchTime=void 0,X.delayTimer=void 0,X.hasPopupMouseDown=void 0,X.onMouseEnter=function(se){var Ee=X.props.mouseEnterDelay;X.fireEvents("onMouseEnter",se),X.delaySetPopupVisible(!0,Ee,Ee?null:se)},X.onMouseMove=function(se){X.fireEvents("onMouseMove",se),X.setPoint(se)},X.onMouseLeave=function(se){X.fireEvents("onMouseLeave",se),X.delaySetPopupVisible(!1,X.props.mouseLeaveDelay)},X.onPopupMouseEnter=function(){X.clearDelayTimer()},X.onPopupMouseLeave=function(se){var Ee;if(se.relatedTarget&&!se.relatedTarget.setTimeout&&Object(vt.a)((Ee=X.popupRef.current)===null||Ee===void 0?void 0:Ee.getElement(),se.relatedTarget))return;X.delaySetPopupVisible(!1,X.props.mouseLeaveDelay)},X.onFocus=function(se){X.fireEvents("onFocus",se),X.clearDelayTimer(),X.isFocusToShow()&&(X.focusTime=Date.now(),X.delaySetPopupVisible(!0,X.props.focusDelay))},X.onMouseDown=function(se){X.fireEvents("onMouseDown",se),X.preClickTime=Date.now()},X.onTouchStart=function(se){X.fireEvents("onTouchStart",se),X.preTouchTime=Date.now()},X.onBlur=function(se){X.fireEvents("onBlur",se),X.clearDelayTimer(),X.isBlurToHide()&&X.delaySetPopupVisible(!1,X.props.blurDelay)},X.onContextMenu=function(se){se.preventDefault(),X.fireEvents("onContextMenu",se),X.setPopupVisible(!0,se)},X.onContextMenuClose=function(){X.isContextMenuToShow()&&X.close()},X.onClick=function(se){if(X.fireEvents("onClick",se),X.focusTime){var Ee;if(X.preClickTime&&X.preTouchTime?Ee=Math.min(X.preClickTime,X.preTouchTime):X.preClickTime?Ee=X.preClickTime:X.preTouchTime&&(Ee=X.preTouchTime),Math.abs(Ee-X.focusTime)<20)return;X.focusTime=0}X.preClickTime=0,X.preTouchTime=0,X.isClickToShow()&&(X.isClickToHide()||X.isBlurToHide())&&se&&se.preventDefault&&se.preventDefault();var ge=!X.state.popupVisible;(X.isClickToHide()&&!ge||ge&&X.isClickToShow())&&X.setPopupVisible(!X.state.popupVisible,se)},X.onPopupMouseDown=function(){if(X.hasPopupMouseDown=!0,clearTimeout(X.mouseDownTimeout),X.mouseDownTimeout=window.setTimeout(function(){X.hasPopupMouseDown=!1},0),X.context){var se;(se=X.context).onPopupMouseDown.apply(se,arguments)}},X.onDocumentClick=function(se){if(X.props.mask&&!X.props.maskClosable)return;var Ee=se.target,ge=X.getRootDomNode(),Se=X.getPopupDomNode();(!Object(vt.a)(ge,Ee)||X.isContextMenuOnly())&&!Object(vt.a)(Se,Ee)&&!X.hasPopupMouseDown&&X.close()},X.getRootDomNode=function(){var se=X.props.getTriggerDOMNode;if(se)return se(X.triggerRef.current);try{var Ee=Object(ft.a)(X.triggerRef.current);if(Ee)return Ee}catch(ge){}return ot.a.findDOMNode(Object(c.a)(X))},X.getPopupClassNameFromAlign=function(se){var Ee=[],ge=X.props,Se=ge.popupPlacement,Me=ge.builtinPlacements,Ge=ge.prefixCls,ze=ge.alignPoint,tt=ge.getPopupClassNameFromAlign;return Se&&Me&&Ee.push(Ke(Me,Ge,se,ze)),tt&&Ee.push(tt(se)),Ee.join(" ")},X.getComponent=function(){var se=X.props,Ee=se.prefixCls,ge=se.destroyPopupOnHide,Se=se.popupClassName,Me=se.onPopupAlign,Ge=se.popupMotion,ze=se.popupAnimation,tt=se.popupTransitionName,At=se.popupStyle,Bt=se.mask,kt=se.maskAnimation,Nt=se.maskTransitionName,jt=se.maskMotion,Ft=se.zIndex,Ut=se.popup,Qt=se.stretch,zt=se.alignPoint,gr=se.mobile,Gt=se.forceRender,Ot=X.state,wt=Ot.popupVisible,Vt=Ot.point,Jt=X.getPopupAlign(),yt={};return X.isMouseEnterToShow()&&(yt.onMouseEnter=X.onPopupMouseEnter),X.isMouseLeaveToHide()&&(yt.onMouseLeave=X.onPopupMouseLeave),yt.onMouseDown=X.onPopupMouseDown,yt.onTouchStart=X.onPopupMouseDown,T.createElement($n,Object(h.a)({prefixCls:Ee,destroyPopupOnHide:ge,visible:wt,point:zt&&Vt,className:Se,align:Jt,onAlign:Me,animation:ze,getClassNameFromAlign:X.getPopupClassNameFromAlign},yt,{stretch:Qt,getRootDomNode:X.getRootDomNode,style:At,mask:Bt,zIndex:Ft,transitionName:tt,maskAnimation:kt,maskTransitionName:Nt,maskMotion:jt,ref:X.popupRef,motion:Ge,mobile:gr,forceRender:Gt}),typeof Ut=="function"?Ut():Ut)},X.attachParent=function(se){Je.a.cancel(X.attachId);var Ee=X.props,ge=Ee.getPopupContainer,Se=Ee.getDocument,Me=X.getRootDomNode(),Ge;ge?(Me||ge.length===0)&&(Ge=ge(Me)):Ge=Se(X.getRootDomNode()).body,Ge?Ge.appendChild(se):X.attachId=Object(Je.a)(function(){X.attachParent(se)})},X.getContainer=function(){var se=X.props.getDocument,Ee=se(X.getRootDomNode()).createElement("div");return Ee.style.position="absolute",Ee.style.top="0",Ee.style.left="0",Ee.style.width="100%",X.attachParent(Ee),Ee},X.setPoint=function(se){var Ee=X.props.alignPoint;if(!Ee||!se)return;X.setState({point:{pageX:se.pageX,pageY:se.pageY}})},X.handlePortalUpdate=function(){X.state.prevPopupVisible!==X.state.popupVisible&&X.props.afterPopupVisibleChange(X.state.popupVisible)},X.triggerContextValue={onPopupMouseDown:X.onPopupMouseDown};var oe;return"popupVisible"in ee?oe=!!ee.popupVisible:oe=!!ee.defaultPopupVisible,X.state={prevPopupVisible:oe,popupVisible:oe},da.forEach(function(se){X["fire".concat(se)]=function(Ee){X.fireEvents(se,Ee)}}),X}return Object(v.a)(G,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var X=this.props,oe=this.state;if(oe.popupVisible){var se;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(se=X.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(_e.a)(se,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(se=se||X.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(_e.a)(se,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(se=se||X.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(_e.a)(se,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(_e.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Je.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var X;return((X=this.popupRef.current)===null||X===void 0?void 0:X.getElement())||null}},{key:"getPopupAlign",value:function(){var X=this.props,oe=X.popupPlacement,se=X.popupAlign,Ee=X.builtinPlacements;return oe&&Ee?Re(Ee,oe,se):se}},{key:"setPopupVisible",value:function(X,oe){var se=this.props.alignPoint,Ee=this.state.popupVisible;this.clearDelayTimer(),Ee!==X&&("popupVisible"in this.props||this.setState({popupVisible:X,prevPopupVisible:Ee}),this.props.onPopupVisibleChange(X)),se&&oe&&X&&this.setPoint(oe)}},{key:"delaySetPopupVisible",value:function(X,oe,se){var Ee=this,ge=oe*1e3;if(this.clearDelayTimer(),ge){var Se=se?{pageX:se.pageX,pageY:se.pageY}:null;this.delayTimer=window.setTimeout(function(){Ee.setPopupVisible(X,Se),Ee.clearDelayTimer()},ge)}else this.setPopupVisible(X,se)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(X){var oe=this.props.children.props,se=this.props;return oe[X]&&se[X]?this["fire".concat(X)]:oe[X]||se[X]}},{key:"isClickToShow",value:function(){var X=this.props,oe=X.action,se=X.showAction;return oe.indexOf("click")!==-1||se.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var X=this.props.action;return X==="contextMenu"||X.length===1&&X[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var X=this.props,oe=X.action,se=X.showAction;return oe.indexOf("contextMenu")!==-1||se.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var X=this.props,oe=X.action,se=X.hideAction;return oe.indexOf("click")!==-1||se.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var X=this.props,oe=X.action,se=X.showAction;return oe.indexOf("hover")!==-1||se.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var X=this.props,oe=X.action,se=X.hideAction;return oe.indexOf("hover")!==-1||se.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var X=this.props,oe=X.action,se=X.showAction;return oe.indexOf("focus")!==-1||se.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var X=this.props,oe=X.action,se=X.hideAction;return oe.indexOf("focus")!==-1||se.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var X;(X=this.popupRef.current)===null||X===void 0||X.forceAlign()}}},{key:"fireEvents",value:function(X,oe){var se=this.props.children.props[X];se&&se(oe);var Ee=this.props[X];Ee&&Ee(oe)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var X=this.state.popupVisible,oe=this.props,se=oe.children,Ee=oe.forceRender,ge=oe.alignPoint,Se=oe.className,Me=oe.autoDestroy,Ge=T.Children.only(se),ze={key:"trigger"};this.isContextMenuToShow()?ze.onContextMenu=this.onContextMenu:ze.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(ze.onClick=this.onClick,ze.onMouseDown=this.onMouseDown,ze.onTouchStart=this.onTouchStart):(ze.onClick=this.createTwoChains("onClick"),ze.onMouseDown=this.createTwoChains("onMouseDown"),ze.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(ze.onMouseEnter=this.onMouseEnter,ge&&(ze.onMouseMove=this.onMouseMove)):ze.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?ze.onMouseLeave=this.onMouseLeave:ze.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(ze.onFocus=this.onFocus,ze.onBlur=this.onBlur):(ze.onFocus=this.createTwoChains("onFocus"),ze.onBlur=this.createTwoChains("onBlur"));var tt=U()(Ge&&Ge.props&&Ge.props.className,Se);tt&&(ze.className=tt);var At=Object(F.a)({},ze);Object(st.c)(Ge)&&(At.ref=Object(st.a)(this.triggerRef,Ge.ref));var Bt=T.cloneElement(Ge,At),kt;return(X||this.popupRef.current||Ee)&&(kt=T.createElement(te,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!X&&Me&&(kt=null),T.createElement(Qn.Provider,{value:this.triggerContextValue},Bt,kt)}}],[{key:"getDerivedStateFromProps",value:function(X,oe){var se=X.popupVisible,Ee={};return se!==void 0&&oe.popupVisible!==se&&(Ee.popupVisible=se,Ee.prevPopupVisible=oe.popupVisible),Ee}}]),G}(T.Component);return me.contextType=Qn,me.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Xi,getDocument:Na,onPopupVisibleChange:fn,afterPopupVisibleChange:fn,onPopupAlign:fn,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},me}var Ai=ca(pt.a),Dn={adjustX:1,adjustY:1},Yi={topLeft:{points:["bl","tl"],overflow:Dn,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Dn,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:Dn,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:Dn,offset:[4,0]}},Ua={topLeft:{points:["bl","tl"],overflow:Dn,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Dn,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:Dn,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:Dn,offset:[4,0]}},$i=Yi,Jn=0,ci={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},kn=function(me,ye,ie){var G=je(ye),ee=me.getState();me.setState({defaultActiveFirst:Object(F.a)(Object(F.a)({},ee.defaultActiveFirst),{},Object(q.a)({},G,ie))})},In=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(ie){var G;Object(D.a)(this,ye),G=me.call(this,ie),G.onDestroy=function(ge){G.props.onDestroy(ge)},G.onKeyDown=function(ge){var Se=ge.keyCode,Me=G.menuInstance,Ge=G.props.store,ze=G.getVisible();if(Se===p.a.ENTER)return G.onTitleClick(ge),kn(Ge,G.props.eventKey,!0),!0;if(Se===p.a.RIGHT)return ze?Me.onKeyDown(ge):(G.triggerOpenChange(!0),kn(Ge,G.props.eventKey,!0)),!0;if(Se===p.a.LEFT){var tt;if(ze)tt=Me.onKeyDown(ge);else return;return tt||(G.triggerOpenChange(!1),tt=!0),tt}return ze&&(Se===p.a.UP||Se===p.a.DOWN)?Me.onKeyDown(ge):void 0},G.onOpenChange=function(ge){G.props.onOpenChange(ge)},G.onPopupVisibleChange=function(ge){G.triggerOpenChange(ge,ge?"mouseenter":"mouseleave")},G.onMouseEnter=function(ge){var Se=G.props,Me=Se.eventKey,Ge=Se.onMouseEnter,ze=Se.store;kn(ze,G.props.eventKey,!1),Ge({key:Me,domEvent:ge})},G.onMouseLeave=function(ge){var Se=G.props,Me=Se.parentMenu,Ge=Se.eventKey,ze=Se.onMouseLeave;Me.subMenuInstance=Object(c.a)(G),ze({key:Ge,domEvent:ge})},G.onTitleMouseEnter=function(ge){var Se=G.props,Me=Se.eventKey,Ge=Se.onItemHover,ze=Se.onTitleMouseEnter;Ge({key:Me,hover:!0}),ze({key:Me,domEvent:ge})},G.onTitleMouseLeave=function(ge){var Se=G.props,Me=Se.parentMenu,Ge=Se.eventKey,ze=Se.onItemHover,tt=Se.onTitleMouseLeave;Me.subMenuInstance=Object(c.a)(G),ze({key:Ge,hover:!1}),tt({key:Ge,domEvent:ge})},G.onTitleClick=function(ge){var Se=Object(c.a)(G),Me=Se.props;if(Me.onTitleClick({key:Me.eventKey,domEvent:ge}),Me.triggerSubMenuAction==="hover")return;G.triggerOpenChange(!G.getVisible(),"click"),kn(Me.store,G.props.eventKey,!1)},G.onSubMenuClick=function(ge){typeof G.props.onClick=="function"&&G.props.onClick(G.addKeyPath(ge))},G.onSelect=function(ge){G.props.onSelect(ge)},G.onDeselect=function(ge){G.props.onDeselect(ge)},G.getPrefixCls=function(){return"".concat(G.props.rootPrefixCls,"-submenu")},G.getActiveClassName=function(){return"".concat(G.getPrefixCls(),"-active")},G.getDisabledClassName=function(){return"".concat(G.getPrefixCls(),"-disabled")},G.getSelectedClassName=function(){return"".concat(G.getPrefixCls(),"-selected")},G.getOpenClassName=function(){return"".concat(G.props.rootPrefixCls,"-submenu-open")},G.getVisible=function(){return G.state.isOpen},G.getMode=function(){return G.state.mode},G.saveMenuInstance=function(ge){G.menuInstance=ge},G.addKeyPath=function(ge){return Object(F.a)(Object(F.a)({},ge),{},{keyPath:(ge.keyPath||[]).concat(G.props.eventKey)})},G.triggerOpenChange=function(ge,Se){var Me=G.props.eventKey,Ge=function(){G.onOpenChange({key:Me,item:Object(c.a)(G),trigger:Se,open:ge})};Se==="mouseenter"?G.mouseenterTimeout=setTimeout(function(){Ge()},0):Ge()},G.isChildrenSelected=function(){var ge={find:!1};return Xe(G.props.children,G.props.selectedKeys,ge),ge.find},G.isInlineMode=function(){return G.getMode()==="inline"},G.adjustWidth=function(){if(!G.subMenuTitle||!G.menuInstance)return;var ge=ut.findDOMNode(G.menuInstance);if(ge.offsetWidth>=G.subMenuTitle.offsetWidth)return;ge.style.minWidth="".concat(G.subMenuTitle.offsetWidth,"px")},G.saveSubMenuTitle=function(ge){G.subMenuTitle=ge},G.getBaseProps=function(){var ge=Object(c.a)(G),Se=ge.props,Me=G.getMode();return{mode:Me==="horizontal"?"vertical":Me,visible:G.getVisible(),level:Se.level+1,inlineIndent:Se.inlineIndent,focusable:!1,onClick:G.onSubMenuClick,onSelect:G.onSelect,onDeselect:G.onDeselect,onDestroy:G.onDestroy,selectedKeys:Se.selectedKeys,eventKey:"".concat(Se.eventKey,"-menu-"),openKeys:Se.openKeys,motion:Se.motion,onOpenChange:G.onOpenChange,subMenuOpenDelay:Se.subMenuOpenDelay,parentMenu:Object(c.a)(G),subMenuCloseDelay:Se.subMenuCloseDelay,forceSubMenuRender:Se.forceSubMenuRender,triggerSubMenuAction:Se.triggerSubMenuAction,builtinPlacements:Se.builtinPlacements,defaultActiveFirst:Se.store.getState().defaultActiveFirst[je(Se.eventKey)],multiple:Se.multiple,prefixCls:Se.rootPrefixCls,id:G.internalMenuId,manualRef:G.saveMenuInstance,itemIcon:Se.itemIcon,expandIcon:Se.expandIcon,direction:Se.direction}},G.getMotion=function(ge,Se){var Me=Object(c.a)(G),Ge=Me.haveRendered,ze=G.props,tt=ze.motion,At=ze.rootPrefixCls,Bt=Object(F.a)(Object(F.a)({},tt),{},{leavedClassName:"".concat(At,"-hidden"),removeOnLeave:!1,motionAppear:Ge||!Se||ge!=="inline"});return Bt};var ee=ie.store,X=ie.eventKey,oe=ee.getState(),se=oe.defaultActiveFirst;G.isRootMenu=!1;var Ee=!1;return se&&(Ee=se[X]),kn(ee,X,Ee),G.state={mode:ie.mode,isOpen:ie.isOpen},G}return Object(v.a)(ye,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var G=this,ee=this.props,X=ee.mode,oe=ee.parentMenu,se=ee.manualRef,Ee=ee.isOpen,ge=function(){G.setState({mode:X,isOpen:Ee})},Se=Ee!==this.state.isOpen,Me=X!==this.state.mode;if((Me||Se)&&(Je.a.cancel(this.updateStateRaf),Me?this.updateStateRaf=Object(Je.a)(ge):ge()),se&&se(this),X!=="horizontal"||!(oe==null?void 0:oe.isRootMenu)||!Ee)return;this.minWidthTimeout=setTimeout(function(){return G.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var G=this.props,ee=G.onDestroy,X=G.eventKey;ee&&ee(X),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),Je.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(G,ee){var X=this.getBaseProps();return T.createElement(Zi,Object(h.a)({},X,{id:this.internalMenuId,className:G,style:ee}),this.props.children)}},{key:"renderChildren",value:function(){var G=this,ee=this.getBaseProps(),X=ee.mode,oe=ee.visible,se=ee.forceSubMenuRender,Ee=ee.direction,ge=this.getMotion(X,oe);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||oe||se,!this.haveOpened)return T.createElement("div",null);var Se=U()("".concat(ee.prefixCls,"-sub"),Object(q.a)({},"".concat(ee.prefixCls,"-rtl"),Ee==="rtl"));return this.isInlineMode()?T.createElement(Wn,Object(h.a)({visible:ee.visible,forceRender:se},ge),function(Me){var Ge=Me.className,ze=Me.style,tt=U()(Se,Ge);return G.renderPopupMenu(tt,ze)}):this.renderPopupMenu(Se)}},{key:"render",value:function(){var G,ee,X,oe=Object(F.a)({},this.props),se=this.getVisible(),Ee=this.getPrefixCls(),ge=this.isInlineMode(),Se=this.getMode(),Me=U()(Ee,"".concat(Ee,"-").concat(Se),(G={},Object(q.a)(G,oe.className,!!oe.className),Object(q.a)(G,this.getOpenClassName(),se),Object(q.a)(G,this.getActiveClassName(),oe.active||se&&!ge),Object(q.a)(G,this.getDisabledClassName(),oe.disabled),Object(q.a)(G,this.getSelectedClassName(),this.isChildrenSelected()),G));this.internalMenuId||(oe.eventKey?this.internalMenuId="".concat(oe.eventKey,"$Menu"):(Jn+=1,this.internalMenuId="$__$".concat(Jn,"$Menu")));var Ge={},ze={},tt={};oe.disabled||(Ge={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},ze={onClick:this.onTitleClick},tt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var At={},Bt=oe.direction,kt=Bt==="rtl";ge&&(kt?At.paddingRight=oe.inlineIndent*oe.level:At.paddingLeft=oe.inlineIndent*oe.level);var Nt={};this.getVisible()&&(Nt={"aria-owns":this.internalMenuId});var jt=null;Se!=="horizontal"&&(jt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(jt=T.createElement(this.props.expandIcon,Object(F.a)({},this.props))));var Ft=T.createElement("div",Object(h.a)({ref:this.saveSubMenuTitle,style:At,className:"".concat(Ee,"-title"),role:"button"},tt,ze,{"aria-expanded":se},Nt,{"aria-haspopup":"true",title:typeof oe.title=="string"?oe.title:void 0}),oe.title,jt||T.createElement("i",{className:"".concat(Ee,"-arrow")})),Ut=this.renderChildren(),Qt=((ee=oe.parentMenu)===null||ee===void 0?void 0:ee.isRootMenu)?oe.parentMenu.props.getPopupContainer:function(ur){return ur.parentNode},zt=ci[Se],gr=oe.popupOffset?{offset:oe.popupOffset}:{},Gt=U()((X={},Object(q.a)(X,oe.popupClassName,oe.popupClassName&&!ge),Object(q.a)(X,"".concat(Ee,"-rtl"),kt),X)),Ot=oe.disabled,wt=oe.triggerSubMenuAction,Vt=oe.subMenuOpenDelay,Jt=oe.forceSubMenuRender,yt=oe.subMenuCloseDelay,er=oe.builtinPlacements;et.forEach(function(ur){return delete oe[ur]}),delete oe.onClick;var yr=kt?Object(F.a)(Object(F.a)({},Ua),er):Object(F.a)(Object(F.a)({},Yi),er);delete oe.direction;var rr=this.getBaseProps(),cr=ge?null:this.getMotion(rr.mode,rr.visible);return T.createElement("li",Object(h.a)({},oe,Ge,{className:Me,role:"menuitem"}),T.createElement(Ai,{prefixCls:Ee,popupClassName:U()("".concat(Ee,"-popup"),Gt),getPopupContainer:Qt,builtinPlacements:yr,popupPlacement:zt,popupVisible:ge?!1:se,popupAlign:gr,popup:ge?null:Ut,action:Ot||ge?[]:[wt],mouseEnterDelay:Vt,mouseLeaveDelay:yt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Jt,popupMotion:cr},Ft),ge?Ut:null)}}]),ye}(T.Component);In.defaultProps={onMouseEnter:Ze,onMouseLeave:Ze,onTitleMouseEnter:Ze,onTitleMouseLeave:Ze,onTitleClick:Ze,manualRef:Ze,mode:"vertical",title:""};var Nn=Object(o.b)(function(te,me){var ye=te.openKeys,ie=te.activeKey,G=te.selectedKeys,ee=me.eventKey,X=me.subMenuKey;return{isOpen:ye.indexOf(ee)>-1,active:ie[X]===ee,selectedKeys:G}})(In);Nn.isSubMenu=!0;var Kn=Nn,fi="menuitem-overflowed",fa=.5,rn=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(){var ie;return Object(D.a)(this,ye),ie=me.apply(this,arguments),ie.resizeObserver=null,ie.mutationObserver=null,ie.originalTotalWidth=0,ie.overflowedItems=[],ie.menuItemSizes=[],ie.cancelFrameId=null,ie.state={lastVisibleIndex:void 0},ie.childRef=T.createRef(),ie.getMenuItemNodes=function(){var G=ie.props.prefixCls,ee=ie.childRef.current;return ee?[].slice.call(ee.children).filter(function(X){return X.className.split(" ").indexOf("".concat(G,"-overflowed-submenu"))<0}):[]},ie.getOverflowedSubMenuItem=function(G,ee,X){var oe=ie.props,se=oe.overflowedIndicator,Ee=oe.level,ge=oe.mode,Se=oe.prefixCls,Me=oe.theme;if(Ee!==1||ge!=="horizontal")return null;var Ge=ie.props.children[0],ze=Ge.props,tt=ze.children,At=ze.title,Bt=ze.style,kt=Object(A.a)(ze,["children","title","style"]),Nt=Object(F.a)({},Bt),jt="".concat(G,"-overflowed-indicator"),Ft="".concat(G,"-overflowed-indicator");ee.length===0&&X!==!0?Nt=Object(F.a)(Object(F.a)({},Nt),{},{display:"none"}):X&&(Nt=Object(F.a)(Object(F.a)({},Nt),{},{visibility:"hidden",position:"absolute"}),jt="".concat(jt,"-placeholder"),Ft="".concat(Ft,"-placeholder"));var Ut=Me?"".concat(Se,"-").concat(Me):"",Qt={};return et.forEach(function(zt){kt[zt]!==void 0&&(Qt[zt]=kt[zt])}),T.createElement(Kn,Object(h.a)({title:se,className:"".concat(Se,"-overflowed-submenu"),popupClassName:Ut},Qt,{key:jt,eventKey:Ft,disabled:!1,style:Nt}),ee)},ie.setChildrenWidthAndResize=function(){if(ie.props.mode!=="horizontal")return;var G=ie.childRef.current;if(!G)return;var ee=G.children;if(!ee||ee.length===0)return;var X=G.children[ee.length-1];Ne(X,"display","inline-block");var oe=ie.getMenuItemNodes(),se=oe.filter(function(Ee){return Ee.className.split(" ").indexOf(fi)>=0});se.forEach(function(Ee){Ne(Ee,"display","inline-block")}),ie.menuItemSizes=oe.map(function(Ee){return Qe(Ee,!0)}),se.forEach(function(Ee){Ne(Ee,"display","none")}),ie.overflowedIndicatorWidth=Qe(G.children[G.children.length-1],!0),ie.originalTotalWidth=ie.menuItemSizes.reduce(function(Ee,ge){return Ee+ge},0),ie.handleResize(),Ne(X,"display","none")},ie.handleResize=function(){if(ie.props.mode!=="horizontal")return;var G=ie.childRef.current;if(!G)return;var ee=Qe(G);ie.overflowedItems=[];var X=0,oe;ie.originalTotalWidth>ee+fa&&(oe=-1,ie.menuItemSizes.forEach(function(se){X+=se,X+ie.overflowedIndicatorWidth<=ee&&(oe+=1)})),ie.setState({lastVisibleIndex:oe})},ie}return Object(v.a)(ye,[{key:"componentDidMount",value:function(){var G=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var ee=this.childRef.current;if(!ee)return;this.resizeObserver=new lt.default(function(X){X.forEach(function(){var oe=G.cancelFrameId;cancelAnimationFrame(oe),G.cancelFrameId=requestAnimationFrame(G.setChildrenWidthAndResize)})}),[].slice.call(ee.children).concat(ee).forEach(function(X){G.resizeObserver.observe(X)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){G.resizeObserver.disconnect(),[].slice.call(ee.children).concat(ee).forEach(function(X){G.resizeObserver.observe(X)}),G.setChildrenWidthAndResize()}),this.mutationObserver.observe(ee,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(G){var ee=this,X=this.state.lastVisibleIndex;return(G||[]).reduce(function(oe,se,Ee){var ge=se;if(ee.props.mode==="horizontal"){var Se=ee.getOverflowedSubMenuItem(se.props.eventKey,[]);X!==void 0&&ee.props.className.indexOf("".concat(ee.props.prefixCls,"-root"))!==-1&&(Ee>X&&(ge=T.cloneElement(se,{style:{display:"none"},eventKey:"".concat(se.props.eventKey,"-hidden"),className:"".concat(fi)})),Ee===X+1&&(ee.overflowedItems=G.slice(X+1).map(function(Ge){return T.cloneElement(Ge,{key:Ge.props.eventKey,mode:"vertical-left"})}),Se=ee.getOverflowedSubMenuItem(se.props.eventKey,ee.overflowedItems)));var Me=[].concat(Object(_.a)(oe),[Se,ge]);return Ee===G.length-1&&Me.push(ee.getOverflowedSubMenuItem(se.props.eventKey,[],!0)),Me}return[].concat(Object(_.a)(oe),[ge])},[])}},{key:"render",value:function(){var G=this.props,ee=G.visible,X=G.prefixCls,oe=G.overflowedIndicator,se=G.mode,Ee=G.level,ge=G.tag,Se=G.children,Me=G.theme,Ge=Object(A.a)(G,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),ze=ge;return T.createElement(ze,Object(h.a)({ref:this.childRef},Ge),this.renderChildren(Se))}}]),ye}(T.Component);rn.defaultProps={tag:"div",className:""};var ha=rn;function Li(te){return te.length?te.every(function(me){return!!me.props.disabled}):!0}function Zn(te,me,ye){var ie=te.getState();te.setState({activeKey:Object(F.a)(Object(F.a)({},ie.activeKey),{},Object(q.a)({},me,ye))})}function hn(te){return te.eventKey||"0-menu-"}function pn(te,me){var ye=me,ie=te.children,G=te.eventKey;if(ye){var ee;if(Be(ie,function(X,oe){X&&X.props&&!X.props.disabled&&ye===ct(X,G,oe)&&(ee=!0)}),ee)return ye}return ye=null,te.defaultActiveFirst&&Be(ie,function(X,oe){!ye&&X&&!X.props.disabled&&(ye=ct(X,G,oe))}),ye}function Qi(te){if(!te)return;var me=this.instanceArray.indexOf(te);me!==-1?this.instanceArray[me]=te:this.instanceArray.push(te)}var xn=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(ie){var G;return Object(D.a)(this,ye),G=me.call(this,ie),G.onKeyDown=function(ee,X){var oe=ee.keyCode,se;if(G.getFlatInstanceArray().forEach(function(ge){ge&&ge.props.active&&ge.onKeyDown&&(se=ge.onKeyDown(ee))}),se)return 1;var Ee=null;return(oe===p.a.UP||oe===p.a.DOWN)&&(Ee=G.step(oe===p.a.UP?-1:1)),Ee?(ee.preventDefault(),Zn(G.props.store,hn(G.props),Ee.props.eventKey),typeof X=="function"&&X(Ee),1):void 0},G.onItemHover=function(ee){var X=ee.key,oe=ee.hover;Zn(G.props.store,hn(G.props),oe?X:null)},G.onDeselect=function(ee){G.props.onDeselect(ee)},G.onSelect=function(ee){G.props.onSelect(ee)},G.onClick=function(ee){G.props.onClick(ee)},G.onOpenChange=function(ee){G.props.onOpenChange(ee)},G.onDestroy=function(ee){G.props.onDestroy(ee)},G.getFlatInstanceArray=function(){return G.instanceArray},G.step=function(ee){var X=G.getFlatInstanceArray(),oe=G.props.store.getState().activeKey[hn(G.props)],se=X.length;if(!se)return null;ee<0&&(X=X.concat().reverse());var Ee=-1;if(X.every(function(Ge,ze){return Ge&&Ge.props.eventKey===oe?(Ee=ze,!1):!0}),!G.props.defaultActiveFirst&&Ee!==-1&&Li(X.slice(Ee,se-1)))return;var ge=(Ee+1)%se,Se=ge;do{var Me=X[Se];if(!Me||Me.props.disabled)Se=(Se+1)%se;else return Me}while(Se!==ge);return null},G.renderCommonMenuItem=function(ee,X,oe){var se=G.props.store.getState(),Ee=Object(c.a)(G),ge=Ee.props,Se=ct(ee,ge.eventKey,X),Me=ee.props;if(!Me||typeof ee.type=="string")return ee;var Ge=Se===se.activeKey,ze=Object(F.a)(Object(F.a)({mode:Me.mode||ge.mode,level:ge.level,inlineIndent:ge.inlineIndent,renderMenuItem:G.renderMenuItem,rootPrefixCls:ge.prefixCls,index:X,parentMenu:ge.parentMenu,manualRef:Me.disabled?void 0:Object(g.a)(ee.ref,Qi.bind(Object(c.a)(G))),eventKey:Se,active:!Me.disabled&&Ge,multiple:ge.multiple,onClick:function(At){(Me.onClick||Ze)(At),G.onClick(At)},onItemHover:G.onItemHover,motion:ge.motion,subMenuOpenDelay:ge.subMenuOpenDelay,subMenuCloseDelay:ge.subMenuCloseDelay,forceSubMenuRender:ge.forceSubMenuRender,onOpenChange:G.onOpenChange,onDeselect:G.onDeselect,onSelect:G.onSelect,builtinPlacements:ge.builtinPlacements,itemIcon:Me.itemIcon||G.props.itemIcon,expandIcon:Me.expandIcon||G.props.expandIcon},oe),{},{direction:ge.direction});return(ge.mode==="inline"||Ue())&&(ze.triggerSubMenuAction="click"),T.cloneElement(ee,Object(F.a)(Object(F.a)({},ze),{},{key:Se||X}))},G.renderMenuItem=function(ee,X,oe){if(!ee)return null;var se=G.props.store.getState(),Ee={openKeys:se.openKeys,selectedKeys:se.selectedKeys,triggerSubMenuAction:G.props.triggerSubMenuAction,subMenuKey:oe};return G.renderCommonMenuItem(ee,X,Ee)},ie.store.setState({activeKey:Object(F.a)(Object(F.a)({},ie.store.getState().activeKey),{},Object(q.a)({},ie.eventKey,pn(ie,ie.activeKey)))}),G.instanceArray=[],G}return Object(v.a)(ye,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(G){return this.props.visible||G.visible||this.props.className!==G.className||!P()(this.props.style,G.style)}},{key:"componentDidUpdate",value:function(G){var ee=this.props,X="activeKey"in ee?ee.activeKey:ee.store.getState().activeKey[hn(ee)],oe=pn(ee,X);if(oe!==X)Zn(ee.store,hn(ee),oe);else if("activeKey"in G){var se=pn(G,G.activeKey);oe!==se&&Zn(ee.store,hn(ee),oe)}}},{key:"render",value:function(){var G=this,ee=Object(h.a)({},this.props);this.instanceArray=[];var X=U()(ee.prefixCls,ee.className,"".concat(ee.prefixCls,"-").concat(ee.mode)),oe={className:X,role:ee.role||"menu"};ee.id&&(oe.id=ee.id),ee.focusable&&(oe.tabIndex=0,oe.onKeyDown=this.onKeyDown);var se=ee.prefixCls,Ee=ee.eventKey,ge=ee.visible,Se=ee.level,Me=ee.mode,Ge=ee.overflowedIndicator,ze=ee.theme;return et.forEach(function(tt){return delete ee[tt]}),delete ee.onClick,T.createElement(ha,Object(h.a)({},ee,{prefixCls:se,mode:Me,tag:"ul",level:Se,theme:ze,visible:ge,overflowedIndicator:Ge},oe),Object(I.a)(ee.children).map(function(tt,At){return G.renderMenuItem(tt,At,Ee||"0-menu-")}))}}]),ye}(T.Component);xn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Ze};var Ji=Object(o.b)()(xn),Zi=Ji,hi=Z("Kwbf");function Fa(te,me,ye){var ie=te.prefixCls,G=te.motion,ee=te.defaultMotions,X=ee===void 0?{}:ee,oe=te.openAnimation,se=te.openTransitionName,Ee=me.switchingModeFromInline;if(G)return G;if(Object(B.a)(oe)==="object"&&oe)Object(hi.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof oe=="string")return{motionName:"".concat(ie,"-open-").concat(oe)};if(se)return{motionName:se};var ge=X[ye];return ge||(Ee?null:X.other)}var Et=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(ie){var G;Object(D.a)(this,ye),G=me.call(this,ie),G.onSelect=function(oe){var se=Object(c.a)(G),Ee=se.props;if(Ee.selectable){var ge=G.store.getState(),Se=ge.selectedKeys,Me=oe.key;Ee.multiple?Se=Se.concat([Me]):Se=[Me],"selectedKeys"in Ee||G.store.setState({selectedKeys:Se}),Ee.onSelect(Object(F.a)(Object(F.a)({},oe),{},{selectedKeys:Se}))}},G.onClick=function(oe){var se=G.getRealMenuMode(),Ee=Object(c.a)(G),ge=Ee.store,Se=Ee.props.onOpenChange;se!=="inline"&&!("openKeys"in G.props)&&(ge.setState({openKeys:[]}),Se([])),G.props.onClick(oe)},G.onKeyDown=function(oe,se){G.innerMenu.getWrappedInstance().onKeyDown(oe,se)},G.onOpenChange=function(oe){var se=Object(c.a)(G),Ee=se.props,ge=G.store.getState().openKeys.concat(),Se=!1,Me=function(ze){var tt=!1;if(ze.open)tt=ge.indexOf(ze.key)===-1,tt&&ge.push(ze.key);else{var At=ge.indexOf(ze.key);tt=At!==-1,tt&&ge.splice(At,1)}Se=Se||tt};Array.isArray(oe)?oe.forEach(Me):Me(oe),Se&&("openKeys"in G.props||G.store.setState({openKeys:ge}),Ee.onOpenChange(ge))},G.onDeselect=function(oe){var se=Object(c.a)(G),Ee=se.props;if(Ee.selectable){var ge=G.store.getState().selectedKeys.concat(),Se=oe.key,Me=ge.indexOf(Se);Me!==-1&&ge.splice(Me,1),"selectedKeys"in Ee||G.store.setState({selectedKeys:ge}),Ee.onDeselect(Object(F.a)(Object(F.a)({},oe),{},{selectedKeys:ge}))}},G.onMouseEnter=function(oe){G.restoreModeVerticalFromInline();var se=G.props.onMouseEnter;se&&se(oe)},G.onTransitionEnd=function(oe){var se=oe.propertyName==="width"&&oe.target===oe.currentTarget,Ee=oe.target.className,ge=Object.prototype.toString.call(Ee)==="[object SVGAnimatedString]"?Ee.animVal:Ee,Se=oe.propertyName==="font-size"&&ge.indexOf("anticon")>=0;(se||Se)&&G.restoreModeVerticalFromInline()},G.setInnerMenu=function(oe){G.innerMenu=oe},G.isRootMenu=!0;var ee=ie.defaultSelectedKeys,X=ie.defaultOpenKeys;return"selectedKeys"in ie&&(ee=ie.selectedKeys||[]),"openKeys"in ie&&(X=ie.openKeys||[]),G.store=Object(o.c)({selectedKeys:ee,openKeys:X,activeKey:{"0-menu-":pn(ie,ie.activeKey)}}),G.state={switchingModeFromInline:!1,prevProps:ie,inlineOpenKeys:[],store:G.store},G}return Object(v.a)(ye,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(G){var ee=this.props,X=ee.siderCollapsed,oe=ee.inlineCollapsed,se=ee.onOpenChange;(!G.inlineCollapsed&&oe||!G.siderCollapsed&&X)&&se([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var G=this.props.collapsedWidth,ee=this.store,X=this.prevOpenKeys,oe=this.getInlineCollapsed()&&(G===0||G==="0"||G==="0px");oe?(this.prevOpenKeys=ee.getState().openKeys.concat(),this.store.setState({openKeys:[]})):X&&(this.store.setState({openKeys:X}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var G=this.props.mode,ee=this.state.switchingModeFromInline,X=this.getInlineCollapsed();return ee&&X?"inline":X?"vertical":G}},{key:"getInlineCollapsed",value:function(){var G=this.props,ee=G.inlineCollapsed,X=G.siderCollapsed;return X!==void 0?X:ee}},{key:"restoreModeVerticalFromInline",value:function(){var G=this.state.switchingModeFromInline;G&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var G=Object(F.a)({},Object(E.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),ee=this.getRealMenuMode();return G.className+=" ".concat(G.prefixCls,"-root"),G.direction==="rtl"&&(G.className+=" ".concat(G.prefixCls,"-rtl")),G=Object(F.a)(Object(F.a)({},G),{},{mode:ee,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Fa(this.props,this.state,ee)}),delete G.openAnimation,delete G.openTransitionName,T.createElement(o.a,{store:this.store},T.createElement(Zi,Object(h.a)({},G,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(G,ee){var X=ee.prevProps,oe=ee.store,se=oe.getState(),Ee={},ge={prevProps:G};return X.mode==="inline"&&G.mode!=="inline"&&(ge.switchingModeFromInline=!0),"openKeys"in G?Ee.openKeys=G.openKeys||[]:((G.inlineCollapsed&&!X.inlineCollapsed||G.siderCollapsed&&!X.siderCollapsed)&&(ge.switchingModeFromInline=!0,ge.inlineOpenKeys=se.openKeys,Ee.openKeys=[]),(!G.inlineCollapsed&&X.inlineCollapsed||!G.siderCollapsed&&X.siderCollapsed)&&(Ee.openKeys=ee.inlineOpenKeys,ge.inlineOpenKeys=[])),Object.keys(Ee).length&&oe.setState(Ee),ge}}]),ye}(T.Component);Et.defaultProps={selectable:!0,onClick:Ze,onSelect:Ze,onOpenChange:Ze,onDeselect:Ze,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:T.createElement("span",null,"\xB7\xB7\xB7")};var Mt=Et,St=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(){var ie;return Object(D.a)(this,ye),ie=me.apply(this,arguments),ie.onKeyDown=function(G){var ee=G.keyCode;return ee===p.a.ENTER?(ie.onClick(G),!0):void 0},ie.onMouseLeave=function(G){var ee=ie.props,X=ee.eventKey,oe=ee.onItemHover,se=ee.onMouseLeave;oe({key:X,hover:!1}),se({key:X,domEvent:G})},ie.onMouseEnter=function(G){var ee=ie.props,X=ee.eventKey,oe=ee.onItemHover,se=ee.onMouseEnter;oe({key:X,hover:!0}),se({key:X,domEvent:G})},ie.onClick=function(G){var ee=ie.props,X=ee.eventKey,oe=ee.multiple,se=ee.onClick,Ee=ee.onSelect,ge=ee.onDeselect,Se=ee.isSelected,Me={key:X,keyPath:[X],item:Object(c.a)(ie),domEvent:G};se(Me),oe?Se?ge(Me):Ee(Me):Se||Ee(Me)},ie.saveNode=function(G){ie.node=G},ie}return Object(v.a)(ye,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var G=this.props;G.onDestroy&&G.onDestroy(G.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var G,ee=Object(F.a)({},this.props),X=U()(this.getPrefixCls(),ee.className,(G={},Object(q.a)(G,this.getActiveClassName(),!ee.disabled&&ee.active),Object(q.a)(G,this.getSelectedClassName(),ee.isSelected),Object(q.a)(G,this.getDisabledClassName(),ee.disabled),G)),oe=Object(F.a)(Object(F.a)({},ee.attribute),{},{title:typeof ee.title=="string"?ee.title:void 0,className:X,role:ee.role||"menuitem","aria-disabled":ee.disabled});ee.role==="option"?oe=Object(F.a)(Object(F.a)({},oe),{},{role:"option","aria-selected":ee.isSelected}):(ee.role===null||ee.role==="none")&&(oe.role="none");var se={onClick:ee.disabled?null:this.onClick,onMouseLeave:ee.disabled?null:this.onMouseLeave,onMouseEnter:ee.disabled?null:this.onMouseEnter},Ee=Object(F.a)({},ee.style);ee.mode==="inline"&&(ee.direction==="rtl"?Ee.paddingRight=ee.inlineIndent*ee.level:Ee.paddingLeft=ee.inlineIndent*ee.level),et.forEach(function(Se){return delete ee[Se]}),delete ee.direction;var ge=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(ge=T.createElement(this.props.itemIcon,this.props)),T.createElement("li",Object(h.a)({},Object(E.a)(ee,["onClick","onMouseEnter","onMouseLeave","onSelect"]),oe,se,{style:Ee,ref:this.saveNode}),ee.children,ge)}}]),ye}(T.Component);St.isMenuItem=!0,St.defaultProps={onSelect:Ze,onMouseEnter:Ze,onMouseLeave:Ze,manualRef:Ze};var Wt=Object(o.b)(function(te,me){var ye=te.activeKey,ie=te.selectedKeys,G=me.eventKey,ee=me.subMenuKey;return{active:ye[ee]===G,isSelected:Array.isArray(ie)?ie.indexOf(G)!==-1:ie===G}})(St),qt=Wt,sr=function(te){Object(f.a)(ye,te);var me=Object(d.a)(ye);function ye(){var ie;return Object(D.a)(this,ye),ie=me.apply(this,arguments),ie.renderInnerMenuItem=function(G){var ee=ie.props,X=ee.renderMenuItem,oe=ee.index;return X(G,oe,ie.props.subMenuKey)},ie}return Object(v.a)(ye,[{key:"render",value:function(){var G=Object(h.a)({},this.props),ee=G.className,X=ee===void 0?"":ee,oe=G.rootPrefixCls,se="".concat(oe,"-item-group-title"),Ee="".concat(oe,"-item-group-list"),ge=G.title,Se=G.children;return et.forEach(function(Me){return delete G[Me]}),delete G.direction,T.createElement("li",Object(h.a)({},G,{onClick:function(Ge){return Ge.stopPropagation()},className:"".concat(X," ").concat(oe,"-item-group")}),T.createElement("div",{className:se,title:typeof ge=="string"?ge:void 0},ge),T.createElement("ul",{className:Ee},T.Children.map(Se,this.renderInnerMenuItem)))}}]),ye}(T.Component);sr.isMenuItemGroup=!0,sr.defaultProps={disabled:!0};var $t=sr,Dr=function(me){var ye=me.className,ie=me.rootPrefixCls,G=me.style;return T.createElement("li",{className:"".concat(ye," ").concat(ie,"-item-divider"),style:G})};Dr.defaultProps={disabled:!0,className:"",style:{}};var nn=Dr,Ht=Mt,Hn=Z("eDIo");function ir(te,me){var ye=te.prefixCls,ie=te.editable,G=te.locale,ee=te.style;return!ie||ie.showAdd===!1?null:T.createElement("button",{ref:me,type:"button",className:"".concat(ye,"-nav-add"),style:ee,"aria-label":(G==null?void 0:G.addAriaLabel)||"Add tab",onClick:function(oe){ie.onEdit("add",{event:oe})}},ie.addIcon||"+")}var Vr=T.forwardRef(ir);function Hr(te,me){var ye=te.prefixCls,ie=te.id,G=te.tabs,ee=te.locale,X=te.mobile,oe=te.moreIcon,se=oe===void 0?"More":oe,Ee=te.moreTransitionName,ge=te.style,Se=te.className,Me=te.editable,Ge=te.tabBarGutter,ze=te.rtl,tt=te.onTabClick,At=Object(T.useState)(!1),Bt=Object(K.a)(At,2),kt=Bt[0],Nt=Bt[1],jt=Object(T.useState)(null),Ft=Object(K.a)(jt,2),Ut=Ft[0],Qt=Ft[1],zt="".concat(ie,"-more-popup"),gr="".concat(ye,"-dropdown"),Gt=Ut!==null?"".concat(zt,"-").concat(Ut):null,Ot=ee==null?void 0:ee.dropdownAriaLabel,wt=T.createElement(Ht,{onClick:function(cr){var ur=cr.key,Lr=cr.domEvent;tt(ur,Lr),Nt(!1)},id:zt,tabIndex:-1,role:"listbox","aria-activedescendant":Gt,selectedKeys:[Ut],"aria-label":Ot!==void 0?Ot:"expanded dropdown"},G.map(function(rr){return T.createElement(qt,{key:rr.key,id:"".concat(zt,"-").concat(rr.key),role:"option","aria-controls":ie&&"".concat(ie,"-panel-").concat(rr.key),disabled:rr.disabled},rr.tab)}));function Vt(rr){for(var cr=G.filter(function(Zr){return!Zr.disabled}),ur=cr.findIndex(function(Zr){return Zr.key===Ut})||0,Lr=cr.length,Nr=0;Nr<Lr;Nr+=1){ur=(ur+rr+Lr)%Lr;var xr=cr[ur];if(!xr.disabled){Qt(xr.key);return}}}function Jt(rr){var cr=rr.which;if(!kt){[p.a.DOWN,p.a.SPACE,p.a.ENTER].includes(cr)&&(Nt(!0),rr.preventDefault());return}switch(cr){case p.a.UP:Vt(-1),rr.preventDefault();break;case p.a.DOWN:Vt(1),rr.preventDefault();break;case p.a.ESC:Nt(!1);break;case p.a.SPACE:case p.a.ENTER:Ut!==null&&tt(Ut,rr);break}}Object(T.useEffect)(function(){var rr=document.getElementById(Gt);rr&&rr.scrollIntoView&&rr.scrollIntoView(!1)},[Ut]),Object(T.useEffect)(function(){kt||Qt(null)},[kt]);var yt=Object(q.a)({},ze?"marginLeft":"marginRight",Ge);G.length||(yt.visibility="hidden",yt.order=1);var er=U()(Object(q.a)({},"".concat(gr,"-rtl"),ze)),yr=X?null:T.createElement(Hn.a,{prefixCls:gr,overlay:wt,trigger:["hover"],visible:kt,transitionName:Ee,onVisibleChange:Nt,overlayClassName:er,mouseEnterDelay:.1,mouseLeaveDelay:.1},T.createElement("button",{type:"button",className:"".concat(ye,"-nav-more"),style:yt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":zt,id:"".concat(ie,"-more"),"aria-expanded":kt,onKeyDown:Jt},se));return T.createElement("div",{className:U()("".concat(ye,"-nav-operations"),Se),style:ge,ref:me},yr,T.createElement(Vr,{prefixCls:ye,locale:ee,editable:Me}))}var Tn=T.forwardRef(Hr),Ba=Object(T.createContext)(null),Ho=.1,_i=.01,Ar=20,vo=Math.pow(.995,Ar);function go(){var te=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(te)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(te.substr(0,4)))}function qi(te,me){var ye=Object(T.useState)(),ie=Object(K.a)(ye,2),G=ie[0],ee=ie[1],X=Object(T.useState)(0),oe=Object(K.a)(X,2),se=oe[0],Ee=oe[1],ge=Object(T.useState)(0),Se=Object(K.a)(ge,2),Me=Se[0],Ge=Se[1],ze=Object(T.useState)(),tt=Object(K.a)(ze,2),At=tt[0],Bt=tt[1],kt=Object(T.useRef)();function Nt(Ot){var wt=Ot.touches[0],Vt=wt.screenX,Jt=wt.screenY;ee({x:Vt,y:Jt}),window.clearInterval(kt.current)}function jt(Ot){if(!G)return;Ot.preventDefault();var wt=Ot.touches[0],Vt=wt.screenX,Jt=wt.screenY;ee({x:Vt,y:Jt});var yt=Vt-G.x,er=Jt-G.y;me(yt,er);var yr=Date.now();Ee(yr),Ge(yr-se),Bt({x:yt,y:er})}function Ft(){if(!G)return;if(ee(null),Bt(null),At){var Ot=At.x/Me,wt=At.y/Me,Vt=Math.abs(Ot),Jt=Math.abs(wt);if(Math.max(Vt,Jt)<Ho)return;var yt=Ot,er=wt;kt.current=window.setInterval(function(){if(Math.abs(yt)<_i&&Math.abs(er)<_i){window.clearInterval(kt.current);return}yt*=vo,er*=vo,me(yt*Ar,er*Ar)},Ar)}}var Ut=Object(T.useRef)(0),Qt=Object(T.useRef)(!1),zt=Object(T.useRef)();function gr(Ot){var wt=Ot.deltaX,Vt=Ot.deltaY,Jt=0,yt=Math.abs(wt),er=Math.abs(Vt);yt===er?Jt=zt.current==="x"?wt:Vt:yt>er?(Jt=wt,zt.current="x"):(Jt=Vt,zt.current="y");var yr=Date.now();yr-Ut.current>100&&(Qt.current=!1),(me(-Jt,-Jt)||Qt.current)&&(Ot.preventDefault(),Qt.current=!0),Ut.current=yr}var Gt=Object(T.useRef)(null);Gt.current={onTouchStart:Nt,onTouchMove:jt,onTouchEnd:Ft,onWheel:gr},T.useEffect(function(){function Ot(yt){Gt.current.onTouchStart(yt)}function wt(yt){Gt.current.onTouchMove(yt)}function Vt(yt){Gt.current.onTouchEnd(yt)}function Jt(yt){Gt.current.onWheel(yt)}return document.addEventListener("touchmove",wt,{passive:!1}),document.addEventListener("touchend",Vt,{passive:!1}),te.current.addEventListener("touchstart",Ot,{passive:!1}),te.current.addEventListener("wheel",Jt),function(){document.removeEventListener("touchmove",wt),document.removeEventListener("touchend",Vt)}},[])}function zo(){var te=Object(T.useRef)(new Map);function me(ie){return te.current.has(ie)||te.current.set(ie,T.createRef()),te.current.get(ie)}function ye(ie){te.current.delete(ie)}return[me,ye]}function ja(te,me){var ye=T.useRef(te),ie=T.useState({}),G=Object(K.a)(ie,2),ee=G[1];function X(oe){var se=typeof oe=="function"?oe(ye.current):oe;se!==ye.current&&me(se,ye.current),ye.current=se,ee({})}return[ye.current,X]}var yo=function(me){var ye=me.position,ie=me.prefixCls,G=me.extra;if(!G)return null;var ee,X=G;return ye==="right"&&(ee=X.right||!X.left&&X||null),ye==="left"&&(ee=X.left||null),ee?T.createElement("div",{className:"".concat(ie,"-extra-content")},ee):null};function Wa(te,me){var ye,ie=T.useContext(Ba),G=ie.prefixCls,ee=ie.tabs,X=te.className,oe=te.style,se=te.id,Ee=te.animated,ge=te.activeKey,Se=te.rtl,Me=te.extra,Ge=te.editable,ze=te.locale,tt=te.tabPosition,At=te.tabBarGutter,Bt=te.children,kt=te.onTabClick,Nt=te.onTabScroll,jt=Object(T.useRef)(),Ft=Object(T.useRef)(),Ut=Object(T.useRef)(),Qt=Object(T.useRef)(),zt=zo(),gr=Object(K.a)(zt,2),Gt=gr[0],Ot=gr[1],wt=tt==="top"||tt==="bottom",Vt=ja(0,function(or,Yt){wt&&Nt&&Nt({direction:or>Yt?"left":"right"})}),Jt=Object(K.a)(Vt,2),yt=Jt[0],er=Jt[1],yr=ja(0,function(or,Yt){!wt&&Nt&&Nt({direction:or>Yt?"top":"bottom"})}),rr=Object(K.a)(yr,2),cr=rr[0],ur=rr[1],Lr=Object(T.useState)(0),Nr=Object(K.a)(Lr,2),xr=Nr[0],Zr=Nr[1],An=Object(T.useState)(0),an=Object(K.a)(An,2),Ur=an[0],mr=an[1],fr=Object(T.useState)(0),Tr=Object(K.a)(fr,2),br=Tr[0],Ln=Tr[1],qn=Object(T.useState)(0),ei=Object(K.a)(qn,2),dr=ei[0],Un=ei[1],ti=Object(T.useState)(null),pr=Object(K.a)(ti,2),lr=pr[0],Fr=pr[1],xo=Object(T.useState)(null),Ga=Object(K.a)(xo,2),ri=Ga[0],Ri=Ga[1],pa=Object(T.useState)(0),Va=Object(K.a)(pa,2),ma=Va[0],Xo=Va[1],Yo=Object(T.useState)(0),To=Object(K.a)(Yo,2),Xa=To[0],Ya=To[1],Pi=C(new Map),ki=Object(K.a)(Pi,2),$o=ki[0],va=ki[1],ea=u(ee,$o,xr),Ii="".concat(G,"-nav-operations-hidden"),Ni=0,_n=0;wt?Se?(Ni=0,_n=Math.max(0,xr-lr)):(Ni=Math.min(0,lr-xr),_n=0):(Ni=Math.min(0,ri-Ur),_n=0);function pi(or){return or<Ni?[Ni,!1]:or>_n?[_n,!1]:[or,!0]}var ni=Object(T.useRef)(),ta=Object(T.useState)(),mi=Object(K.a)(ta,2),ga=mi[0],$a=mi[1];function ya(){$a(Date.now())}function Qa(){window.clearTimeout(ni.current)}qi(jt,function(or,Yt){var Br=!1;function sn(Ui,Gn){Ui(function(ia){var ai=pi(ia+Gn),jr=Object(K.a)(ai,2),xa=jr[0],Za=jr[1];return Br=Za,xa})}if(wt){if(lr>=xr)return Br;sn(er,or)}else{if(ri>=Ur)return Br;sn(ur,Yt)}return Qa(),ya(),Br}),Object(T.useEffect)(function(){return Qa(),ga&&(ni.current=window.setTimeout(function(){$a(0)},100)),Qa},[ga]);function ii(){var or=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ge,Yt=ea.get(or);if(!Yt)return;if(wt){var Br=yt;Se?Yt.right<yt?Br=Yt.right:Yt.right+Yt.width>yt+lr&&(Br=Yt.right+Yt.width-lr):Yt.left<-yt?Br=-Yt.left:Yt.left+Yt.width>-yt+lr&&(Br=-(Yt.left+Yt.width-lr)),ur(0),er(pi(Br)[0])}else{var sn=cr;Yt.top<-cr?sn=-Yt.top:Yt.top+Yt.height>-cr+ri&&(sn=-(Yt.top+Yt.height-ri)),er(0),ur(pi(sn)[0])}}var vi=m(ea,{width:lr,height:ri,left:yt,top:cr},{width:br,height:dr},{width:ma,height:Xa},Object(F.a)(Object(F.a)({},te),{},{tabs:ee})),So=Object(K.a)(vi,2),Qo=So[0],Jo=So[1],Zo=ee.map(function(or){var Yt=or.key;return T.createElement(a,{id:se,prefixCls:G,key:Yt,rtl:Se,tab:or,closable:or.closable,editable:Ge,active:Yt===ge,tabPosition:tt,tabBarGutter:At,renderWrapper:Bt,removeAriaLabel:ze==null?void 0:ze.removeAriaLabel,ref:Gt(Yt),onClick:function(sn){kt(Yt,sn)},onRemove:function(){Ot(Yt)},onFocus:function(){ii(Yt),ya(),Se||(jt.current.scrollLeft=0),jt.current.scrollTop=0}})}),Ja=O(function(){var or,Yt,Br,sn,Ui,Gn,ia,ai,jr,xa=((or=jt.current)===null||or===void 0?void 0:or.offsetWidth)||0,Za=((Yt=jt.current)===null||Yt===void 0?void 0:Yt.offsetHeight)||0,qa=((Br=Qt.current)===null||Br===void 0?void 0:Br.offsetWidth)||0,ln=((sn=Qt.current)===null||sn===void 0?void 0:sn.offsetHeight)||0,ar=((Ui=Ut.current)===null||Ui===void 0?void 0:Ui.offsetWidth)||0,Rn=((Gn=Ut.current)===null||Gn===void 0?void 0:Gn.offsetHeight)||0;Fr(xa),Ri(Za),Xo(qa),Ya(ln);var Vn=(((ia=Ft.current)===null||ia===void 0?void 0:ia.offsetWidth)||0)-qa,Xn=(((ai=Ft.current)===null||ai===void 0?void 0:ai.offsetHeight)||0)-ln;Zr(Vn),mr(Xn);var eo=(jr=Ut.current)===null||jr===void 0?void 0:jr.className.includes(Ii);Ln(Vn-(eo?0:ar)),Un(Xn-(eo?0:Rn)),va(function(){var Ta=new Map;return ee.forEach(function(Ao){var Lo=Ao.key,yi=Gt(Lo).current;yi&&Ta.set(Lo,{width:yi.offsetWidth,height:yi.offsetHeight,left:yi.offsetLeft,top:yi.offsetTop})}),Ta})}),qo=ee.slice(0,Qo),on=ee.slice(Jo+1),Mr=[].concat(Object(_.a)(qo),Object(_.a)(on)),Xr=Object(T.useState)(),Rr=Object(K.a)(Xr,2),ra=Rr[0],es=Rr[1],Mn=ea.get(ge),wo=Object(T.useRef)();function Co(){w.a.cancel(wo.current)}Object(T.useEffect)(function(){var or={};return Mn&&(wt?(Se?or.right=Mn.right:or.left=Mn.left,or.width=Mn.width):(or.top=Mn.top,or.height=Mn.height)),Co(),wo.current=w()(function(){es(or)}),Co},[Mn,wt,Se]),Object(T.useEffect)(function(){ii()},[ge,Mn,ea,wt]),Object(T.useEffect)(function(){Ja()},[Se,At,ge,ee.map(function(or){return or.key}).join("_")]);var Oo=!!Mr.length,gi="".concat(G,"-nav-wrap"),ba,na,Do,Ea;return wt?Se?(na=yt>0,ba=yt+lr<xr):(ba=yt<0,na=-yt+lr<xr):(Do=cr<0,Ea=-cr+ri<Ur),T.createElement("div",{ref:me,role:"tablist",className:U()("".concat(G,"-nav"),X),style:oe,onKeyDown:function(){ya()}},T.createElement(yo,{position:"left",extra:Me,prefixCls:G}),T.createElement(L.a,{onResize:Ja},T.createElement("div",{className:U()(gi,(ye={},Object(q.a)(ye,"".concat(gi,"-ping-left"),ba),Object(q.a)(ye,"".concat(gi,"-ping-right"),na),Object(q.a)(ye,"".concat(gi,"-ping-top"),Do),Object(q.a)(ye,"".concat(gi,"-ping-bottom"),Ea),ye)),ref:jt},T.createElement(L.a,{onResize:Ja},T.createElement("div",{ref:Ft,className:"".concat(G,"-nav-list"),style:{transform:"translate(".concat(yt,"px, ").concat(cr,"px)"),transition:ga?"none":void 0}},Zo,T.createElement(Vr,{ref:Qt,prefixCls:G,locale:ze,editable:Ge,style:{visibility:Oo?"hidden":null}}),T.createElement("div",{className:U()("".concat(G,"-ink-bar"),Object(q.a)({},"".concat(G,"-ink-bar-animated"),Ee.inkBar)),style:ra}))))),T.createElement(Tn,Object.assign({},te,{ref:Ut,prefixCls:G,tabs:Mr,className:!Oo&&Ii})),T.createElement(yo,{position:"right",extra:Me,prefixCls:G}))}var Ka=T.forwardRef(Wa);function Go(te){var me=te.id,ye=te.activeKey,ie=te.animated,G=te.tabPosition,ee=te.rtl,X=te.destroyInactiveTabPane,oe=T.useContext(Ba),se=oe.prefixCls,Ee=oe.tabs,ge=ie.tabPane,Se=Ee.findIndex(function(Me){return Me.key===ye});return T.createElement("div",{className:U()("".concat(se,"-content-holder"))},T.createElement("div",{className:U()("".concat(se,"-content"),"".concat(se,"-content-").concat(G),Object(q.a)({},"".concat(se,"-content-animated"),ge)),style:Se&&ge?Object(q.a)({},ee?"marginRight":"marginLeft","-".concat(Se,"00%")):null},Ee.map(function(Me){return T.cloneElement(Me.node,{key:Me.key,prefixCls:se,tabKey:Me.key,id:me,animated:ge,active:Me.key===ye,destroyInactiveTabPane:X})})))}function bo(te){var me=te.prefixCls,ye=te.forceRender,ie=te.className,G=te.style,ee=te.id,X=te.active,oe=te.animated,se=te.destroyInactiveTabPane,Ee=te.tabKey,ge=te.children,Se=T.useState(ye),Me=Object(K.a)(Se,2),Ge=Me[0],ze=Me[1];T.useEffect(function(){X?ze(!0):se&&ze(!1)},[X,se]);var tt={};return X||(oe?(tt.visibility="hidden",tt.height=0,tt.overflowY="hidden"):tt.display="none"),T.createElement("div",{id:ee&&"".concat(ee,"-panel-").concat(Ee),role:"tabpanel",tabIndex:X?0:-1,"aria-labelledby":ee&&"".concat(ee,"-tab-").concat(Ee),"aria-hidden":!X,style:Object(F.a)(Object(F.a)({},tt),G),className:U()("".concat(me,"-tabpane"),X&&"".concat(me,"-tabpane-active"),ie)},(X||Ge||ye)&&ge)}var Ha=0;function Eo(te){return Object(I.a)(te).map(function(me){if(T.isValidElement(me)){var ye=me.key!==void 0?String(me.key):void 0;return Object(F.a)(Object(F.a)({key:ye},me.props),{},{node:me})}return null}).filter(function(me){return me})}function Vo(te,me){var ye,ie=te.id,G=te.prefixCls,ee=G===void 0?"rc-tabs":G,X=te.className,oe=te.children,se=te.direction,Ee=te.activeKey,ge=te.defaultActiveKey,Se=te.editable,Me=te.animated,Ge=te.tabPosition,ze=Ge===void 0?"top":Ge,tt=te.tabBarGutter,At=te.tabBarStyle,Bt=te.tabBarExtraContent,kt=te.locale,Nt=te.moreIcon,jt=te.moreTransitionName,Ft=te.destroyInactiveTabPane,Ut=te.renderTabBar,Qt=te.onChange,zt=te.onTabClick,gr=te.onTabScroll,Gt=Object(A.a)(te,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Ot=Eo(oe),wt=se==="rtl",Vt;Me===!1?Vt={inkBar:!1,tabPane:!1}:Vt=Object(F.a)({inkBar:!0,tabPane:!1},Me!==!0?Me:null);var Jt=Object(T.useState)(!1),yt=Object(K.a)(Jt,2),er=yt[0],yr=yt[1];Object(T.useEffect)(function(){yr(go())},[]);var rr=Object(R.a)(function(){var dr;return(dr=Ot[0])===null||dr===void 0?void 0:dr.key},{value:Ee,defaultValue:ge}),cr=Object(K.a)(rr,2),ur=cr[0],Lr=cr[1],Nr=Object(T.useState)(function(){return Ot.findIndex(function(dr){return dr.key===ur})}),xr=Object(K.a)(Nr,2),Zr=xr[0],An=xr[1];Object(T.useEffect)(function(){var dr=Ot.findIndex(function(ti){return ti.key===ur});if(dr===-1){var Un;dr=Math.max(0,Math.min(Zr,Ot.length-1)),Lr((Un=Ot[dr])===null||Un===void 0?void 0:Un.key)}An(dr)},[Ot.map(function(dr){return dr.key}).join("_"),ur,Zr]);var an=Object(R.a)(null,{value:ie}),Ur=Object(K.a)(an,2),mr=Ur[0],fr=Ur[1],Tr=ze;er&&!["left","right"].includes(ze)&&(Tr="top"),Object(T.useEffect)(function(){ie||(fr("rc-tabs-".concat(Ha)),Ha+=1)},[]);function br(dr,Un){zt==null||zt(dr,Un),Lr(dr),Qt==null||Qt(dr)}var Ln={id:mr,activeKey:ur,animated:Vt,tabPosition:Tr,rtl:wt,mobile:er},qn,ei=Object(F.a)(Object(F.a)({},Ln),{},{editable:Se,locale:kt,moreIcon:Nt,moreTransitionName:jt,tabBarGutter:tt,onTabClick:br,onTabScroll:gr,extra:Bt,style:At,panes:oe});return Ut?qn=Ut(ei,Ka):qn=T.createElement(Ka,Object.assign({},ei)),T.createElement(Ba.Provider,{value:{tabs:Ot,prefixCls:ee}},T.createElement("div",Object.assign({ref:me,id:ie,className:U()(ee,"".concat(ee,"-").concat(Tr),(ye={},Object(q.a)(ye,"".concat(ee,"-mobile"),er),Object(q.a)(ye,"".concat(ee,"-editable"),Se),Object(q.a)(ye,"".concat(ee,"-rtl"),wt),ye),X)},Gt),qn,T.createElement(Go,Object.assign({destroyInactiveTabPane:Ft},Ln,{animated:Vt}))))}var Mi=T.forwardRef(Vo);Mi.TabPane=bo;var zn=Mi,za=at.b=zn},kSUc:function(Dt,at,Z){},lZu9:function(Dt,at,Z){(function(q){q(Z("VrN/"),Z("1eCo"),Z("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(K,A){var F=q.getMode(K,"text/html"),T=F.name=="null";function M(j){if(q.findModeByName){var N=q.findModeByName(j);N&&(j=N.mime||N.mimes[0])}var Q=q.getMode(K,j);return Q.name=="null"?null:Q}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var U={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 I in U)U.hasOwnProperty(I)&&A.tokenTypeOverrides[I]&&(U[I]=A.tokenTypeOverrides[I]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,w=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,L=/^ {0,3}(?:\={1,}|-{2,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\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(j,N,Q){return N.f=N.inline=Q,Q(j,N)}function u(j,N,Q){return N.f=N.block=Q,Q(j,N)}function b(j){return!j||!/\S/.test(j.string)}function m(j){if(j.linkTitle=!1,j.linkHref=!1,j.linkText=!1,j.em=!1,j.strong=!1,j.strikethrough=!1,j.quote=0,j.indentedCode=!1,j.f==D){var N=T;if(!N){var Q=q.innerMode(F,j.htmlState);N=Q.mode.name=="xml"&&Q.state.tagStart===null&&!Q.state.context&&Q.state.tokenize.isInText}N&&(j.f=d,j.block=h,j.htmlState=null)}return j.trailingSpace=0,j.trailingSpaceNewLine=!1,j.prevLine=j.thisLine,j.thisLine={stream:null},null}function h(j,N){var Q=j.column()===N.indentation,ne=b(N.prevLine.stream),pe=N.indentedCode,xe=N.prevLine.hr,Ie=N.list!==!1,Ae=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var De=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ie)){for(N.list=null;De<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=De-N.listStack[N.listStack.length-1])}var Ce=!ne&&!xe&&!N.prevLine.header&&(!Ie||!pe)&&!N.prevLine.fencedCodeEnd,Oe=(N.list===!1||xe||ne)&&N.indentation<=Ae&&j.match(R),ce=null;if(N.indentationDiff>=4&&(pe||N.prevLine.fencedCodeEnd||N.prevLine.header||ne))return j.skipToEnd(),N.indentedCode=!0,U.code;if(j.eatSpace())return null;if(Q&&N.indentation<=Ae&&(ce=j.match(w))&&ce[1].length<=6)return N.quote=0,N.header=ce[1].length,N.thisLine.header=!0,A.highlightFormatting&&(N.formatting="header"),N.f=N.inline,c(N);if(N.indentation<=Ae&&j.eat(">"))return N.quote=Q?1:N.quote+1,A.highlightFormatting&&(N.formatting="quote"),j.eatSpace(),c(N);if(!Oe&&!N.setext&&Q&&N.indentation<=Ae&&(ce=j.match(_))){var fe=ce[1]?"ol":"ul";return N.indentation=De+j.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,A.taskLists&&j.match(y,!1)&&(N.taskList=!0),N.f=N.inline,A.highlightFormatting&&(N.formatting=["list","list-"+fe]),c(N)}else{if(Q&&N.indentation<=Ae&&(ce=j.match(C,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ce[1]+"+ *$"),N.localMode=A.fencedCodeBlockHighlighting&&M(ce[2]||A.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=q.startState(N.localMode)),N.f=N.block=v,A.highlightFormatting&&(N.formatting="code-block"),N.code=-1,c(N);if(N.setext||(!Ce||!Ie)&&!N.quote&&N.list===!1&&!N.code&&!Oe&&!p.test(j.string)&&(ce=j.lookAhead(1))&&(ce=ce.match(L)))return N.setext?(N.header=N.setext,N.setext=0,j.skipToEnd(),A.highlightFormatting&&(N.formatting="header")):(N.header=ce[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,c(N);if(Oe)return j.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,U.hr;if(j.peek()==="[")return s(j,N,P)}return s(j,N,N.inline)}function D(j,N){var Q=F.token(j,N.htmlState);if(!T){var ne=q.innerMode(F,N.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||N.md_inside&&j.current().indexOf(">")>-1)&&(N.f=d,N.block=h,N.htmlState=null)}return Q}function v(j,N){var Q=N.listStack[N.listStack.length-1]||0,ne=N.indentation<Q,pe=Q+3;if(N.fencedEndRE&&N.indentation<=pe&&(ne||j.match(N.fencedEndRE))){A.highlightFormatting&&(N.formatting="code-block");var xe;return ne||(xe=c(N)),N.localMode=N.localState=null,N.block=h,N.f=d,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ne?u(j,N,N.block):xe}else return N.localMode?N.localMode.token(j,N.localState):(j.skipToEnd(),U.code)}function c(j){var N=[];if(j.formatting){N.push(U.formatting),typeof j.formatting=="string"&&(j.formatting=[j.formatting]);for(var Q=0;Q<j.formatting.length;Q++)N.push(U.formatting+"-"+j.formatting[Q]),j.formatting[Q]==="header"&&N.push(U.formatting+"-"+j.formatting[Q]+"-"+j.header),j.formatting[Q]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?N.push(U.formatting+"-"+j.formatting[Q]+"-"+j.quote):N.push("error"))}if(j.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(j.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(j.linkHref?N.push(U.linkHref,"url"):(j.strong&&N.push(U.strong),j.em&&N.push(U.em),j.strikethrough&&N.push(U.strikethrough),j.emoji&&N.push(U.emoji),j.linkText&&N.push(U.linkText),j.code&&N.push(U.code),j.image&&N.push(U.image),j.imageAltText&&N.push(U.imageAltText,"link"),j.imageMarker&&N.push(U.imageMarker)),j.header&&N.push(U.header,U.header+"-"+j.header),j.quote&&(N.push(U.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?N.push(U.quote+"-"+j.quote):N.push(U.quote+"-"+A.maxBlockquoteDepth)),j.list!==!1){var ne=(j.listStack.length-1)%3;ne?ne===1?N.push(U.list2):N.push(U.list3):N.push(U.list1)}return j.trailingSpaceNewLine?N.push("trailing-space-new-line"):j.trailingSpace&&N.push("trailing-space-"+(j.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function f(j,N){return j.match(O,!0)?c(N):void 0}function d(j,N){var Q=N.text(j,N);if(typeof Q!="undefined")return Q;if(N.list)return N.list=null,c(N);if(N.taskList){var ne=j.match(y,!0)[1]===" ";return ne?N.taskOpen=!0:N.taskClosed=!0,A.highlightFormatting&&(N.formatting="task"),N.taskList=!1,c(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&j.match(/^#+$/,!0))return A.highlightFormatting&&(N.formatting="header"),c(N);var pe=j.next();if(N.linkTitle){N.linkTitle=!1;var xe=pe;pe==="("&&(xe=")"),xe=(xe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ie="^\\s*(?:[^"+xe+"\\\\]+|\\\\\\\\|\\\\.)"+xe;if(j.match(new RegExp(Ie),!0))return U.linkHref}if(pe==="`"){var Ae=N.formatting;A.highlightFormatting&&(N.formatting="code"),j.eatWhile("`");var De=j.current().length;if(N.code==0&&(!N.quote||De==1))return N.code=De,c(N);if(De==N.code){var Ce=c(N);return N.code=0,Ce}else return N.formatting=Ae,c(N)}else if(N.code)return c(N);if(pe==="\\"&&(j.next(),A.highlightFormatting)){var Oe=c(N),ce=U.formatting+"-escape";return Oe?Oe+" "+ce:ce}if(pe==="!"&&j.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,A.highlightFormatting&&(N.formatting="image"),c(N);if(pe==="["&&N.imageMarker&&j.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,A.highlightFormatting&&(N.formatting="image"),c(N);if(pe==="]"&&N.imageAltText){A.highlightFormatting&&(N.formatting="image");var Oe=c(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=E,Oe}if(pe==="["&&!N.image)return N.linkText&&j.match(/^.*?\]/)||(N.linkText=!0,A.highlightFormatting&&(N.formatting="link")),c(N);if(pe==="]"&&N.linkText){A.highlightFormatting&&(N.formatting="link");var Oe=c(N);return N.linkText=!1,N.inline=N.f=j.match(/\(.*?\)| ?\[.*?\]/,!1)?E:d,Oe}if(pe==="<"&&j.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,A.highlightFormatting&&(N.formatting="link");var Oe=c(N);return Oe?Oe+=" ":Oe="",Oe+U.linkInline}if(pe==="<"&&j.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,A.highlightFormatting&&(N.formatting="link");var Oe=c(N);return Oe?Oe+=" ":Oe="",Oe+U.linkEmail}if(A.xml&&pe==="<"&&j.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var fe=j.string.indexOf(">",j.pos);if(fe!=-1){var Pe=j.string.substring(j.start,fe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Pe)&&(N.md_inside=!0)}return j.backUp(1),N.htmlState=q.startState(F),u(j,N,D)}if(A.xml&&pe==="<"&&j.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var qe=1,Ve=j.pos==1?" ":j.string.charAt(j.pos-2);qe<3&&j.eat(pe);)qe++;var Ze=j.peek()||" ",ct=!/\s/.test(Ze)&&(!l.test(Ze)||/\s/.test(Ve)||l.test(Ve)),je=!/\s/.test(Ve)&&(!l.test(Ve)||/\s/.test(Ze)||l.test(Ze)),Be=null,Xe=null;if(qe%2&&(!N.em&&ct&&(pe==="*"||!je||l.test(Ve))?Be=!0:N.em==pe&&je&&(pe==="*"||!ct||l.test(Ze))&&(Be=!1)),qe>1&&(!N.strong&&ct&&(pe==="*"||!je||l.test(Ve))?Xe=!0:N.strong==pe&&je&&(pe==="*"||!ct||l.test(Ze))&&(Xe=!1)),Xe!=null||Be!=null){A.highlightFormatting&&(N.formatting=Be==null?"strong":Xe==null?"em":"strong em"),Be===!0&&(N.em=pe),Xe===!0&&(N.strong=pe);var Ce=c(N);return Be===!1&&(N.em=!1),Xe===!1&&(N.strong=!1),Ce}}else if(pe===" "&&(j.eat("*")||j.eat("_"))){if(j.peek()===" ")return c(N);j.backUp(1)}if(A.strikethrough){if(pe==="~"&&j.eatWhile(pe)){if(N.strikethrough){A.highlightFormatting&&(N.formatting="strikethrough");var Ce=c(N);return N.strikethrough=!1,Ce}else if(j.match(/^[^\s]/,!1))return N.strikethrough=!0,A.highlightFormatting&&(N.formatting="strikethrough"),c(N)}else if(pe===" "&&j.match(/^~~/,!0)){if(j.peek()===" ")return c(N);j.backUp(2)}}if(A.emoji&&pe===":"&&j.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,A.highlightFormatting&&(N.formatting="emoji");var et=c(N);return N.emoji=!1,et}return pe===" "&&(j.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),c(N)}function o(j,N){var Q=j.next();if(Q===">"){N.f=N.inline=d,A.highlightFormatting&&(N.formatting="link");var ne=c(N);return ne?ne+=" ":ne="",ne+U.linkInline}return j.match(/^[^>]+/,!0),U.linkInline}function E(j,N){if(j.eatSpace())return null;var Q=j.next();return Q==="("||Q==="["?(N.f=N.inline=S(Q==="("?")":"]"),A.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,c(N)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(j){return function(N,Q){var ne=N.next();if(ne===j){Q.f=Q.inline=d,A.highlightFormatting&&(Q.formatting="link-string");var pe=c(Q);return Q.linkHref=!1,pe}return N.match(g[j]),Q.linkHref=!0,c(Q)}}function P(j,N){return j.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,j.next(),A.highlightFormatting&&(N.formatting="link"),N.linkText=!0,c(N)):s(j,N,d)}function B(j,N){if(j.match(/^\]:/,!0)){N.f=N.inline=H,A.highlightFormatting&&(N.formatting="link");var Q=c(N);return N.linkText=!1,Q}return j.match(/^([^\]\\]|\\.)+/,!0),U.linkText}function H(j,N){return j.eatSpace()?null:(j.match(/^[^\s]+/,!0),j.peek()===void 0?N.linkTitle=!0:j.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=d,U.linkHref+" url")}var Y={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,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(j){return{f:j.f,prevLine:j.prevLine,thisLine:j.thisLine,block:j.block,htmlState:j.htmlState&&q.copyState(F,j.htmlState),indentation:j.indentation,localMode:j.localMode,localState:j.localMode?q.copyState(j.localMode,j.localState):null,inline:j.inline,text:j.text,formatting:!1,linkText:j.linkText,linkTitle:j.linkTitle,linkHref:j.linkHref,code:j.code,em:j.em,strong:j.strong,strikethrough:j.strikethrough,emoji:j.emoji,header:j.header,setext:j.setext,hr:j.hr,taskList:j.taskList,list:j.list,listStack:j.listStack.slice(0),quote:j.quote,indentedCode:j.indentedCode,trailingSpace:j.trailingSpace,trailingSpaceNewLine:j.trailingSpaceNewLine,md_inside:j.md_inside,fencedEndRE:j.fencedEndRE}},token:function(j,N){if(N.formatting=!1,j!=N.thisLine.stream){if(N.header=0,N.hr=!1,j.match(/^\s*$/,!0))return m(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:j},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=D)){var Q=j.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(N.indentation=Q,N.indentationDiff=null,Q>0)return null}}return N.f(j,N)},innerMode:function(j){return j.block==D?{state:j.htmlState,mode:F}:j.localState?{state:j.localState,mode:j.localMode}:{state:j,mode:Y}},indent:function(j,N,Q){return j.block==D&&F.indent?F.indent(j.htmlState,N,Q):j.localState&&j.localMode.indent?j.localMode.indent(j.localState,N,Q):q.Pass},blankLine:m,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Y},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},nuEh:function(Dt,at,Z){"use strict";var q=Z("T2oS"),K=Z("W9HT"),A=Z("cDcd"),F=Z.n(A),T=Z("F8wB"),M=Z.n(T),U=function(R){var _=R.loading;return _?F.a.createElement("div",{className:M.a.loading},F.a.createElement(K.a,null)):F.a.createElement(F.a.Fragment,null)};at.a=U},osHv:function(Dt,at,Z){(function(q){q(Z("VrN/"))})(function(q){"use strict";var K=q.Pos;function A(l,a){return l.line-a.line||l.ch-a.ch}var F="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",T=F+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+F+"]["+T+"]*)","g");function U(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 I(l,a){var s=l.cm.getTokenTypeAt(K(l.line,a));return s&&/\btag\b/.test(s)}function R(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function _(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function y(l){for(;;){var a=l.text.indexOf(">",l.ch);if(a==-1){if(R(l))continue;return}if(!I(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 w(l){for(;;){var a=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(a==-1){if(_(l))continue;return}if(!I(l,a+1)){l.ch=a;continue}M.lastIndex=a,l.ch=a;var s=M.exec(l.text);if(s&&s.index==a)return s}}function L(l){for(;;){M.lastIndex=l.ch;var a=M.exec(l.text);if(!a){if(R(l))continue;return}if(!I(l,a.index+1)){l.ch=a.index+1;continue}return l.ch=a.index+a[0].length,a}}function O(l){for(;;){var a=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(a==-1){if(_(l))continue;return}if(!I(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 C(l,a){for(var s=[];;){var u=L(l),b,m=l.line,h=l.ch-(u?u[0].length:0);if(!u||!(b=y(l)))return;if(b=="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:K(m,h),to:K(l.line,l.ch)}}else s.push(u[2])}}function p(l,a){for(var s=[];;){var u=O(l);if(!u)return;if(u=="selfClose"){w(l);continue}var b=l.line,m=l.ch,h=w(l);if(!h)return;if(h[1])s.push(h[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==h[2]){s.length=D;break}if(D<0&&(!a||a==h[2]))return{tag:h[2],from:K(l.line,l.ch),to:K(b,m)}}}}q.registerHelper("fold","xml",function(l,a){for(var s=new U(l,a.line,0);;){var u=L(s);if(!u||s.line!=a.line)return;var b=y(s);if(!b)return;if(!u[1]&&b!="selfClose"){var m=K(s.line,s.ch),h=C(s,u[2]);return h&&A(h.from,m)>0?{from:m,to:h.from}:null}}}),q.findMatchingTag=function(l,a,s){var u=new U(l,a.line,a.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var b=y(u),m=b&&K(u.line,u.ch),h=b&&w(u);if(!b||!h||A(u,a)>0)return;var D={from:K(u.line,u.ch),to:m,tag:h[2]};return b=="selfClose"?{open:D,close:null,at:"open"}:h[1]?{open:p(u,h[2]),close:D,at:"close"}:(u=new U(l,m.line,m.ch,s),{open:D,close:C(u,h[2]),at:"open"})},q.findEnclosingTag=function(l,a,s,u){for(var b=new U(l,a.line,a.ch,s);;){var m=p(b,u);if(!m)break;var h=new U(l,a.line,a.ch,s),D=C(h,m.tag);if(D)return{open:m,close:D}}},q.scanForClosingTag=function(l,a,s,u){var b=new U(l,a.line,a.ch,u?{from:0,to:u}:null);return C(b,s)}})},p5ED:function(Dt,at,Z){"use strict";var q=Z("+L6B"),K=Z("2/Rp"),A=Z("5Dmo"),F=Z("3S7+"),T=Z("k1fw"),M=Z("tJVT"),U=Z("cDcd"),I=Z.n(U),R=Z("vHTk"),_=Z.n(R),y=Z("yEEn"),w=Z("ZW9T"),L=Z("1vsH");at.a=function(O){var C=O.name,p=O.data,l=O.theme,a=O.type,s=O.filename,u=O.monacoEditor,b=O.className,m=O.style,h=O.close,D=O.onClose,v=O.hasMask,c=Object(U.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(M.a)(c,2),d=f[0],o=f[1],E=Object(U.useState)(""),g=Object(M.a)(E,2),S=g[0],P=g[1],B,H=1024*1024,Y=10*H,j=Object(U.useRef)();a==="office"&&(B=Object(L.V)(p).filesize,B>Y&&(a="other")),s&&(u.filename=s),Object(U.useEffect)(function(){var ne,pe,xe=(ne=document.cookie)===null||ne===void 0||((pe=ne.replace(/\s/g,""))===null||pe===void 0)?void 0:pe.split(";");xe==null||xe.map(function(Ie){var Ae=Ie.split("=");Ae[0]==="_educoder_session"&&P(Ae[1])})},[]);var N=function(){if(p.startsWith("http")||p.startsWith("/")){Q();return}Object(L.z)(s||"educoder",p,s)},Q=function(){Object(L.x)(s||C,p)};return console.log("data:",p,"fileanme:",s," name:",C),I.a.createElement("div",{style:Object(T.a)({},m||{}),className:"".concat(v&&_.a.bgBlack," ").concat(a?_.a.wrp:"hide")},h&&I.a.createElement("div",{className:_.a.close,ref:j},I.a.createElement(F.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return j.current}},I.a.createElement("span",{onClick:Q},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(F.a,{title:"\u5173\u95ED",getPopupContainer:function(){return j.current}},I.a.createElement("span",{className:"",onClick:D},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(_.a[b]," ").concat(b," ").concat(_.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&I.a.createElement(w.b,u)),a==="audio"&&I.a.createElement("audio",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?p:"data:audio/mp3;base64,").concat(p),autoPlay:!0}),a==="video"&&I.a.createElement(I.a.Fragment,null,p!=null&&p.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),a==="html"&&I.a.createElement("iframe",{src:p+"&disposition=inline"}),a==="pdf"&&I.a.createElement("embed",{className:_.a.embed,src:p}),a==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)})),a==="other"&&I.a.createElement("div",null,I.a.createElement(K.a,{type:"primary",size:"large",onClick:N},I.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&I.a.createElement(K.a,{type:"primary",size:"large",onClick:N},I.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Dt,at,Z){},rUJ1:function(Dt,at){const Z=/[&<>"']/,q=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,F={"&":"&","<":"<",">":">",'"':""","'":"'"},T=v=>F[v];function M(v,c){if(c){if(Z.test(v))return v.replace(q,T)}else if(K.test(v))return v.replace(A,T);return v}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(v){return v.replace(U,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const R=/(^|[^\[])\^/g;function _(v,c){v=v.source||v,c=c||"";const f={replace:(d,o)=>(o=o.source||o,o=o.replace(R,"$1"),v=v.replace(d,o),f),getRegex:()=>new RegExp(v,c)};return f}const y=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(v,c,f){if(v){let d;try{d=decodeURIComponent(I(f)).replace(y,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!w.test(f)&&(f=a(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const O={},C=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(v,c){O[" "+v]||(C.test(v)?O[" "+v]=v+"/":O[" "+v]=m(v,"/",!0)),v=O[" "+v];const f=v.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:v.replace(p,"$1")+c:c.charAt(0)==="/"?f?c:v.replace(l,"$1")+c:v+c}const s={exec:function(){}};function u(v){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(v[d]=f[d])}return v}function b(v,c){const f=v.replace(/\|/g,(E,g,S)=>{let P=!1,B=g;for(;--B>=0&&S[B]==="\\";)P=!P;return P?"|":" |"}),d=f.split(/ \|/);let o=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function m(v,c,f){const d=v.length;if(d===0)return"";let o=0;for(;o<d;){const E=v.charAt(d-o-1);if(E===c&&!f)o++;else if(E!==c&&f)o++;else break}return v.substr(0,d-o)}function h(v,c){if(v.indexOf(c[1])===-1)return-1;const f=v.length;let d=0,o=0;for(;o<f;o++)if(v[o]==="\\")o++;else if(v[o]===c[0])d++;else if(v[o]===c[1]&&(d--,d<0))return o;return-1}function D(v){v&&v.sanitize&&!v.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")}Dt.exports={escape:M,unescape:I,edit:_,cleanUrl:L,resolveUrl:a,noopTest:s,merge:u,splitCells:b,rtrim:m,findClosingBracket:h,checkSanitizeDeprecation:D}},t23M:function(Dt,at,Z){"use strict";var q=Z("VTBJ"),K=Z("1OyB"),A=Z("vuIU"),F=Z("Ji7U"),T=Z("LK+K"),M=Z("cDcd"),U=Z.n(M),I=Z("m+aA"),R=Z("Zm9Q"),_=Z("Kwbf"),y=Z("c+Xe"),w=Z("bdgK"),L="rc-observer-key",O=function(C){Object(F.a)(l,C);var p=Object(T.a)(l);function l(){var a;return Object(K.a)(this,l),a=p.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(s){var u=a.props.onResize,b=s[0].target,m=b.getBoundingClientRect(),h=m.width,D=m.height,v=b.offsetWidth,c=b.offsetHeight,f=Math.floor(h),d=Math.floor(D);if(a.state.width!==f||a.state.height!==d||a.state.offsetWidth!==v||a.state.offsetHeight!==c){var o={width:f,height:d,offsetWidth:v,offsetHeight:c};a.setState(o),u&&Promise.resolve().then(function(){u(Object(q.a)(Object(q.a)({},o),{},{offsetWidth:v,offsetHeight:c}))})}},a.setChildNode=function(s){a.childNode=s},a}return Object(A.a)(l,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var s=this.props.disabled;if(s){this.destroyObserver();return}var u=Object(I.a)(this.childNode||this),b=u!==this.currentElement;b&&(this.destroyObserver(),this.currentElement=u),!this.resizeObserver&&u&&(this.resizeObserver=new w.default(this.onResize),this.resizeObserver.observe(u))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var s=this.props.children,u=Object(R.a)(s);if(u.length>1)Object(_.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(u.length===0)return Object(_.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var b=u[0];if(M.isValidElement(b)&&Object(y.c)(b)){var m=b.ref;u[0]=M.cloneElement(b,{ref:Object(y.a)(m,this.setChildNode)})}return u.length===1?u[0]:u.map(function(h,D){return!M.isValidElement(h)||"key"in h&&h.key!==null?h:M.cloneElement(h,{key:"".concat(L,"-").concat(D)})})}}]),l}(M.Component);O.displayName="ResizeObserver",at.a=O},ulZh:function(Dt,at,Z){typeof window!="undefined"&&function(K,A){Dt.exports=A()}(this,function(){return function(q){var K={};function A(F){if(K[F])return K[F].exports;var T=K[F]={i:F,l:!1,exports:{}};return q[F].call(T.exports,T,T.exports,A),T.l=!0,T.exports}return A.m=q,A.c=K,A.d=function(F,T,M){A.o(F,T)||Object.defineProperty(F,T,{enumerable:!0,get:M})},A.r=function(F){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})},A.t=function(F,T){if(T&1&&(F=A(F)),T&8)return F;if(T&4&&typeof F=="object"&&F&&F.__esModule)return F;var M=Object.create(null);if(A.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:F}),T&2&&typeof F!="string")for(var U in F)A.d(M,U,function(I){return F[I]}.bind(null,U));return M},A.n=function(F){var T=F&&F.__esModule?function(){return F.default}:function(){return F};return A.d(T,"a",T),T},A.o=function(F,T){return Object.prototype.hasOwnProperty.call(F,T)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,K,A){"use strict";var F=Object.prototype.hasOwnProperty,T="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(T=!1));function U(y,w,L){this.fn=y,this.context=w,this.once=L||!1}function I(y,w,L,O,C){if(typeof L!="function")throw new TypeError("The listener must be a function");var p=new U(L,O||y,C),l=T?T+w:w;return y._events[l]?y._events[l].fn?y._events[l]=[y._events[l],p]:y._events[l].push(p):(y._events[l]=p,y._eventsCount++),y}function R(y,w){--y._eventsCount===0?y._events=new M:delete y._events[w]}function _(){this._events=new M,this._eventsCount=0}_.prototype.eventNames=function(){var w=[],L,O;if(this._eventsCount===0)return w;for(O in L=this._events)F.call(L,O)&&w.push(T?O.slice(1):O);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(L)):w},_.prototype.listeners=function(w){var L=T?T+w:w,O=this._events[L];if(!O)return[];if(O.fn)return[O.fn];for(var C=0,p=O.length,l=new Array(p);C<p;C++)l[C]=O[C].fn;return l},_.prototype.listenerCount=function(w){var L=T?T+w:w,O=this._events[L];return O?O.fn?1:O.length:0},_.prototype.emit=function(w,L,O,C,p,l){var a=T?T+w:w;if(!this._events[a])return!1;var s=this._events[a],u=arguments.length,b,m;if(s.fn){s.once&&this.removeListener(w,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,L),!0;case 3:return s.fn.call(s.context,L,O),!0;case 4:return s.fn.call(s.context,L,O,C),!0;case 5:return s.fn.call(s.context,L,O,C,p),!0;case 6:return s.fn.call(s.context,L,O,C,p,l),!0}for(m=1,b=new Array(u-1);m<u;m++)b[m-1]=arguments[m];s.fn.apply(s.context,b)}else{var h=s.length,D;for(m=0;m<h;m++){s[m].once&&this.removeListener(w,s[m].fn,void 0,!0);switch(u){case 1:s[m].fn.call(s[m].context);break;case 2:s[m].fn.call(s[m].context,L);break;case 3:s[m].fn.call(s[m].context,L,O);break;case 4:s[m].fn.call(s[m].context,L,O,C);break;default:if(!b)for(D=1,b=new Array(u-1);D<u;D++)b[D-1]=arguments[D];s[m].fn.apply(s[m].context,b)}}}return!0},_.prototype.on=function(w,L,O){return I(this,w,L,O,!1)},_.prototype.once=function(w,L,O){return I(this,w,L,O,!0)},_.prototype.removeListener=function(w,L,O,C){var p=T?T+w:w;if(!this._events[p])return this;if(!L)return R(this,p),this;var l=this._events[p];if(l.fn)l.fn===L&&(!C||l.once)&&(!O||l.context===O)&&R(this,p);else{for(var a=0,s=[],u=l.length;a<u;a++)(l[a].fn!==L||C&&!l[a].once||O&&l[a].context!==O)&&s.push(l[a]);s.length?this._events[p]=s.length===1?s[0]:s:R(this,p)}return this},_.prototype.removeAllListeners=function(w){var L;return w?(L=T?T+w:w,this._events[L]&&R(this,L)):(this._events=new M,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=T,_.EventEmitter=_,q.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,K,A){(function(F){var T=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(_,y,w){if(w=w||{},_=_.trim(),y=y.trim(),!y){if(!w.alwaysNormalize)return _;var L=R.parseURL(_);if(!L)throw new Error("Error trying to parse base URL.");return L.path=R.normalizePath(L.path),R.buildURLFromParts(L)}var O=R.parseURL(y);if(!O)throw new Error("Error trying to parse relative URL.");if(O.scheme)return w.alwaysNormalize?(O.path=R.normalizePath(O.path),R.buildURLFromParts(O)):y;var C=R.parseURL(_);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var p=M.exec(C.path);C.netLoc=p[1],C.path=p[2]}C.netLoc&&!C.path&&(C.path="/");var l={scheme:C.scheme,netLoc:O.netLoc,path:null,params:O.params,query:O.query,fragment:O.fragment};if(!O.netLoc&&(l.netLoc=C.netLoc,O.path[0]!=="/"))if(!O.path)l.path=C.path,O.params||(l.params=C.params,O.query||(l.query=C.query));else{var a=C.path,s=a.substring(0,a.lastIndexOf("/")+1)+O.path;l.path=R.normalizePath(s)}return l.path===null&&(l.path=w.alwaysNormalize?R.normalizePath(O.path):O.path),R.buildURLFromParts(l)},parseURL:function(_){var y=T.exec(_);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(U,"");_.length!==(_=_.replace(I,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};q.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(q,K,A){function F(w){var L={};function O(p){if(L[p])return L[p].exports;var l=L[p]={i:p,l:!1,exports:{}};return w[p].call(l.exports,l,l.exports,O),l.l=!0,l.exports}O.m=w,O.c=L,O.i=function(p){return p},O.d=function(p,l,a){O.o(p,l)||Object.defineProperty(p,l,{configurable:!1,enumerable:!0,get:a})},O.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},O.n=function(p){var l=p&&p.__esModule?function(){return p.default}:function(){return p};return O.d(l,"a",l),l},O.o=function(p,l){return Object.prototype.hasOwnProperty.call(p,l)},O.p="/",O.oe=function(p){throw console.error(p),p};var C=O(O.s=ENTRY_MODULE);return C.default||C}var T="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+T+").*?\\)";function U(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(w){return!isNaN(1*w)}function R(w,L,O){var C={};C[O]=[];var p=L.toString(),l=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return C;for(var a=l[1],s=new RegExp("(\\\\n|\\W)"+U(a)+M,"g"),u;u=s.exec(p);){if(u[3]==="dll-reference")continue;C[O].push(u[3])}for(s=new RegExp("\\("+U(a)+'\\("(dll-reference\\s('+T+'))"\\)\\)'+M,"g");u=s.exec(p);)w[u[2]]||(C[O].push(u[1]),w[u[2]]=A(u[1]).m),C[u[2]]=C[u[2]]||[],C[u[2]].push(u[4]);for(var b=Object.keys(C),m=0;m<b.length;m++)for(var h=0;h<C[b[m]].length;h++)I(C[b[m]][h])&&(C[b[m]][h]=1*C[b[m]][h]);return C}function _(w){var L=Object.keys(w);return L.reduce(function(O,C){return O||w[C].length>0},!1)}function y(w,L){for(var O={main:[L]},C={main:[]},p={main:{}};_(O);)for(var l=Object.keys(O),a=0;a<l.length;a++){var s=l[a],u=O[s],b=u.pop();if(p[s]=p[s]||{},p[s][b]||!w[s][b])continue;p[s][b]=!0,C[s]=C[s]||[],C[s].push(b);for(var m=R(w,w[s][b],s),h=Object.keys(m),D=0;D<h.length;D++)O[h[D]]=O[h[D]]||[],O[h[D]]=O[h[D]].concat(m[h[D]])}return C}q.exports=function(w,L){L=L||{};var O={main:A.m},C=L.all?{main:Object.keys(O.main)}:y(O,w),p="";Object.keys(C).filter(function(b){return b!=="main"}).forEach(function(b){for(var m=0;C[b][m];)m++;C[b].push(m),O[b][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+b+" = ("+F.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+C[b].map(function(h){return""+JSON.stringify(h)+": "+O[b][h].toString()}).join(",")+`});
|
|
`}),p=p+"new (("+F.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+C.main.map(function(b){return""+JSON.stringify(b)+": "+O.main[b].toString()}).join(",")+"}))(self);";var l=new window.Blob([p],{type:"text/javascript"});if(L.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(q,K,A){"use strict";A.r(K),A.d(K,"hlsDefaultConfig",function(){return D}),A.d(K,"mergeConfig",function(){return c}),A.d(K,"enableStreamingMode",function(){return f});var F=A("./src/controller/abr-controller.ts"),T=A("./src/controller/audio-stream-controller.ts"),M=A("./src/controller/audio-track-controller.ts"),U=A("./src/controller/subtitle-stream-controller.ts"),I=A("./src/controller/subtitle-track-controller.ts"),R=A("./src/controller/buffer-controller.ts"),_=A("./src/controller/timeline-controller.ts"),y=A("./src/controller/cap-level-controller.ts"),w=A("./src/controller/fps-controller.ts"),L=A("./src/controller/eme-controller.ts"),O=A("./src/controller/cmcd-controller.ts"),C=A("./src/utils/xhr-loader.ts"),p=A("./src/utils/fetch-loader.ts"),l=A("./src/utils/cues.ts"),a=A("./src/utils/mediakeys-helper.ts"),s=A("./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 g in E)Object.prototype.hasOwnProperty.call(E,g)&&(d[g]=E[g])}return d},u.apply(this,arguments)}function b(d,o){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);o&&(g=g.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),E.push.apply(E,g)}return E}function m(d){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?b(Object(E),!0).forEach(function(g){h(d,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):b(Object(E)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(E,g))})}return d}function h(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=m(m({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:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:F.default,bufferController:R.default,capLevelController:y.default,fpsController:w.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},v()),{},{subtitleStreamController:U.SubtitleStreamController,subtitleTrackController:I.default,timelineController:_.TimelineController,audioStreamController:T.default,audioTrackController:M.default,emeController:L.default,cmcdController:O.default});function v(){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 c(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 f(d){var o=d.loader;if(o!==p.default&&o!==C.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var E=Object(p.fetchSupported)();E&&(d.loader=p.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/polyfills/number.ts"),T=A("./src/utils/ewma-bandwidth-estimator.ts"),M=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/types/loader.ts"),_=A("./src/utils/logger.ts");function y(O,C){for(var p=0;p<C.length;p++){var l=C[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(O,l.key,l)}}function w(O,C,p){return C&&y(O.prototype,C),p&&y(O,p),O}var L=function(){function O(p){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=p;var l=p.config;this.bwEstimator=new T.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var C=O.prototype;return C.registerListeners=function(){var l=this.hls;l.on(M.Events.FRAG_LOADING,this.onFragLoading,this),l.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(M.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var l=this.hls;l.off(M.Events.FRAG_LOADING,this.onFragLoading,this),l.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(M.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(l,a){var s=a.frag;if(s.type===R.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},C.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)},C._abandonRulesCheck=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,b=s.config,m=s.media;if(!l||!m)return;var h=a?a.stats:l.stats,D=a?a.duration:l.duration;if(h.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||m.paused||!m.playbackRate||!m.readyState)return;var v=performance.now()-h.loading.start,c=Math.abs(m.playbackRate);if(v<=500*D/c)return;var f=s.levels,d=s.minAutoLevel,o=f[l.level],E=h.total||Math.max(h.loaded,Math.round(D*o.maxBitrate/8)),g=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/v),S=(E-h.loaded)/g,P=m.currentTime,B=(U.BufferHelper.bufferInfo(m,P,b.maxBufferHole).end-P)/c;if(B>=2*D/c||S<=B)return;var H=Number.POSITIVE_INFINITY,Y;for(Y=l.level-1;Y>d;Y--){var j=f[Y].maxBitrate;if(H=D*j/(8*.8*g),H<B)break}if(H>=S)return;var N=this.bwEstimator.getEstimate();_.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 "+Y+`
|
|
Current BW estimate: `+(Object(F.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+S.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+H.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),s.nextLoadLevel=Y,this.bwEstimator.sample(v,h.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:a,stats:h})},C.onFragLoaded=function(l,a){var s=a.frag,u=a.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(F.isFiniteNumber)(s.sn)){var b=u?u.stats:s.stats,m=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],D=(h.loaded?h.loaded.bytes:0)+b.loaded,v=(h.loaded?h.loaded.duration:0)+m;h.loaded={bytes:D,duration:v},h.realBitrate=Math.round(8*D/v)}if(s.bitrateTest){var c={stats:b,frag:s,part:u,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},C.onFragBuffered=function(l,a){var s=a.frag,u=a.part,b=u?u.stats:s.stats;if(b.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var m=b.parsing.end-b.loading.start;this.bwEstimator.sample(m,b.loaded),b.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},C.onError=function(l,a){switch(a.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var l=this.fragCurrent,a=this.partCurrent,s=this.hls,u=s.maxAutoLevel,b=s.config,m=s.minAutoLevel,h=s.media,D=a?a.duration:l?l.duration:0,v=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():b.abrEwmaDefaultEstimate,d=(U.BufferHelper.bufferInfo(h,v,b.maxBufferHole).end-v)/c,o=this.findBestLevel(f,m,u,d,b.abrBandWidthFactor,b.abrBandWidthUpFactor);if(o>=0)return o;_.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=D?Math.min(D,b.maxStarvationDelay):b.maxStarvationDelay,g=b.abrBandWidthFactor,S=b.abrBandWidthUpFactor;if(!d){var P=this.bitrateTestDelay;if(P){var B=D?Math.min(D,b.maxLoadingDelay):b.maxLoadingDelay;E=B-P,_.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),g=S=1}}return o=this.findBestLevel(f,m,u,d+E,g,S),Math.max(o,0)},C.findBestLevel=function(l,a,s,u,b,m){for(var h,D=this.fragCurrent,v=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],o=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),E=d==null?void 0:d.codecSet,g=v?v.duration:D?D.duration:0,S=s;S>=a;S--){var P=f[S];if(!P||E&&P.codecSet!==E)continue;var B=P.details,H=(v?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||g,Y=void 0;S<=c?Y=b*l:Y=m*l;var j=f[S].maxBitrate,N=j*H/Y;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(Y)+"/"+j+"/"+H+"/"+u+"/"+N),Y>j&&(!N||o&&!this.bitrateTestDelay||N<u))return S}return-1},w(O,[{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}}]),O}();K.default=L},"./src/controller/audio-stream-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/polyfills/number.ts"),T=A("./src/controller/base-stream-controller.ts"),M=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),I=A("./src/controller/fragment-tracker.ts"),R=A("./src/types/level.ts"),_=A("./src/types/loader.ts"),y=A("./src/loader/fragment.ts"),w=A("./src/demux/chunk-cache.ts"),L=A("./src/demux/transmuxer-interface.ts"),O=A("./src/types/transmuxer.ts"),C=A("./src/controller/fragment-finders.ts"),p=A("./src/utils/discontinuities.ts"),l=A("./src/errors.ts"),a=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(D[f]=c[f])}return D},s.apply(this,arguments)}function u(D,v){D.prototype=Object.create(v.prototype),D.prototype.constructor=D,b(D,v)}function b(D,v){return b=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},b(D,v)}var m=100,h=function(D){u(v,D);function v(f,d){var o;return o=D.call(this,f,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 c=v.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(M.Events.ERROR,this.onError,this),d.on(M.Events.BUFFER_RESET,this.onBufferReset,this),d.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(M.Events.ERROR,this.onError,this),d.off(M.Events.BUFFER_RESET,this.onBufferReset,this),d.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,o){var E=o.frag,g=o.id,S=o.initPTS;if(g==="main"){var P=E.cc;this.initPTS[E.cc]=S,this.log("InitPTS for cc: "+P+" found from main: "+S),this.videoTrackCC=P,this.state===T.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=T.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=T.State.IDLE):(this.loadedmetadata=!1,this.state=T.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case T.State.IDLE:this.doTickIdle();break;case T.State.WAITING_TRACK:{var d,o=this.levels,E=this.trackId,g=o==null||((d=o[E])===null||d===void 0)?void 0:d.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=T.State.WAITING_INIT_PTS}break}case T.State.FRAG_LOADING_WAITING_RETRY:{var S,P=performance.now(),B=this.retryDate;(!B||P>=B||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=T.State.IDLE);break}case T.State.WAITING_INIT_PTS:{var H=this.waitingData;if(H){var Y=H.frag,j=H.part,N=H.cache,Q=H.complete;if(this.initPTS[Y.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=T.State.FRAG_LOADING;var ne=N.flush(),pe={frag:Y,part:j,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(pe),Q&&D.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+Y.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var xe=this.getLoadPosition(),Ie=U.BufferHelper.bufferInfo(this.mediaBuffer,xe,this.config.maxBufferHole),Ae=Object(C.fragmentWithinToleranceTest)(Ie.end,this.config.maxFragLookUpTolerance,Y);Ae<0&&(a.logger.log("Waiting fragment cc ("+Y.cc+") @ "+Y.start+" cancelled because another fragment at "+Ie.end+" is needed"),this.clearWaitingFragment())}}else this.state=T.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=T.State.IDLE)},c.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},c.doTickIdle=function(){var d,o,E=this.hls,g=this.levels,S=this.media,P=this.trackId,B=E.config;if(!g||!g[P])return;if(!S&&(this.startFragRequested||!B.startFragPrefetch))return;var H=g[P],Y=H.details;if(!Y||Y.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(Y)){this.state=T.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(j===null)return;var N=j.len,Q=this.getMaxBufferLength(),ne=this.audioSwitch;if(N>=Q&&!ne)return;if(!ne&&this._streamEnded(j,Y)){E.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=T.State.ENDED;return}var pe=Y.fragments,xe=pe[0].start,Ie=j.end;if(ne){var Ae=this.getLoadPosition();Ie=Ae,Y.PTSKnown&&Ae<xe&&((j.end>xe||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=xe+.05))}var De=this.getNextFragment(Ie,Y);if(!De){this.bufferFlushed=!0;return}((d=De.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=De.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(De,Y):this.loadFragment(De,Y,Ie)},c.getMaxBufferLength=function(){var d=D.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},c.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,o){var E=o.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(g){return new R.Level(g)})},c.onAudioTrackSwitching=function(d,o){var E=!!o.url;this.trackId=o.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(m):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=T.State.IDLE):this.state=T.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,o){this.mainDetails=o.details},c.onAudioTrackLoaded=function(d,o){var E,g=this.levels,S=o.details,P=o.id;if(!g){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var B=g[P],H=0;if(S.live||(E=B.details)!==null&&E!==void 0&&E.live){var Y=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!Y)return;!B.details&&S.hasProgramDateTime&&Y.hasProgramDateTime?(Object(p.alignMediaPlaylistByPDT)(S,Y),H=S.fragments[0].start):H=this.alignPlaylists(S,B.details)}B.details=S,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(B.details,H),this.state===T.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=T.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var o,E=d.frag,g=d.part,S=d.payload,P=this.config,B=this.trackId,H=this.levels;if(!H){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 Y=H[B];console.assert(Y,"Audio track is defined on fragment load progress");var j=Y.details;console.assert(j,"Audio track details are defined on fragment load progress");var N=P.defaultAudioCodec||Y.audioCodec||"mp4a.40.2",Q=this.transmuxer;Q||(Q=this.transmuxer=new L.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[E.cc],pe=(o=E.initSegment)===null||o===void 0?void 0:o.data;if(ne!==void 0){var xe=!1,Ie=g?g.index:-1,Ae=Ie!==-1,De=new O.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,S.byteLength,Ie,Ae);Q.push(S,pe,N,"",E,g,j.totalduration,xe,De,ne)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+B);var Ce=this.waitingData=this.waitingData||{frag:E,part:g,cache:new w.default,complete:!1},Oe=Ce.cache;Oe.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=T.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,o){var E=o.tracks.audio;E&&(this.mediaBuffer=E.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},c.onFragBuffered=function(d,o){var E=o.frag,g=o.part;if(E.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(g?" p: "+g.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(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,g)},c.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(_.PlaylistLevelType.AUDIO,o);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==T.State.ERROR&&this.state!==T.State.STOPPED&&(this.state=o.fatal?T.State.ERROR:T.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===T.State.PARSING||this.state===T.State.PARSED)){var E=!0,g=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);g&&g.len>.5&&(E=!this.reduceMaxBufferLength(g.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}},c.onBufferFlushed=function(d,o){var E=o.type;E===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var o,E="audio",g=this.hls,S=d.remuxResult,P=d.chunkMeta,B=this.getCurrentContext(P);if(!B){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var H=B.frag,Y=B.part,j=S.audio,N=S.text,Q=S.id3,ne=S.initSegment;if(this.fragContextChanged(H))return;if(this.state=T.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,H,P),g.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:E,tracks:ne.tracks})),j){var pe=j.startPTS,xe=j.endPTS,Ie=j.startDTS,Ae=j.endDTS;Y&&(Y.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:xe,startDTS:Ie,endDTS:Ae}),H.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,pe,xe,Ie,Ae),this.bufferFragmentData(j,H,Y,P)}if(Q!=null&&(o=Q.samples)!==null&&o!==void 0&&o.length){var De=s({frag:H,id:E},Q);g.trigger(M.Events.FRAG_PARSING_METADATA,De)}if(N){var Ce=s({frag:H,id:E},N);g.trigger(M.Events.FRAG_PARSING_USERDATA,Ce)}},c._bufferInitSegment=function(d,o,E){if(this.state!==T.State.PARSING)return;d.video&&delete d.video;var g=d.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,d);var S=g.initSegment;if(S!=null&&S.byteLength){var P={type:"audio",frag:o,part:null,chunkMeta:E,parent:o.type,data:S};this.hls.trigger(M.Events.BUFFER_APPENDING,P)}this.tick()},c.loadFragment=function(d,o,E){var g=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(F.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=T.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,d,o,E)))},c.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(M.Events.AUDIO_TRACK_SWITCHED,{id:E})},v}(T.default);K.default=h},"./src/controller/audio-track-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts"),T=A("./src/errors.ts"),M=A("./src/controller/base-playlist-controller.ts"),U=A("./src/types/loader.ts");function I(L,O){for(var C=0;C<O.length;C++){var p=O[C];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(L,p.key,p)}}function R(L,O,C){return O&&I(L.prototype,O),C&&I(L,C),L}function _(L,O){L.prototype=Object.create(O.prototype),L.prototype.constructor=L,y(L,O)}function y(L,O){return y=Object.setPrototypeOf||function(p,l){return p.__proto__=l,p},y(L,O)}var w=function(L){_(O,L);function O(p){var l;return l=L.call(this,p,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var C=O.prototype;return C.registerListeners=function(){var l=this.hls;l.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(F.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(F.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var l=this.hls;l.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(F.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(F.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(F.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,L.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(l,a){this.tracks=a.audioTracks||[]},C.onAudioTrackLoaded=function(l,a){var s=a.id,u=a.details,b=this.tracksInGroup[s];if(!b){this.warn("Invalid audio track id "+s);return}var m=b.details;b.details=a.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,m))},C.onLevelLoading=function(l,a){this.switchLevel(a.level)},C.onLevelSwitching=function(l,a){this.switchLevel(a.level)},C.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(m){return!s||m.groupId===s});this.selectDefaultTrack&&!u.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var b={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(F.Events.AUDIO_TRACKS_UPDATED,b),this.selectInitialTrack()}},C.onError=function(l,a){if(L.prototype.onError.call(this,l,a),a.fatal||!a.context)return;a.context.type===U.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},C.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],b=u.id,m=u.groupId,h=m===void 0?"":m,D=u.name,v=u.type,c=u.url;if(this.trackId=l,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHING,{id:b,groupId:h,name:D,type:v,url:c}),u.details&&!u.details.live)return;var f=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(f)},C.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(F.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.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},C.loadPlaylist=function(l){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,u=a.groupId,b=a.url;if(l)try{b=l.addDirectives(b)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(F.Events.AUDIO_TRACK_LOADING,{url:b,id:s,groupId:u,deliveryDirectives:l||null})}},R(O,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),O}(M.default);K.default=w},"./src/controller/base-playlist-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var F=A("./src/polyfills/number.ts"),T=A("./src/types/level.ts"),M=A("./src/controller/level-helper.ts"),U=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),R=function(){function _(w,L){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=U.logger.log.bind(U.logger,L+":"),this.warn=U.logger.warn.bind(U.logger,L+":"),this.hls=w}var y=_.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(L,O){O.fatal&&O.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(L,O){var C=O==null?void 0:O.renditionReports;if(C)for(var p=0;p<C.length;p++){var l=C[p],a=""+l.URI;if(a===L.substr(-a.length)){var s=parseInt(l["LAST-MSN"]),u=parseInt(l["LAST-PART"]);if(O&&this.hls.config.lowLatencyMode){var b=Math.min(O.age-O.partTarget,O.targetduration);u!==void 0&&b>O.partTarget&&(u+=1)}if(Object(F.isFiniteNumber)(s))return new T.HlsUrlParameters(s,Object(F.isFiniteNumber)(u)?u:void 0,T.HlsSkip.No)}}},y.loadPlaylist=function(L){},y.shouldLoadTrack=function(L){return this.canLoad&&L&&!!L.url&&(!L.details||L.details.live)},y.playlistLoaded=function(L,O,C){var p=this,l=O.details,a=O.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||C!=null&&C.live){if(l.reloaded(C),C&&this.log("live playlist "+L+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),C&&l.fragments.length>0&&Object(M.mergeDetails)(C,l),!this.canLoad||!l.live)return;var u,b=void 0,m=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var h=this.hls.config.lowLatencyMode,D=l.lastPartSn,v=l.endSN,c=l.lastPartIndex,f=c!==-1,d=D===v,o=h?0:c;f?(b=d?v+1:D,m=d?o:c+1):b=v+1;var E=l.age,g=E+l.ageHeader,S=Math.min(g-l.partTarget,l.targetduration*1.5);if(S>0){if(C&&S>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+S+" with playlist age: "+l.age),S=0;else{var P=Math.floor(S/l.targetduration);if(b+=P,m!==void 0){var B=Math.round(S%l.targetduration/l.partTarget);m+=B}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+S+" skip sn "+P+" to part "+m)}l.tuneInGoal=S}if(u=this.getDeliveryDirectives(l,O.deliveryDirectives,b,m),h||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(l,O.deliveryDirectives,b,m);var H=Object(M.computeReloadInterval)(l,a);b!==void 0&&l.canBlockReload&&(H-=l.partTarget||1),this.log("reload live playlist "+L+" in "+Math.round(H)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(u)},H)}else this.clearTimer()},y.getDeliveryDirectives=function(L,O,C,p){var l=Object(T.getSkipValue)(L,C);return O!=null&&O.skip&&L.deltaUpdateFailed&&(C=O.msn,p=O.part,l=T.HlsSkip.No),new T.HlsUrlParameters(C,p,l)},y.retryLoadingOrFail=function(L){var O=this,C=this.hls.config,p=this.retryCount<C.levelLoadingMaxRetry;if(p){var l;if(this.retryCount++,L.details.indexOf("LoadTimeOut")>-1&&(l=L.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+L.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return O.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+L.details+'"')}}else this.warn('cannot recover from error "'+L.details+'"'),this.clearTimer(),L.fatal=!0;return p},_}()},"./src/controller/base-stream-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"State",function(){return v}),A.d(K,"default",function(){return c});var F=A("./src/polyfills/number.ts"),T=A("./src/task-loop.ts"),M=A("./src/controller/fragment-tracker.ts"),U=A("./src/utils/buffer-helper.ts"),I=A("./src/utils/logger.ts"),R=A("./src/events.ts"),_=A("./src/errors.ts"),y=A("./src/types/transmuxer.ts"),w=A("./src/utils/mp4-tools.ts"),L=A("./src/utils/discontinuities.ts"),O=A("./src/controller/fragment-finders.ts"),C=A("./src/controller/level-helper.ts"),p=A("./src/loader/fragment-loader.ts"),l=A("./src/crypt/decrypter.ts"),a=A("./src/utils/time-ranges.ts"),s=A("./src/types/loader.ts");function u(f,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(f,E.key,E)}}function b(f,d,o){return d&&u(f.prototype,d),o&&u(f,o),f}function m(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,D(f,d)}function D(f,d){return D=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},D(f,d)}var v={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"},c=function(f){h(d,f);function d(E,g,S){var P;return P=f.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=v.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=S,P.log=I.logger.log.bind(I.logger,S+":"),P.warn=I.logger.warn.bind(I.logger,S+":"),P.hls=E,P.fragmentLoader=new p.default(E.config),P.fragmentTracker=g,P.config=E.config,P.decrypter=new l.default(E,E.config),E.on(R.Events.KEY_LOADED,P.onKeyLoaded,m(P)),P}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(g){},o.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=v.STOPPED},o._streamEnded=function(g,S){var P=this.fragCurrent,B=this.fragmentTracker;if(!S.live&&P&&P.sn===S.endSN&&!g.nextStart){var H=B.getState(P);return H===M.FragmentState.PARTIAL||H===M.FragmentState.OK}return!1},o.onMediaAttached=function(g,S){var P=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(B.startPosition)},o.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.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 g=this.config,S=this.fragCurrent,P=this.media,B=this.mediaBuffer,H=this.state,Y=P?P.currentTime:0,j=U.BufferHelper.bufferInfo(B||P,Y,g.maxBufferHole);if(this.log("media seeking to "+(Object(F.isFiniteNumber)(Y)?Y.toFixed(3):Y)+", state: "+H),H===v.ENDED)this.resetLoadingState();else if(S&&!j.len){var N=g.maxFragLookUpTolerance,Q=S.start-N,ne=S.start+S.duration+N,pe=Y>ne;(Y<Q||pe)&&(pe&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=Y),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=Y),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(g,S){if(this.state!==v.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var P=this.levels[S.frag.level].details;P&&this.loadFragment(S.frag,P,S.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=v.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(g,S){this.log("Loading key for "+g.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=v.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(R.Events.KEY_LOADING,{frag:g})},o.loadFragment=function(g,S,P){this._loadFragForPlayback(g,S,P)},o._loadFragForPlayback=function(g,S,P){var B=this,H=function(j){if(B.fragContextChanged(g)){B.warn("Fragment "+g.sn+(j.part?" p: "+j.part.index:"")+" of level "+g.level+" was dropped during download."),B.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,B._handleFragmentLoadProgress(j)};this._doFragLoad(g,S,P,H).then(function(Y){if(!Y)return;B.fragLoadError=0;var j=B.state;if(B.fragContextChanged(g)){(j===v.FRAG_LOADING||j===v.BACKTRACKING||!B.fragCurrent&&j===v.PARSING)&&(B.fragmentTracker.removeFragment(g),B.state=v.IDLE);return}if("payload"in Y&&(B.log("Loaded fragment "+g.sn+" of level "+g.level),B.hls.trigger(R.Events.FRAG_LOADED,Y),B.state===v.BACKTRACKING)){B.fragmentTracker.backtrack(g,Y),B.resetFragmentLoading(g);return}B._handleFragmentLoadComplete(Y)}).catch(function(Y){B.warn(Y),B.resetFragmentLoading(g)})},o.flushMainBuffer=function(g,S,P){if(P===void 0&&(P=null),!(g-S))return;var B={startOffset:g,endOffset:S,type:P};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,B)},o._loadInitSegment=function(g){var S=this;this._doFragLoad(g).then(function(P){if(!P||S.fragContextChanged(g)||!S.levels)throw new Error("init load aborted");return P}).then(function(P){var B=S.hls,H=P.payload,Y=g.decryptdata;if(H&&H.byteLength>0&&Y&&Y.key&&Y.iv&&Y.method==="AES-128"){var j=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(H),Y.key.buffer,Y.iv.buffer).then(function(N){var Q=self.performance.now();return B.trigger(R.Events.FRAG_DECRYPTED,{frag:g,payload:N,stats:{tstart:j,tdecrypt:Q}}),P.payload=N,P})}return P}).then(function(P){var B=S.fragCurrent,H=S.hls,Y=S.levels;if(!Y)throw new Error("init load aborted, missing levels");var j=Y[g.level].details;console.assert(j,"Level details are defined when init segment is loaded");var N=g.stats;S.state=v.IDLE,S.fragLoadError=0,g.data=new Uint8Array(P.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),P.frag===B&&H.trigger(R.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:g.type}),S.tick()}).catch(function(P){S.warn(P),S.resetFragmentLoading(g)})},o.fragContextChanged=function(g){var S=this.fragCurrent;return!g||!S||g.level!==S.level||g.sn!==S.sn||g.urlId!==S.urlId},o.fragBufferedComplete=function(g,S){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+a.default.toString(U.BufferHelper.getBuffered(P))),this.state=v.IDLE,this.tick()},o._handleFragmentLoadComplete=function(g){var S=this.transmuxer;if(!S)return;var P=g.frag,B=g.part,H=g.partsLoaded,Y=!H||H.length===0||H.some(function(N){return!N}),j=new y.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,B?B.index:-1,!Y);S.flush(j)},o._handleFragmentLoadProgress=function(g){},o._doFragLoad=function(g,S,P,B){var H=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(g.start,P||0),this.config.lowLatencyMode&&S){var Y=S.partList;if(Y&&B){P>g.end&&S.fragmentHint&&(g=S.fragmentHint);var j=this.getNextPart(Y,g,P);if(j>-1){var N=Y[j];return this.log("Loading part sn: "+g.sn+" p: "+N.index+" cc: "+g.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+j+"-"+(Y.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=v.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,part:Y[j],targetBufferTime:P}),this.doFragPartsLoad(g,Y,j,B).catch(function(Q){return H.handleFragLoadError(Q)})}else if(!g.url||this.loadedEndOfParts(Y,P))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(P.toFixed(3))),Object(F.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=v.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,targetBufferTime:P}),this.fragmentLoader.load(g,B).catch(function(Q){return H.handleFragLoadError(Q)})},o.doFragPartsLoad=function(g,S,P,B){var H=this;return new Promise(function(Y,j){var N=[],Q=function ne(pe){var xe=S[pe];H.fragmentLoader.loadPart(g,xe,B).then(function(Ie){N[xe.index]=Ie;var Ae=Ie.part;H.hls.trigger(R.Events.FRAG_LOADED,Ie);var De=S[pe+1];if(De&&De.fragment===g)ne(pe+1);else return Y({frag:g,part:Ae,partsLoaded:N})}).catch(j)};Q(P)})},o.handleFragLoadError=function(g){var S=g.data;return S&&S.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(R.Events.ERROR,S),null},o._handleTransmuxerFlush=function(g){var S=this.getCurrentContext(g);if(!S||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var P=S.frag,B=S.part,H=S.level,Y=self.performance.now();P.stats.parsing.end=Y,B&&(B.stats.parsing.end=Y),this.updateLevelTiming(P,B,H,g.partial)},o.getCurrentContext=function(g){var S=this.levels,P=g.level,B=g.sn,H=g.part;if(!S||!S[P])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+P+". The current chunk will not be buffered."),null;var Y=S[P],j=H>-1?Object(C.getPartWith)(Y,B,H):null,N=j?j.fragment:Object(C.getFragmentWithSN)(Y,B,this.fragCurrent);return N?{frag:N,part:j,level:Y}:null},o.bufferFragmentData=function(g,S,P,B){if(!g||this.state!==v.PARSING)return;var H=g.data1,Y=g.data2,j=H;if(H&&Y&&(j=Object(w.appendUint8Array)(H,Y)),!j||!j.length)return;var N={type:g.type,frag:S,part:P,chunkMeta:B,parent:S.type,data:j};this.hls.trigger(R.Events.BUFFER_APPENDING,N),g.dropped&&g.independent&&!P&&this.flushBufferGap(S)},o.flushBufferGap=function(g){var S=this.media;if(!S)return;if(!U.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,g.start);return}var P=S.currentTime,B=U.BufferHelper.bufferInfo(S,P,0),H=g.duration,Y=Math.min(this.config.maxFragLookUpTolerance*2,H*.25),j=Math.max(Math.min(g.start-Y,B.end-Y),P+Y);g.start-j>Y&&this.flushMainBuffer(j,g.start)},o.getFwdBufferInfo=function(g,S){var P=this.config,B=this.getLoadPosition();if(!Object(F.isFiniteNumber)(B))return null;var H=U.BufferHelper.bufferInfo(g,B,P.maxBufferHole);if(H.len===0&&H.nextStart!==void 0){var Y=this.fragmentTracker.getBufferedFrag(B,S);if(Y&&H.nextStart<Y.end)return U.BufferHelper.bufferInfo(g,B,Math.max(H.nextStart,P.maxBufferHole))}return H},o.getMaxBufferLength=function(g){var S=this.config,P;return g?P=Math.max(8*S.maxBufferSize/g,S.maxBufferLength):P=S.maxBufferLength,Math.min(P,S.maxMaxBufferLength)},o.reduceMaxBufferLength=function(g){var S=this.config,P=g||S.maxBufferLength;return S.maxMaxBufferLength>=P?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(g,S){var P,B,H=S.fragments,Y=H.length;if(!Y)return null;var j=this.config,N=H[0].start,Q;if(S.live){var ne=j.initialLiveManifestSize;if(Y<ne)return this.warn("Not enough fragments to start playback (have: "+Y+", need: "+ne+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Q=this.getInitialLiveFragment(S,H),this.startPosition=Q?this.hls.liveSyncPosition||Q.start:g)}else g<=N&&(Q=H[0]);if(!Q){var pe=j.lowLatencyMode?S.partEnd:S.fragmentEnd;Q=this.getFragmentAtPosition(g,pe,S)}return(P=Q)!==null&&P!==void 0&&P.initSegment&&!((B=Q)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(Q=Q.initSegment),Q},o.getNextPart=function(g,S,P){for(var B=-1,H=!1,Y=!0,j=0,N=g.length;j<N;j++){var Q=g[j];if(Y=Y&&!Q.independent,B>-1&&P<Q.start)break;var ne=Q.loaded;!ne&&(H||Q.independent||Y)&&Q.fragment===S&&(B=j),H=ne}return B},o.loadedEndOfParts=function(g,S){var P=g[g.length-1];return P&&S>P.start&&P.loaded},o.getInitialLiveFragment=function(g,S){var P=this.fragPrevious,B=null;if(P){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),B=Object(O.findFragmentByPDT)(S,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var H=P.sn+1;if(H>=g.startSN&&H<=g.endSN){var Y=S[H-g.startSN];P.cc===Y.cc&&(B=Y,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(O.findFragWithCC)(S,P.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(B=this.getFragmentAtPosition(j,this.bitrateTest?g.fragmentEnd:g.edge,g))}return B},o.getFragmentAtPosition=function(g,S,P){var B=this.config,H=this.fragPrevious,Y=P.fragments,j=P.endSN,N=P.fragmentHint,Q=B.maxFragLookUpTolerance,ne=!!(B.lowLatencyMode&&P.partList&&N);ne&&N&&!this.bitrateTest&&(Y=Y.concat(N),j=N.sn);var pe;if(g<S){var xe=g>S-Q?0:Q;pe=Object(O.findFragmentByPTS)(H,Y,g,xe)}else pe=Y[Y.length-1];if(pe){var Ie=pe.sn-P.startSN,Ae=H&&pe.level===H.level,De=Y[Ie+1],Ce=this.fragmentTracker.getState(pe);if(Ce===M.FragmentState.BACKTRACKED){pe=null;for(var Oe=Ie;Y[Oe]&&this.fragmentTracker.getState(Y[Oe])===M.FragmentState.BACKTRACKED;)H?pe=Y[Oe--]:pe=Y[--Oe];pe||(pe=De)}else H&&pe.sn===H.sn&&!ne&&(Ae&&(pe.sn<j&&this.fragmentTracker.getState(De)!==M.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+De.sn),pe=De):pe=null))}return pe},o.synchronizeToLiveEdge=function(g){var S=this.config,P=this.media;if(!P)return;var B=this.hls.liveSyncPosition,H=P.currentTime,Y=g.fragments[0].start,j=g.edge,N=H>=Y-S.maxFragLookUpTolerance&&H<=j;if(B!==null&&P.duration>B&&(H<B||!N)){var Q=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*g.targetduration;(!N&&P.readyState<4||H<j-Q)&&(this.loadedmetadata||(this.nextLoadPosition=B),P.readyState&&(this.warn("Playback: "+H.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+B.toFixed(3)),P.currentTime=B))}},o.alignPlaylists=function(g,S){var P=this.levels,B=this.levelLastLoaded,H=this.fragPrevious,Y=B!==null?P[B]:null,j=g.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var N=g.fragments[0].start,Q=!S,ne=g.alignedSliding&&Object(F.isFiniteNumber)(N);if(Q||!ne&&!N){Object(L.alignStream)(H,Y,g);var pe=g.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+g.startSN+" prev-sn: "+(H?H.sn:"na")+" fragments: "+j),pe}return N},o.waitForCdnTuneIn=function(g){var S=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*S)},o.setStartPosition=function(g,S){var P=this.startPosition;if(P<S&&(P=-1),P===-1||this.lastCurrentTime===-1){var B=g.startTimeOffset;Object(F.isFiniteNumber)(B)?(P=S+B,B<0&&(P+=g.totalduration),P=Math.min(Math.max(S,P),S+g.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+P),this.startPosition=P):g.live?P=this.hls.liveSyncPosition||S:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},o.getLoadPosition=function(){var g=this.media,S=0;return this.loadedmetadata&&g?S=g.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},o.handleFragLoadAborted=function(g,S){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(S?" part"+S.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},o.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=v.IDLE)},o.onFragmentOrKeyLoadError=function(g,S){if(S.fatal)return;var P=S.frag;if(!P||P.type!==g)return;var B=this.fragCurrent;console.assert(B&&P.sn===B.sn&&P.level===B.level&&P.urlId===B.urlId,"Frag load error must match current frag to retry");var H=this.config;if(this.fragLoadError+1<=H.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var Y=Math.min(Math.pow(2,this.fragLoadError)*H.fragLoadingRetryDelay,H.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+g+" "+P.level+" failed to load, retrying in "+Y+"ms"),this.retryDate=self.performance.now()+Y,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(I.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},o.afterBufferFlushed=function(g,S,P){if(!g)return;var B=U.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(S,B,P),this.state===v.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=v.IDLE},o.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[g].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(g,S,P,B){var H=this,Y=P.details;console.assert(!!Y,"level.details must be defined");var j=Object.keys(g.elementaryStreams).reduce(function(N,Q){var ne=g.elementaryStreams[Q];if(ne){var pe=ne.endPTS-ne.startPTS;if(pe<=0)return H.warn("Could not parse fragment "+g.sn+" "+Q+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),H.resetTransmuxer(),N||!1;var xe=B?0:Object(C.updateFragPTSDTS)(Y,g,ne.startPTS,ne.endPTS,ne.startDTS,ne.endDTS);return H.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:Y,level:P,drift:xe,type:Q,frag:g,start:ne.startPTS,end:ne.endPTS}),!0}return N},!1);j?(this.state=v.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:g,part:S})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},b(d,[{key:"state",get:function(){return this._state},set:function(g){var S=this._state;S!==g&&(this._state=g,this.log(S+"->"+g))}}]),d}(T.default)},"./src/controller/buffer-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var F=A("./src/polyfills/number.ts"),T=A("./src/events.ts"),M=A("./src/utils/logger.ts"),U=A("./src/errors.ts"),I=A("./src/utils/buffer-helper.ts"),R=A("./src/utils/mediasource-helper.ts"),_=A("./src/loader/fragment.ts"),y=A("./src/controller/buffer-operation-queue.ts"),w=Object(R.getMediaSource)(),L=/([ha]vc.)(?:\.[^.,]+)+/,O=function(){function C(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,b=a.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),s.trigger(T.Events.MEDIA_ATTACHED,{media:u})),b&&b.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var p=C.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var a=this.hls;a.on(T.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(T.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(T.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(T.Events.BUFFER_RESET,this.onBufferReset,this),a.on(T.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(T.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(T.Events.BUFFER_EOS,this.onBufferEos,this),a.on(T.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(T.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(T.Events.FRAG_PARSED,this.onFragParsed,this),a.on(T.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var a=this.hls;a.off(T.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(T.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(T.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(T.Events.BUFFER_RESET,this.onBufferReset,this),a.off(T.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(T.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(T.Events.BUFFER_EOS,this.onBufferEos,this),a.off(T.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(T.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(T.Events.FRAG_PARSED,this.onFragParsed,this),a.off(T.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(a,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(a,s){var u=this.media=s.media;if(u&&w){var b=this.mediaSource=new w;b.addEventListener("sourceopen",this._onMediaSourceOpen),b.addEventListener("sourceended",this._onMediaSourceEnded),b.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(b),this._objectUrl=u.src}},p.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(b){M.logger.warn("[buffer-controller]: onMediaDetaching: "+b.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()):M.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(T.Events.MEDIA_DETACHED,void 0)},p.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(b){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",b)}}),this._initSourceBuffer()},p.onBufferCodecs=function(a,s){var u=this,b=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(m){if(b){var h=u.tracks[m];if(h&&typeof h.buffer.changeType=="function"){var D=s[m],v=D.codec,c=D.levelCodec,f=D.container,d=(h.levelCodec||h.codec).replace(L,"$1"),o=(c||v).replace(L,"$1");if(d!==o){var E=f+";codecs="+(c||v);u.appendChangeType(m,E)}}}else u.pendingTracks[m]=s[m]}),b)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(a,s){var u=this,b=this.operationQueue,m={execute:function(){var D=u.sourceBuffer[a];D&&(M.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),D.changeType(s)),b.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){M.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};b.append(m,a)},p.onBufferAppending=function(a,s){var u=this,b=this.hls,m=this.operationQueue,h=this.tracks,D=s.data,v=s.type,c=s.frag,f=s.part,d=s.chunkMeta,o=d.buffering[v],E=self.performance.now();o.start=E;var g=c.stats.buffering,S=f?f.stats.buffering:null;g.start===0&&(g.start=E),S&&S.start===0&&(S.start=E);var P=h.audio,B=v==="audio"&&d.id===1&&(P==null?void 0:P.container)==="audio/mpeg",H={execute:function(){if(o.executeStart=self.performance.now(),B){var j=u.sourceBuffer[v];if(j){var N=c.start-j.timestampOffset;Math.abs(N)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+N+") sn: "+c.sn+")"),j.timestampOffset=c.start)}}u.appendExecutor(D,v)},onStart:function(){},onComplete:function(){var j=self.performance.now();o.executeEnd=o.end=j,g.first===0&&(g.first=j),S&&S.first===0&&(S.first=j);var N=u.sourceBuffer,Q={};for(var ne in N)Q[ne]=I.BufferHelper.getBuffered(N[ne]);u.appendError=0,u.hls.trigger(T.Events.BUFFER_APPENDED,{type:v,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:Q})},onError:function(j){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",j);var N={type:U.ErrorTypes.MEDIA_ERROR,parent:c.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=U.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,N.details=U.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>b.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+b.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),b.trigger(T.Events.ERROR,N)}};m.append(H,v)},p.onBufferFlushing=function(a,s){var u=this,b=this.operationQueue,m=function(D){return{execute:u.removeExecutor.bind(u,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(T.Events.BUFFER_FLUSHED,{type:D})},onError:function(c){M.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",c)}}};s.type?b.append(m(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){b.append(m(h),h)})},p.onFragParsed=function(a,s){var u=this,b=s.frag,m=s.part,h=[],D=m?m.elementaryStreams:b.elementaryStreams;D[_.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(D[_.ElementaryStreamTypes.AUDIO]&&h.push("audio"),D[_.ElementaryStreamTypes.VIDEO]&&h.push("video"));var v=function(){var f=self.performance.now();b.stats.buffering.end=f,m&&(m.stats.buffering.end=f);var d=m?m.stats:b.stats;u.hls.trigger(T.Events.FRAG_BUFFERED,{frag:b,part:m,stats:d,id:b.type})};h.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+b.type+" level: "+b.level+" sn: "+b.sn),this.blockBuffers(v,h)},p.onFragChanged=function(a,s){this.flushBackBuffer()},p.onBufferEos=function(a,s){var u=this,b=this.getSourceBufferTypes().reduce(function(m,h){var D=u.sourceBuffer[h];return(!s.type||s.type===h)&&(D&&!D.ended&&(D.ended=!0,M.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),m&&!!(!D||D.ended)},!0);b&&this.blockBuffers(function(){var m=u.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},p.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()},p.flushBackBuffer=function(){var a=this.hls,s=this.details,u=this.media,b=this.sourceBuffer;if(!u||s===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var h=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(F.isFiniteNumber)(h)||h<0)return;var D=u.currentTime,v=s.levelTargetDuration,c=Math.max(h,v),f=Math.floor(D/v)*v-c;m.forEach(function(d){var o=b[d];if(o){var E=I.BufferHelper.getBuffered(o);E.length>0&&f>E.start(0)&&(a.trigger(T.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&a.trigger(T.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),a.trigger(T.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,u=this.media,b=this.mediaSource,m=a.fragments[0].start+a.totalduration,h=u.duration,D=Object(F.isFiniteNumber)(b.duration)?b.duration:0;a.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),b.duration=Infinity,this.updateSeekableRange(a)):(m>D&&m>h||!Object(F.isFiniteNumber)(h))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),b.duration=m)},p.updateSeekableRange=function(a){var s=this.mediaSource,u=a.fragments,b=u.length;if(b&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var m=Math.max(0,u[0].start),h=Math.max(m,m+a.totalduration);s.setLiveSeekableRange(m,h)}},p.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,b=Object.keys(u).length;if(b&&!a||b===2){this.createSourceBuffers(u),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(T.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(h){s.executeNext(h)})}},p.createSourceBuffers=function(a){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var b=0;for(var m in a)if(!s[m]){var h=a[m];if(!h)throw Error("source buffer exists for track "+m+", however track does not");var D=h.levelCodec||h.codec,v=h.container+";codecs="+D;M.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var c=s[m]=u.addSourceBuffer(v),f=m;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[m]={buffer:c,codec:D,container:h.container,levelCodec:h.levelCodec,id:h.id},b++}catch(d){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(T.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:v})}}b&&this.hls.trigger(T.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(a){var s=this.operationQueue,u=s.current(a);u.onStart()},p._onSBUpdateEnd=function(a){var s=this.operationQueue,u=s.current(a);u.onComplete(),s.shiftAndExecuteNext(a)},p._onSBUpdateError=function(a,s){M.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(T.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(s)},p.removeExecutor=function(a,s,u){var b=this.media,m=this.mediaSource,h=this.operationQueue,D=this.sourceBuffer,v=D[a];if(!b||!m||!v){M.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(a);return}var c=Object(F.isFiniteNumber)(b.duration)?b.duration:Infinity,f=Object(F.isFiniteNumber)(m.duration)?m.duration:Infinity,d=Math.max(0,s),o=Math.min(u,c,f);o>d?(M.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!v.updating,a+" sourceBuffer must not be updating"),v.remove(d,o)):h.shiftAndExecuteNext(a)},p.appendExecutor=function(a,s){var u=this.operationQueue,b=this.sourceBuffer,m=b[s];if(!m){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}m.ended=!1,console.assert(!m.updating,s+" sourceBuffer must not be updating"),m.appendBuffer(a)},p.blockBuffers=function(a,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var b=this.operationQueue,m=s.map(function(h){return b.appendBlocker(h)});Promise.all(m).then(function(){a(),s.forEach(function(h){var D=u.sourceBuffer[h];(!D||!D.updating)&&b.shiftAndExecuteNext(h)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(a,s,u){var b=this.sourceBuffer[a];if(!b)return;var m=u.bind(this,a);this.listeners[a].push({event:s,listener:m}),b.addEventListener(s,m)},p.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(u){s.removeEventListener(u.event,u.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return T});var F=A("./src/utils/logger.ts"),T=function(){function M(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var U=M.prototype;return U.append=function(R,_){var y=this.queues[_];y.push(R),y.length===1&&this.buffers[_]&&this.executeNext(_)},U.insertAbort=function(R,_){var y=this.queues[_];y.unshift(R),this.executeNext(_)},U.appendBlocker=function(R){var _,y=new Promise(function(L){_=L}),w={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,R),y},U.executeNext=function(R){var _=this.buffers,y=this.queues,w=_[R],L=y[R];if(L.length){var O=L[0];try{O.execute()}catch(C){F.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),O.onError(C),(!w||!w.updating)&&(L.shift(),this.executeNext(R))}}},U.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},U.current=function(R){return this.queues[R][0]},M}()},"./src/controller/cap-level-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts");function T(I,R){for(var _=0;_<R.length;_++){var y=R[_];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(I,y.key,y)}}function M(I,R,_){return R&&T(I.prototype,R),_&&T(I,_),I}var U=function(){function I(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=I.prototype;return R.setStreamController=function(y){this.streamController=y},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var y=this.hls;y.on(F.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var y=this.hls;y.off(F.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(y,w){I.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},R.onMediaAttaching=function(y,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},R.onManifestParsed=function(y,w){var L=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,L.config.capLevelToPlayerSize&&w.video&&this.startCapping()},R.onBufferCodecs=function(y,w){var L=this.hls;L.config.capLevelToPlayerSize&&w.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(y.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},R.getMaxLevel=function(y){var w=this,L=this.hls.levels;if(!L.length)return-1;var O=L.filter(function(C,p){return I.isLevelAllowed(p,w.restrictedLevels)&&p<=y});return this.clientRect=null,I.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},R.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,w={width:0,height:0};if(y){var L=y.getBoundingClientRect();w.width=L.width,w.height=L.height,!w.width&&!w.height&&(w.width=L.right-L.left||y.width||0,w.height=L.bottom-L.top||y.height||0)}return this.clientRect=w,w},I.isLevelAllowed=function(y,w){return w===void 0&&(w=[]),w.indexOf(y)===-1},I.getMaxLevelByMediaSize=function(y,w,L){if(!y||!y.length)return-1;for(var O=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},C=y.length-1,p=0;p<y.length;p+=1){var l=y[p];if((l.width>=w||l.height>=L)&&O(l,y[p+1])){C=p;break}}return C},M(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(w){}return y}}]),I}();K.default=U},"./src/controller/cmcd-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var F=A("./src/events.ts"),T=A("./src/types/cmcd.ts"),M=A("./src/utils/buffer-helper.ts"),U=A("./src/utils/logger.ts");function I(C,p){for(var l=0;l<p.length;l++){var a=p[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(C,a.key,a)}}function R(C,p,l){return p&&I(C.prototype,p),l&&I(C,l),C}function _(C,p){var l=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(l)return(l=l.call(C)).next.bind(l);if(Array.isArray(C)||(l=y(C))||p&&C&&typeof C.length=="number"){l&&(C=l);var a=0;return function(){return a>=C.length?{done:!0}:{done:!1,value:C[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 y(C,p){if(!C)return;if(typeof C=="string")return w(C,p);var l=Object.prototype.toString.call(C).slice(8,-1);if(l==="Object"&&C.constructor&&(l=C.constructor.name),l==="Map"||l==="Set")return Array.from(C);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return w(C,p)}function w(C,p){(p==null||p>C.length)&&(p=C.length);for(var l=0,a=new Array(p);l<p;l++)a[l]=C[l];return a}function L(){return L=Object.assign||function(C){for(var p=1;p<arguments.length;p++){var l=arguments[p];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(C[a]=l[a])}return C},L.apply(this,arguments)}var O=function(){function C(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(b){try{a.apply(b,{ot:T.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(m){U.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(b){try{var m=b.frag,h=a.hls.levels[m.level],D=a.getObjectType(m),v={d:m.duration*1e3,ot:D};(D===T.CMCDObjectType.VIDEO||D===T.CMCDObjectType.AUDIO||D==T.CMCDObjectType.MUXED)&&(v.br=h.bitrate/1e3,v.tb=a.getTopBandwidth(D),v.bl=a.getBufferLength(D)),a.apply(b,v)}catch(c){U.logger.warn("Could not generate segment CMCD data.",c)}},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||C.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var p=C.prototype;return p.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(F.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(F.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(a,s){var u,b;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(b=s.tracks.video)===null||b===void 0?void 0:b.buffer},p.createData=function(){var a;return{v:T.CMCDVersion,sf:T.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}},p.apply=function(a,s){s===void 0&&(s={}),L(s,this.createData());var u=s.ot===T.CMCDObjectType.INIT||s.ot===T.CMCDObjectType.VIDEO||s.ot===T.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 b=C.toHeaders(s);if(!Object.keys(b).length)return;a.headers||(a.headers={}),L(a.headers,b)}else{var m=C.toQuery(s);if(!m)return;a.url=C.appendQueryToUri(a.url,m)}},p.getObjectType=function(a){var s=a.type;return s==="subtitle"?T.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?T.CMCDObjectType.INIT:s==="audio"?T.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?T.CMCDObjectType.VIDEO:T.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(a){for(var s=0,u=a===T.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,b=_(u),m;!(m=b()).done;){var h=m.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},p.getBufferLength=function(a){var s=this.hls.media,u=a===T.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var b=M.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return b.len*1e3},p.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,u=a||this.config.loader;return function(){function b(h){this.loader=void 0,this.loader=new u(h)}var m=b.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(D,v,c){s(D),this.loader.load(D,v,c)},R(b,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),b}()},p.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,u=a||this.config.loader;return function(){function b(h){this.loader=void 0,this.loader=new u(h)}var m=b.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(D,v,c){s(D),this.loader.load(D,v,c)},R(b,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),b}()},C.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},C.serialize=function(a){for(var s=[],u=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},b=function(B){return Math.round(B)},m=function(B){return b(B/100)*100},h=function(B){return encodeURIComponent(B)},D={br:b,d:b,bl:m,dl:m,mtp:m,nor:h,rtp:m,tb:b},v=Object.keys(a||{}).sort(),c=_(v),f;!(f=c()).done;){var d=f.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 g=typeof o,S=void 0;d==="ot"||d==="sf"||d==="st"?S=d+"="+o:g==="boolean"?S=d:g==="number"?S=d+"="+o:S=d+"="+JSON.stringify(o),s.push(S)}return s.join(",")},C.toHeaders=function(a){for(var s=Object.keys(a),u={},b=["Object","Request","Session","Status"],m=[{},{},{},{}],h={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,v=s;D<v.length;D++){var c=v[D],f=h[c]!=null?h[c]:1;m[f][c]=a[c]}for(var d=0;d<m.length;d++){var o=C.serialize(m[d]);o&&(u["CMCD-"+b[d]]=o)}return u},C.toQuery=function(a){return"CMCD="+encodeURIComponent(C.serialize(a))},C.appendQueryToUri=function(a,s){if(!s)return a;var u=a.includes("?")?"&":"?";return""+a+u+s},C}()},"./src/controller/eme-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts"),T=A("./src/errors.ts"),M=A("./src/utils/logger.ts"),U=A("./src/utils/mediakeys-helper.ts");function I(O,C){for(var p=0;p<C.length;p++){var l=C[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(O,l.key,l)}}function R(O,C,p){return C&&I(O.prototype,C),p&&I(O,p),O}var _=3,y=function(C,p,l){var a={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),p.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[a]},w=function(C,p,l,a){switch(C){case U.KeySystems.WIDEVINE:return y(p,l,a);default:throw new Error("Unknown key-system: "+C)}},L=function(){function O(p){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=p,this._config=p.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 C=O.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(F.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(l){switch(l){case U.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},C._attemptKeySystemAccess=function(l,a,s){var u=this,b=w(l,a,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(l,b);this.mediaKeysPromise=m.then(function(h){return u._onMediaKeySystemAccessObtained(l,h)}),m.catch(function(h){M.logger.error('Failed to obtain key-system "'+l+'" access:',h)})},C._onMediaKeySystemAccessObtained=function(l,a){var s=this;M.logger.log('Access for key-system "'+l+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:l};this._mediaKeysList.push(u);var b=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(m){return u.mediaKeys=m,M.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),m});return b.catch(function(m){M.logger.error("Failed to create media-keys:",m)}),b},C._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),l._onNewMediaKeySession(a.mediaKeysSession))})},C._onNewMediaKeySession=function(l){var a=this;M.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){a._onKeySessionMessage(l,s.message)},!1)},C._onKeySessionMessage=function(l,a){M.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},C.onMediaEncrypted=function(l){var a=this;if(M.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(b){if(!a._media)return;a._attemptSetMediaKeys(b),a._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},C._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){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(l,a){var s=this,u=this._mediaKeysList[0];if(!u){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var b=u.mediaKeysSession;if(!b){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+l+'" init data type'),u.mediaKeysSessionInitialized=!0,b.generateRequest(l,a).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(m){M.logger.error("Error generating key-session request:",m),s.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(l,a,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,l,a,s);var b=this._licenseXhrSetup;if(b)try{b.call(this.hls,u,l),b=void 0}catch(m){M.logger.error(m)}try{u.readyState||u.open("POST",l,!0),b&&b.call(this.hls,u,l)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return u},C._onLicenseRequestReadyStageChange=function(l,a,s,u){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var b=l.response,m=this._licenseResponseCallback;if(m)try{b=m.call(this.hls,l,a)}catch(D){M.logger.error(D)}u(b)}else{if(M.logger.error("License Request XHR failed ("+a+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=_-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,u)}break}},C._generateLicenseRequestChallenge=function(l,a){switch(l.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},C._requestLicense=function(l,a){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),b=this._createLicenseXhr(u,l,a);M.logger.log("Sending license request to URL: "+u);var m=this._generateLicenseRequestChallenge(s,l);b.send(m)}catch(h){M.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.KEY_SYSTEM_ERROR,details:T.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(l,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},C.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(){})},C.onManifestParsed=function(l,a){if(!this._emeEnabled)return;var s=a.levels.map(function(b){return b.audioCodec}).filter(function(b){return!!b}),u=a.levels.map(function(b){return b.videoCodec}).filter(function(b){return!!b});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,s,u)},R(O,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),O}();K.default=L},"./src/controller/fps-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts"),T=A("./src/utils/logger.ts"),M=function(){function U(R){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=R,this.registerListeners()}var I=U.prototype;return I.setStreamController=function(_){this.streamController=_},I.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(_,y){var w=this.hls.config;if(w.capLevelOnFPSDrop){var L=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=L,L&&typeof L.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(_,y,w){var L=performance.now();if(y){if(this.lastTime){var O=L-this.lastTime,C=w-this.lastDroppedFrames,p=y-this.lastDecodedFrames,l=1e3*C/O,a=this.hls;if(a.trigger(F.Events.FPS_DROP,{currentDropped:C,currentDecoded:p,totalDroppedFrames:w}),l>0&&C>a.config.fpsDroppedMonitoringThreshold*p){var s=a.currentLevel;T.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(F.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=L,this.lastDroppedFrames=w,this.lastDecodedFrames=y}},I.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var y=_.getVideoPlaybackQuality();this.checkFPS(_,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},U}();K.default=M},"./src/controller/fragment-finders.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"findFragmentByPDT",function(){return M}),A.d(K,"findFragmentByPTS",function(){return U}),A.d(K,"fragmentWithinToleranceTest",function(){return I}),A.d(K,"pdtWithinToleranceTest",function(){return R}),A.d(K,"findFragWithCC",function(){return _});var F=A("./src/polyfills/number.ts"),T=A("./src/utils/binary-search.ts");function M(y,w,L){if(w===null||!Array.isArray(y)||!y.length||!Object(F.isFiniteNumber)(w))return null;var O=y[0].programDateTime;if(w<(O||0))return null;var C=y[y.length-1].endProgramDateTime;if(w>=(C||0))return null;L=L||0;for(var p=0;p<y.length;++p){var l=y[p];if(R(w,L,l))return l}return null}function U(y,w,L,O){L===void 0&&(L=0),O===void 0&&(O=0);var C=null;if(y?C=w[y.sn-w[0].sn+1]||null:L===0&&w[0].start===0&&(C=w[0]),C&&I(L,O,C)===0)return C;var p=T.default.search(w,I.bind(null,L,O));return p||C}function I(y,w,L){y===void 0&&(y=0),w===void 0&&(w=0);var O=Math.min(w,L.duration+(L.deltaPTS?L.deltaPTS:0));return L.start+L.duration-O<=y?1:L.start-O>y&&L.start?-1:0}function R(y,w,L){var O=Math.min(w,L.duration+(L.deltaPTS?L.deltaPTS:0))*1e3,C=L.endProgramDateTime||0;return C-O>y}function _(y,w){return T.default.search(y,function(L){return L.cc<w?1:L.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"FragmentState",function(){return M}),A.d(K,"FragmentTracker",function(){return U});var F=A("./src/events.ts"),T=A("./src/types/loader.ts"),M;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(M||(M={}));var U=function(){function _(w){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=w,this._registerListeners()}var y=_.prototype;return y._registerListeners=function(){var L=this.hls;L.on(F.Events.BUFFER_APPENDED,this.onBufferAppended,this),L.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),L.on(F.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var L=this.hls;L.off(F.Events.BUFFER_APPENDED,this.onBufferAppended,this),L.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this),L.off(F.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(L,O){if(O===T.PlaylistLevelType.MAIN){var C=this.activeFragment,p=this.activeParts;if(!C)return null;if(p)for(var l=p.length;l--;){var a=p[l],s=a?a.end:C.appendedPTS;if(a.start<=L&&s!==void 0&&L<=s)return l>9&&(this.activeParts=p.slice(l-9)),a}else if(C.start<=L&&C.appendedPTS!==void 0&&L<=C.appendedPTS)return C}return this.getBufferedFrag(L,O)},y.getBufferedFrag=function(L,O){for(var C=this.fragments,p=Object.keys(C),l=p.length;l--;){var a=C[p[l]];if((a==null?void 0:a.body.type)===O&&a.buffered){var s=a.body;if(s.start<=L&&L<=s.end)return s}}return null},y.detectEvictedFragments=function(L,O,C){var p=this;Object.keys(this.fragments).forEach(function(l){var a=p.fragments[l];if(!a)return;if(!a.buffered){a.body.type===C&&p.removeFragment(a.body);return}var s=a.range[L];if(!s)return;s.time.some(function(u){var b=!p.isTimeBuffered(u.startPTS,u.endPTS,O);return b&&p.removeFragment(a.body),b})})},y.detectPartialFragments=function(L){var O=this,C=this.timeRanges,p=L.frag,l=L.part;if(!C||p.sn==="initSegment")return;var a=R(p),s=this.fragments[a];if(!s)return;Object.keys(C).forEach(function(u){var b=p.elementaryStreams[u];if(!b)return;var m=C[u],h=l!==null||b.partial===!0;s.range[u]=O.getBufferedTimes(p,l,h,m)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},y.fragBuffered=function(L){var O=R(L),C=this.fragments[O];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},y.getBufferedTimes=function(L,O,C,p){for(var l={time:[],partial:C},a=O?O.start:L.start,s=O?O.end:L.end,u=L.minEndPTS||s,b=L.maxStartPTS||a,m=0;m<p.length;m++){var h=p.start(m)-this.bufferPadding,D=p.end(m)+this.bufferPadding;if(b>=h&&u<=D){l.time.push({startPTS:Math.max(a,p.start(m)),endPTS:Math.min(s,p.end(m))});break}else if(a<D&&s>h)l.partial=!0,l.time.push({startPTS:Math.max(a,p.start(m)),endPTS:Math.min(s,p.end(m))});else if(s<=h)break}return l},y.getPartialFragment=function(L){var O=null,C,p,l,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(b){var m=u[b];if(!m)return;I(m)&&(p=m.body.start-s,l=m.body.end+s,L>=p&&L<=l&&(C=Math.min(L-p,l-L),a<=C&&(O=m.body,a=C)))}),O},y.getState=function(L){var O=R(L),C=this.fragments[O];return C?C.buffered?I(C)?M.PARTIAL:M.OK:C.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},y.backtrack=function(L,O){var C=R(L),p=this.fragments[C];if(!p||p.backtrack)return null;var l=p.backtrack=O||p.loaded;return p.loaded=null,l},y.getBacktrackData=function(L){var O=R(L),C=this.fragments[O];if(C){var p,l=C.backtrack;if(l!=null&&(p=l.payload)!==null&&p!==void 0&&p.byteLength)return l;this.removeFragment(L)}return null},y.isTimeBuffered=function(L,O,C){for(var p,l,a=0;a<C.length;a++){if(p=C.start(a)-this.bufferPadding,l=C.end(a)+this.bufferPadding,L>=p&&O<=l)return!0;if(O<=p)return!1}return!1},y.onFragLoaded=function(L,O){var C=O.frag,p=O.part;if(C.sn==="initSegment"||C.bitrateTest||p)return;var l=R(C);this.fragments[l]={body:C,loaded:O,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(L,O){var C=this,p=O.frag,l=O.part,a=O.timeRanges;if(p.type===T.PlaylistLevelType.MAIN)if(this.activeFragment=p,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 b=a[u];if(C.detectEvictedFragments(u,b),!l)for(var m=0;m<b.length;m++)p.appendedPTS=Math.max(b.end(m),p.appendedPTS||0)})},y.onFragBuffered=function(L,O){this.detectPartialFragments(O)},y.hasFragment=function(L){var O=R(L);return!!this.fragments[O]},y.removeFragmentsInRange=function(L,O,C){var p=this;Object.keys(this.fragments).forEach(function(l){var a=p.fragments[l];if(!a)return;if(a.buffered){var s=a.body;s.type===C&&s.start<O&&s.end>L&&p.removeFragment(s)}})},y.removeFragment=function(L){var O=R(L);L.stats.loaded=0,L.clearElementaryStreamInfo(),delete this.fragments[O]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function I(_){var y,w;return _.buffered&&(((y=_.range.video)===null||y===void 0?void 0:y.partial)||((w=_.range.audio)===null||w===void 0?void 0:w.partial))}function R(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"STALL_MINIMUM_DURATION_MS",function(){return I}),A.d(K,"MAX_START_GAP_JUMP",function(){return R}),A.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),A.d(K,"SKIP_BUFFER_RANGE_START",function(){return y}),A.d(K,"default",function(){return w});var F=A("./src/utils/buffer-helper.ts"),T=A("./src/errors.ts"),M=A("./src/events.ts"),U=A("./src/utils/logger.ts"),I=250,R=2,_=.1,y=.05,w=function(){function L(C,p,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=C,this.media=p,this.fragmentTracker=l,this.hls=a}var O=L.prototype;return O.destroy=function(){this.hls=this.fragmentTracker=this.media=null},O.poll=function(p){var l=this.config,a=this.media,s=this.stalled,u=a.currentTime,b=a.seeking,m=this.seeking&&!b,h=!this.seeking&&b;if(this.seeking=b,u!==p){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;U.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||m)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!F.BufferHelper.getBuffered(a).length)return;var v=F.BufferHelper.bufferInfo(a,u,0),c=v.len>0,f=v.nextStart||0;if(!c&&!f)return;if(b){var d=v.len>R,o=!f||f-u>R&&!this.fragmentTracker.getPartialFragment(u);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,g=Math.max(f,v.start||0)-u,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=S==null||((E=S.details)===null||E===void 0)?void 0:E.live,B=P?S.details.targetduration*2:R;if(g>0&&g<=B){this._trySkipBufferHole(null);return}}var H=self.performance.now();if(s===null){this.stalled=H;return}var Y=H-s;!b&&Y>=I&&this._reportStall(v.len);var j=F.BufferHelper.bufferInfo(a,u,l.maxBufferHole);this._tryFixBufferStall(j,Y)},O._tryFixBufferStall=function(p,l){var a=this.config,s=this.fragmentTracker,u=this.media,b=u.currentTime,m=s.getPartialFragment(b);if(m){var h=this._trySkipBufferHole(m);if(h)return}p.len>a.maxBufferHole&&l>a.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},O._reportStall=function(p){var l=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+p+")"),l.trigger(M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},O._trySkipBufferHole=function(p){for(var l=this.config,a=this.hls,s=this.media,u=s.currentTime,b=0,m=F.BufferHelper.getBuffered(s),h=0;h<m.length;h++){var D=m.start(h);if(u+l.maxBufferHole>=b&&u<D){var v=Math.max(D+y,s.currentTime+_);return U.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+v),this.moved=!0,this.stalled=null,s.currentTime=v,p&&a.trigger(M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+v,frag:p}),v}b=m.end(h)}return 0},O._tryNudgeBuffer=function(){var p=this.config,l=this.hls,a=this.media,s=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<p.nudgeMaxRetry){var b=s+u*p.nudgeOffset;U.logger.warn("Nudging 'currentTime' from "+s+" to "+b),a.currentTime=b,l.trigger(M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else U.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+p.nudgeMaxRetry+" nudges"),l.trigger(M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},L}()},"./src/controller/id3-track-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts"),T=A("./src/utils/texttrack-utils.ts"),M=A("./src/demux/id3.ts"),U=.25,I=function(){function R(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var _=R.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var w=this.hls;w.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(F.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var w=this.hls;w.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(F.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(w,L){this.media=L.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(T.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(w){if(!this.media)return;for(var L=0;L<w.length;L++){var O=w[L];if(O.kind==="metadata"&&O.label==="id3")return Object(T.sendAddTrackEvent)(O,this.media),O}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(w,L){if(!this.media)return;var O=L.frag,C=L.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<C.length;l++){var a=M.getID3Frames(C[l].data);if(a){var s=C[l].pts,u=l<C.length-1?C[l+1].pts:O.end,b=u-s;b<=0&&(u=s+U);for(var m=0;m<a.length;m++){var h=a[m];if(!M.isTimeStampFrame(h)){var D=new p(s,u,"");D.value=h,this.id3Track.addCue(D)}}}}},_.onBufferFlushing=function(w,L){var O=L.startOffset,C=L.endOffset,p=L.type;if(!p||p==="audio"){var l=this.id3Track;l&&Object(T.removeCuesInRange)(l,O,C)}},R}();K.default=I},"./src/controller/latency-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var F=A("./src/errors.ts"),T=A("./src/events.ts"),M=A("./src/utils/logger.ts");function U(_,y){for(var w=0;w<y.length;w++){var L=y[w];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(_,L.key,L)}}function I(_,y,w){return y&&U(_.prototype,y),w&&U(_,w),_}var R=function(){function _(w){var L=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 L.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var y=_.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(T.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(T.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(T.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(T.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(T.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(T.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(T.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(T.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(T.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(T.Events.ERROR,this.onError)},y.onMediaAttached=function(L,O){this.media=O.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(L,O){var C=O.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(L,O){if(O.details!==F.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var L=this.media,O=this.levelDetails;if(!L||!O)return;this.currentTime=L.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var p=this.config,l=p.lowLatencyMode,a=p.maxLiveSyncPlaybackRate;if(!l||a===1)return;var s=this.targetLatency;if(s===null)return;var u=C-s,b=Math.min(this.maxLatency,s+O.targetduration),m=u<b;if(O.live&&m&&u>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;L.playbackRate=Math.min(h,Math.max(1,D))}else L.playbackRate!==1&&L.playbackRate!==0&&(L.playbackRate=1)},y.estimateLiveEdge=function(){var L=this.levelDetails;return L===null?null:L.edge+L.age},y.computeLatency=function(){var L=this.estimateLiveEdge();return L===null?null:L-this.currentTime},I(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var L=this.config,O=this.levelDetails;return L.liveMaxLatencyDuration!==void 0?L.liveMaxLatencyDuration:O?L.liveMaxLatencyDurationCount*O.targetduration:0}},{key:"targetLatency",get:function(){var L=this.levelDetails;if(L===null)return null;var O=L.holdBack,C=L.partHoldBack,p=L.targetduration,l=this.config,a=l.liveSyncDuration,s=l.liveSyncDurationCount,u=l.lowLatencyMode,b=this.hls.userConfig,m=u&&C||O;(b.liveSyncDuration||b.liveSyncDurationCount||m===0)&&(m=a!==void 0?a:s*p);var h=p,D=1;return m+Math.min(this.stallCount*D,h)}},{key:"liveSyncPosition",get:function(){var L=this.estimateLiveEdge(),O=this.targetLatency,C=this.levelDetails;if(L===null||O===null||C===null)return null;var p=C.edge,l=L-O-this.edgeStalled,a=p-C.totalduration,s=p-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(a,l),s)}},{key:"drift",get:function(){var L=this.levelDetails;return L===null?1:L.drift}},{key:"edgeStalled",get:function(){var L=this.levelDetails;if(L===null)return 0;var O=(this.config.lowLatencyMode&&L.partTarget||L.targetduration)*3;return Math.max(L.age-O,0)}},{key:"forwardBufferLength",get:function(){var L=this.media,O=this.levelDetails;if(!L||!O)return 0;var C=L.buffered.length;return C?L.buffered.end(C-1):O.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return l});var F=A("./src/types/level.ts"),T=A("./src/events.ts"),M=A("./src/errors.ts"),U=A("./src/utils/codecs.ts"),I=A("./src/controller/level-helper.ts"),R=A("./src/controller/base-playlist-controller.ts"),_=A("./src/types/loader.ts");function y(){return y=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var b in u)Object.prototype.hasOwnProperty.call(u,b)&&(a[b]=u[b])}return a},y.apply(this,arguments)}function w(a,s){for(var u=0;u<s.length;u++){var b=s[u];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(a,b.key,b)}}function L(a,s,u){return s&&w(a.prototype,s),u&&w(a,u),a}function O(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,C(a,s)}function C(a,s){return C=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},C(a,s)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(a){O(s,a);function s(b){var m;return m=a.call(this,b,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var u=s.prototype;return u._registerListeners=function(){var m=this.hls;m.on(T.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(T.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(T.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(T.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(T.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var m=this.hls;m.off(T.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(T.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(T.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(T.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(T.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 m=this._levels;m.forEach(function(h){h.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(m,h){var D=[],v=[],c=[],f,d={},o,E=!1,g=!1,S=!1;if(h.levels.forEach(function(Y){var j=Y.attrs;E=E||!!(Y.width&&Y.height),g=g||!!Y.videoCodec,S=S||!!Y.audioCodec,p&&Y.audioCodec&&Y.audioCodec.indexOf("mp4a.40.34")!==-1&&(Y.audioCodec=void 0);var N=Y.bitrate+"-"+Y.attrs.RESOLUTION+"-"+Y.attrs.CODECS;o=d[N],o?o.url.push(Y.url):(o=new F.Level(Y),d[N]=o,D.push(o)),j&&(j.AUDIO&&Object(I.addGroupId)(o,"audio",j.AUDIO),j.SUBTITLES&&Object(I.addGroupId)(o,"text",j.SUBTITLES))}),(E||g)&&S&&(D=D.filter(function(Y){var j=Y.videoCodec,N=Y.width,Q=Y.height;return!!j||!!(N&&Q)})),D=D.filter(function(Y){var j=Y.audioCodec,N=Y.videoCodec;return(!j||Object(U.isCodecSupportedInMp4)(j,"audio"))&&(!N||Object(U.isCodecSupportedInMp4)(N,"video"))}),h.audioTracks&&(v=h.audioTracks.filter(function(Y){return!Y.audioCodec||Object(U.isCodecSupportedInMp4)(Y.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(v)),h.subtitles&&(c=h.subtitles,Object(I.assignTrackIdsByGroup)(c)),D.length>0){f=D[0].bitrate,D.sort(function(Y,j){return Y.bitrate-j.bitrate}),this._levels=D;for(var P=0;P<D.length;P++)if(D[P].bitrate===f){this._firstLevel=P,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+f);break}var B=S&&!g,H={levels:D,audioTracks:v,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:S,video:g,altAudio:!B&&v.some(function(Y){return!!Y.url})};this.hls.trigger(T.Events.MANIFEST_PARSED,H),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(T.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(m,h){if(a.prototype.onError.call(this,m,h),h.fatal)return;var D=h.context,v=this._levels[this.currentLevelIndex];if(D&&(D.type===_.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&D.groupId===v.audioGroupIds[v.urlId]||D.type===_.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&D.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var o=this._levels[h.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(f=!1),d=D.level),c=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},u.recoverLevel=function(m,h,D,v){var c=m.details,f=this._levels[h];if(f.loadError++,D){var d=this.retryLoadingOrFail(m);if(d)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var o=f.url.length;if(o>1&&f.loadError<o)m.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var E=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(c+": switch to "+E),m.levelRetry=!0,this.hls.nextAutoLevel=E)}}},u.redundantFailover=function(m){var h=this._levels[m],D=h.url.length;if(D>1){var v=(h.urlId+1)%D;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(c){c.urlId=v}),this.level=m}},u.onFragLoaded=function(m,h){var D=h.frag;if(D!==void 0&&D.type===_.PlaylistLevelType.MAIN){var v=this._levels[D.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},u.onLevelLoaded=function(m,h){var D,v=h.level,c=h.details,f=this._levels[v];if(!f){var d;this.warn("Invalid level index "+v),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(v,h,f.details)):(D=h.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(c.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(m,h){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var v=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<D.audioGroupIds.length;f++)if(D.audioGroupIds[f]===c){v=f;break}v!==D.urlId&&(D.urlId=v,this.startLoad())}},u.loadPlaylist=function(m){var h=this.currentLevelIndex,D=this._levels[h];if(this.canLoad&&D&&D.url.length>0){var v=D.urlId,c=D.url[v];if(m)try{c=m.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+v+" "+c),this.clearTimer(),this.hls.trigger(T.Events.LEVEL_LOADING,{url:c,level:h,id:v,deliveryDirectives:m||null})}},u.removeLevel=function(m,h){var D=function(f,d){return d!==h},v=this._levels.filter(function(c,f){return f!==m?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(D),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(D)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(D)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=f}),c});this._levels=v,this.hls.trigger(T.Events.LEVELS_UPDATED,{levels:v})},L(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var h,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===m&&(h=D[m])!==null&&h!==void 0&&h.details)return;if(m<0||m>=D.length){var v=m<0;if(this.hls.trigger(T.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:v,reason:"invalid level idx"}),v)return;m=Math.min(m,D.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=D[c],d=D[m];this.log("switching to level "+m+" from "+c),this.currentLevelIndex=m;var o=y({},d,{level:m,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(T.Events.LEVEL_SWITCHING,o);var E=d.details;if(!E||E.live){var g=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"addGroupId",function(){return M}),A.d(K,"assignTrackIdsByGroup",function(){return U}),A.d(K,"updatePTS",function(){return I}),A.d(K,"updateFragPTSDTS",function(){return _}),A.d(K,"mergeDetails",function(){return y}),A.d(K,"mapPartIntersection",function(){return w}),A.d(K,"mapFragmentIntersection",function(){return L}),A.d(K,"adjustSliding",function(){return O}),A.d(K,"addSliding",function(){return C}),A.d(K,"computeReloadInterval",function(){return p}),A.d(K,"getFragmentWithSN",function(){return l}),A.d(K,"getPartWith",function(){return a});var F=A("./src/polyfills/number.ts"),T=A("./src/utils/logger.ts");function M(s,u,b){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(b);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(b);break}}function U(s){var u={};s.forEach(function(b){var m=b.groupId||"";b.id=u[m]=u[m]||0,u[m]++})}function I(s,u,b){var m=s[u],h=s[b];R(m,h)}function R(s,u){var b=u.startPTS;if(Object(F.isFiniteNumber)(b)){var m=0,h;u.sn>s.sn?(m=b-s.start,h=s):(m=s.start-b,h=u),h.duration!==m&&(h.duration=m)}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 _(s,u,b,m,h,D){var v=m-b;v<=0&&(T.logger.warn("Fragment should have a positive duration",u),m=b+u.duration,D=h+u.duration);var c=b,f=m,d=u.startPTS,o=u.endPTS;if(Object(F.isFiniteNumber)(d)){var E=Math.abs(d-b);Object(F.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(E,u.deltaPTS):u.deltaPTS=E,c=Math.max(b,d),b=Math.min(b,d),h=Math.min(h,u.startDTS),f=Math.min(m,o),m=Math.max(m,o),D=Math.max(D,u.endDTS)}u.duration=m-b;var g=b-u.start;u.appendedPTS=m,u.start=u.startPTS=b,u.maxStartPTS=c,u.startDTS=h,u.endPTS=m,u.minEndPTS=f,u.endDTS=D;var S=u.sn;if(!s||S<s.startSN||S>s.endSN)return 0;var P,B=S-s.startSN,H=s.fragments;for(H[B]=u,P=B;P>0;P--)R(H[P],H[P-1]);for(P=B;P<H.length-1;P++)R(H[P],H[P+1]);return s.fragmentHint&&R(H[H.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function y(s,u){for(var b=null,m=s.fragments,h=m.length-1;h>=0;h--){var D=m[h].initSegment;if(D){b=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var v=0,c;if(L(s,u,function(P,B){P.relurl&&(v=P.cc-B.cc),Object(F.isFiniteNumber)(P.startPTS)&&Object(F.isFiniteNumber)(P.endPTS)&&(B.start=B.startPTS=P.startPTS,B.startDTS=P.startDTS,B.appendedPTS=P.appendedPTS,B.maxStartPTS=P.maxStartPTS,B.endPTS=P.endPTS,B.endDTS=P.endDTS,B.minEndPTS=P.minEndPTS,B.duration=P.endPTS-P.startPTS,B.duration&&(c=B),u.PTSKnown=u.alignedSliding=!0),B.elementaryStreams=P.elementaryStreams,B.loader=P.loader,B.stats=P.stats,B.urlId=P.urlId,P.initSegment&&(B.initSegment=P.initSegment,b=P.initSegment)}),b){var f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;f.forEach(function(P){var B;(!P.initSegment||P.initSegment.relurl===((B=b)===null||B===void 0?void 0:B.relurl))&&(P.initSegment=b)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(P){return!P}),u.deltaUpdateFailed)){T.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(v){T.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<o.length;E++)o[E].cc+=v}u.skippedSegments&&(u.startCC=u.fragments[0].cc),w(s.partList,u.partList,function(P,B){B.elementaryStreams=P.elementaryStreams,B.stats=P.stats}),c?_(u,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):O(s,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var g=u.advancedDateTime;if(u.advanced&&g){var S=u.edge;u.driftStart||(u.driftStartTime=g,u.driftStart=S),u.driftEndTime=g,u.driftEnd=S}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function w(s,u,b){if(s&&u)for(var m=0,h=0,D=s.length;h<=D;h++){var v=s[h],c=u[h+m];v&&c&&v.index===c.index&&v.fragment.sn===c.fragment.sn?b(v,c):m--}}function L(s,u,b){for(var m=u.skippedSegments,h=Math.max(s.startSN,u.startSN)-u.startSN,D=(s.fragmentHint?1:0)+(m?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,v=u.startSN-s.startSN,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=D;d++){var o=f[v+d],E=c[d];m&&!E&&d<m&&(E=u.fragments[d]=o),o&&E&&b(o,E)}}function O(s,u){var b=u.startSN+u.skippedSegments-s.startSN,m=s.fragments;if(b<0||b>=m.length)return;C(u,m[b].start)}function C(s,u){if(u){for(var b=s.fragments,m=s.skippedSegments;m<b.length;m++)b[m].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function p(s,u){var b=1e3*s.levelTargetDuration,m=b/2,h=s.age,D=h>0&&h<b*3,v=u.loading.end-u.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(D){var d=333*s.misses;c=Math.max(Math.min(m,v*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=m;else D?(f=Math.min(f||b/2,h),s.availabilityDelay=f,c=f+b-h):c=b-v;return Math.round(c)}function l(s,u,b){if(!s||!s.details)return null;var m=s.details,h=m.fragments[u-m.startSN];return h||(h=m.fragmentHint,h&&h.sn===u?h:u<m.startSN&&b&&b.sn===u?b:null)}function a(s,u,b){if(!s||!s.details)return null;var m=s.details.partList;if(m)for(var h=m.length;h--;){var D=m[h];if(D.index===b&&D.fragment.sn===u)return D}return null}},"./src/controller/stream-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return m});var F=A("./src/polyfills/number.ts"),T=A("./src/controller/base-stream-controller.ts"),M=A("./src/is-supported.ts"),U=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),R=A("./src/controller/fragment-tracker.ts"),_=A("./src/types/loader.ts"),y=A("./src/loader/fragment.ts"),w=A("./src/demux/transmuxer-interface.ts"),L=A("./src/types/transmuxer.ts"),O=A("./src/controller/gap-controller.ts"),C=A("./src/errors.ts"),p=A("./src/utils/logger.ts");function l(h,D){for(var v=0;v<D.length;v++){var c=D[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function a(h,D,v){return D&&l(h.prototype,D),v&&l(h,v),h}function s(h,D){h.prototype=Object.create(D.prototype),h.prototype.constructor=h,u(h,D)}function u(h,D){return u=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},u(h,D)}var b=100,m=function(h){s(D,h);function D(c,f){var d;return d=h.call(this,c,f,"[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 v=D.prototype;return v._registerListeners=function(){var f=this.hls;f.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(U.Events.ERROR,this.onError,this),f.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var f=this.hls;f.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(U.Events.ERROR,this.onError,this),f.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(b),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&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=T.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=T.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case T.State.IDLE:this.doTickIdle();break;case T.State.WAITING_LEVEL:{var f,d=this.levels,o=this.level,E=d==null||((f=d[o])===null||f===void 0)?void 0:f.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=T.State.IDLE;break}break}case T.State.FRAG_LOADING_WAITING_RETRY:{var g,S=self.performance.now(),P=this.retryDate;(!P||S>=P||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=T.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var f,d,o=this.hls,E=this.levelLastLoaded,g=this.levels,S=this.media,P=o.config,B=o.nextLoadLevel;if(E===null||!S&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[B])return;var H=g[B];this.level=o.nextLoadLevel=B;var Y=H.details;if(!Y||this.state===T.State.WAITING_LEVEL||Y.live&&this.levelLastLoaded!==B){this.state=T.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,_.PlaylistLevelType.MAIN);if(j===null)return;var N=j.len,Q=this.getMaxBufferLength(H.maxBitrate);if(N>=Q)return;if(this._streamEnded(j,Y)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,ne),this.state=T.State.ENDED;return}var pe=j.end,xe=this.getNextFragment(pe,Y);if(this.couldBacktrack&&!this.fragPrevious&&xe&&xe.sn!=="initSegment"){var Ie=xe.sn-Y.startSN;Ie>1&&(xe=Y.fragments[Ie-1],this.fragmentTracker.removeFragment(xe))}if(xe&&this.fragmentTracker.getState(xe)===R.FragmentState.OK&&this.nextLoadPosition>pe){var Ae=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Ae,_.PlaylistLevelType.MAIN),xe=this.getNextFragment(this.nextLoadPosition,Y)}if(!xe)return;xe.initSegment&&!xe.initSegment.data&&!this.bitrateTest&&(xe=xe.initSegment),((f=xe.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=xe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(xe,Y):this.loadFragment(xe,Y,pe)},v.loadFragment=function(f,d,o){var E,g=this.fragmentTracker.getState(f);if(this.fragCurrent=f,g===R.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(f);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else g=R.FragmentState.NOT_LOADED}g===R.FragmentState.NOT_LOADED||g===R.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,o)):g===R.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,_.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},v.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,_.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var f=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&&f){var g=this.hls.nextLoadLevel,S=f[g],P=this.fragLastKbps;P&&this.fragCurrent?o=this.fragCurrent.duration*S.maxBitrate/(1e3*P)+1:o=0}else o=0;var B=this.getBufferedFrag(d.currentTime+o);if(B){var H=this.followingBufferedFrag(B);if(H){this.abortCurrentFrag();var Y=H.maxStartPTS?H.maxStartPTS:H.start,j=H.duration,N=Math.max(B.end,Y+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===T.State.KEY_LOADING&&(this.state=T.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},v.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,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 O.default(this.config,o,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},v.onMediaPlaying=function(){this.tick()},v.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(F.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(f,d){var o=!1,E=!1,g;d.levels.forEach(function(S){g=S.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(o=!0),g.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=o&&E&&!Object(M.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},v.onLevelLoading=function(f,d){var o=this.levels;if(!o||this.state!==T.State.IDLE)return;var E=o[d.level];(!E.details||E.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(E.details))&&(this.state=T.State.WAITING_LEVEL)},v.onLevelLoaded=function(f,d){var o,E=this.levels,g=d.level,S=d.details,P=S.totalduration;if(!E){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+P);var B=this.fragCurrent;B&&(this.state===T.State.FRAG_LOADING||this.state===T.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==d.level&&B.loader&&(this.state=T.State.IDLE,B.loader.abort()));var H=E[g],Y=0;if(S.live||(o=H.details)!==null&&o!==void 0&&o.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;Y=this.alignPlaylists(S,H.details)}if(H.details=S,this.levelLastLoaded=g,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:S,level:g}),this.state===T.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=T.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,Y),this.tick()},v._handleFragmentLoadProgress=function(f){var d,o=f.frag,E=f.part,g=f.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var P=S[o.level],B=P.details;if(!B){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var H=P.videoCodec,Y=B.PTSKnown||!B.live,j=(d=o.initSegment)===null||d===void 0?void 0:d.data,N=this._getAudioCodec(P),Q=this.transmuxer=this.transmuxer||new w.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=E?E.index:-1,pe=ne!==-1,xe=new L.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,g.byteLength,ne,pe),Ie=this.initPTS[o.cc];Q.push(g,j,N,H,o,E,B.totalduration,Y,xe,Ie)},v.onAudioTrackSwitching=function(f,d){var o=this.altAudio,E=!!d.url,g=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 S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;o&&P.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:g})}},v.onAudioTrackSwitched=function(f,d){var o=d.id,E=!!this.hls.audioTracks[o].url;if(E){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=E,this.tick()},v.onBufferCreated=function(f,d){var o=d.tracks,E,g,S=!1;for(var P in o){var B=o[P];if(B.id==="main"){if(g=P,E=B,P==="video"){var H=o[P];H&&(this.videoBuffer=H.buffer)}}else S=!0}S&&E?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(f,d){var o=d.frag,E=d.part;if(o&&o.type!==_.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===T.State.PARSED&&(this.state=T.State.IDLE);return}var g=E?E.stats:o.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,E)},v.onError=function(f,d){switch(d.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,d);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==T.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=T.State.ERROR):!d.levelRetry&&this.state===T.State.WAITING_LEVEL&&(this.state=T.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===T.State.PARSING||this.state===T.State.PARSED)){var o=!0,E=this.getFwdBufferInfo(this.media,_.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}},v.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var o=I.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=T.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(f,d){var o=d.type;if(o!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(o===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,o,_.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(f,d){this.levels=d.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var f=this.media,d=f.currentTime,o=this.startPosition;if(o>=0&&d<o){if(f.seeking){p.logger.log("could not seek to "+o+", already seeking at "+d);return}var E=I.BufferHelper.getBuffered(f),g=E.length?E.start(0):0,S=g-o;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(p.logger.log("adjusting start position by "+S+" to match buffer start"),o+=S,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),f.currentTime=o}},v._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.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},v._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(o){var E=d.hls;if(!o||E.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=T.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var g=f.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),E.trigger(U.Events.FRAG_LOADED,o)})},v._handleTransmuxComplete=function(f){var d,o="main",E=this.hls,g=f.remuxResult,S=f.chunkMeta,P=this.getCurrentContext(S);if(!P){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var B=P.frag,H=P.part,Y=P.level,j=g.video,N=g.text,Q=g.id3,ne=g.initSegment,pe=this.altAudio?void 0:g.audio;if(this.fragContextChanged(B))return;if(this.state=T.State.PARSING,ne){ne.tracks&&(this._bufferInitSegment(Y,ne.tracks,B,S),E.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:o,tracks:ne.tracks}));var xe=ne.initPTS,Ie=ne.timescale;Object(F.isFiniteNumber)(xe)&&(this.initPTS[B.cc]=xe,E.trigger(U.Events.INIT_PTS_FOUND,{frag:B,id:o,initPTS:xe,timescale:Ie}))}if(j&&g.independent!==!1){if(Y.details){var Ae=j.startPTS,De=j.endPTS,Ce=j.startDTS,Oe=j.endDTS;if(H)H.elementaryStreams[j.type]={startPTS:Ae,endPTS:De,startDTS:Ce,endDTS:Oe};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<Ae){this.backtrack(B);return}B.setElementaryStreamInfo(j.type,B.start,De,B.start,Oe,!0)}B.setElementaryStreamInfo(j.type,Ae,De,Ce,Oe),this.bufferFragmentData(j,B,H,S)}}else if(g.independent===!1){this.backtrack(B);return}if(pe){var fe=pe.startPTS,Pe=pe.endPTS,qe=pe.startDTS,Ve=pe.endDTS;H&&(H.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:Pe,startDTS:qe,endDTS:Ve}),B.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,fe,Pe,qe,Ve),this.bufferFragmentData(pe,B,H,S)}if(Q!=null&&(d=Q.samples)!==null&&d!==void 0&&d.length){var Ze={frag:B,id:o,samples:Q.samples};E.trigger(U.Events.FRAG_PARSING_METADATA,Ze)}if(N){var ct={frag:B,id:o,samples:N.samples};E.trigger(U.Events.FRAG_PARSING_USERDATA,ct)}},v._bufferInitSegment=function(f,d,o,E){var g=this;if(this.state!==T.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var S=d.audio,P=d.video,B=d.audiovideo;if(S){var H=f.audioCodec,Y=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(H&&(H.indexOf("mp4a.40.5")!==-1?H="mp4a.40.2":H="mp4a.40.5"),S.metadata.channelCount!==1&&Y.indexOf("firefox")===-1&&(H="mp4a.40.5")),Y.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(H="mp4a.40.2",this.log("Android: force audio codec to "+H)),f.audioCodec&&f.audioCodec!==H&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+H+'"'),S.levelCodec=H,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(H||"")+"/"+(f.audioCodec||"")+"/"+S.codec+"]")}P&&(P.levelCodec=f.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+P.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(j){var N=d[j],Q=N.initSegment;Q!=null&&Q.byteLength&&g.hls.trigger(U.Events.BUFFER_APPENDING,{type:j,data:Q,frag:o,part:null,chunkMeta:E,parent:o.type})}),this.tick()},v.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=T.State.BACKTRACKING},v.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var o=f.currentTime;if(I.BufferHelper.isBuffered(f,o)?d=this.getAppendedFrag(o):I.BufferHelper.isBuffered(f,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var E=this.fragPlaying,g=d.level;(!E||d.sn!==E.sn||E.level!==g||d.urlId!==E.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:d}),(!E||E.level!==g)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=d)}}},a(D,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(T.default)},"./src/controller/subtitle-stream-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"SubtitleStreamController",function(){return s});var F=A("./src/events.ts"),T=A("./src/utils/logger.ts"),M=A("./src/utils/buffer-helper.ts"),U=A("./src/controller/fragment-finders.ts"),I=A("./src/utils/discontinuities.ts"),R=A("./src/controller/level-helper.ts"),_=A("./src/controller/fragment-tracker.ts"),y=A("./src/controller/base-stream-controller.ts"),w=A("./src/types/loader.ts"),L=A("./src/types/level.ts");function O(u,b){for(var m=0;m<b.length;m++){var h=b[m];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}function C(u,b,m){return b&&O(u.prototype,b),m&&O(u,m),u}function p(u,b){u.prototype=Object.create(b.prototype),u.prototype.constructor=u,l(u,b)}function l(u,b){return l=Object.setPrototypeOf||function(h,D){return h.__proto__=D,h},l(u,b)}var a=500,s=function(u){p(b,u);function b(h,D){var v;return v=u.call(this,h,D,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var m=b.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var D=this.hls;D.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(F.Events.ERROR,this.onError,this),D.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(F.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(F.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(F.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var D=this.hls;D.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(F.Events.ERROR,this.onError,this),D.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(F.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(F.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(F.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(a),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(D,v){this.mainDetails=v.details},m.onSubtitleFragProcessed=function(D,v){var c=v.frag,f=v.success;if(this.fragPrevious=c,this.state=y.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,E=c.start,g=0;g<d.length;g++)if(E>=d[g].start&&E<=d[g].end){o=d[g];break}var S=c.start+c.duration;o?o.end=S:(o={start:E,end:S},d.push(o)),this.fragmentTracker.fragBuffered(c)},m.onBufferFlushing=function(D,v){var c=v.startOffset,f=v.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var E=o[d].details,g=E.targetduration,S=f-g;if(S<=0)return;v.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(P){for(var B=0;B<P.length;){if(P[B].end<=S){P.shift();continue}else if(P[B].start<S)P[B].start=S;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(c,S,w.PlaylistLevelType.SUBTITLE)}},m.onError=function(D,v){var c,f=v.frag;if(!f||f.type!==w.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},m.onSubtitleTracksUpdated=function(D,v){var c=this,f=v.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new L.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(D,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(a)},m.onSubtitleTrackLoaded=function(D,v){var c,f=v.details,d=v.id,o=this.currentTrackId,E=this.levels;if(!E.length)return;var g=E[o];if(d>=E.length||d!==o||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=g.details)!==null&&c!==void 0&&c.live){var S=this.mainDetails;if(f.deltaUpdateFailed||!S)return;var P=S.fragments[0];if(!g.details)f.hasProgramDateTime&&S.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(f,S):P&&Object(R.addSliding)(f,P.start);else{var B=this.alignPlaylists(f,g.details);B===0&&P&&Object(R.addSliding)(f,P.start)}}if(g.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var H=Object(U.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);H||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},m._handleFragmentLoadComplete=function(D){var v=D.frag,c=D.payload,f=v.decryptdata,d=this.hls;if(this.fragContextChanged(v))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(E){var g=performance.now();d.trigger(F.Events.FRAG_DECRYPTED,{frag:v,payload:E,stats:{tstart:o,tdecrypt:g}})})}},m.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var D,v=this.currentTrackId,c=this.levels;if(!c.length||!c[v]||!c[v].details)return;var f=c[v].details,d=f.targetduration,o=this.config,E=this.media,g=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-d,o.maxBufferHole),S=g.end,P=g.len,B=this.getMaxBufferLength()+d;if(P>B)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var H=f.fragments,Y=H.length,j=f.edge,N,Q=this.fragPrevious;if(S<j){var ne=o.maxFragLookUpTolerance;Q&&f.hasProgramDateTime&&(N=Object(U.findFragmentByPDT)(H,Q.endProgramDateTime,ne)),N||(N=Object(U.findFragmentByPTS)(Q,H,S,ne),!N&&Q&&Q.start<H[0].start&&(N=H[0]))}else N=H[Y-1];(D=N)!==null&&D!==void 0&&D.encrypted?(T.logger.log("Loading key for "+N.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(F.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===_.FragmentState.NOT_LOADED&&this.loadFragment(N,f,S)}},m.loadFragment=function(D,v,c){this.fragCurrent=D,u.prototype.loadFragment.call(this,D,v,c)},C(b,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),b}(y.default)},"./src/controller/subtitle-track-controller.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/events.ts"),T=A("./src/utils/texttrack-utils.ts"),M=A("./src/controller/base-playlist-controller.ts"),U=A("./src/types/loader.ts");function I(O,C){for(var p=0;p<C.length;p++){var l=C[p];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(O,l.key,l)}}function R(O,C,p){return C&&I(O.prototype,C),p&&I(O,p),O}function _(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,y(O,C)}function y(O,C){return y=Object.setPrototypeOf||function(l,a){return l.__proto__=a,l},y(O,C)}var w=function(O){_(C,O);function C(l){var a;return a=O.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 p=C.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,O.prototype.destroy.call(this)},p.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(F.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(F.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(F.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(F.Events.ERROR,this.onError,this)},p.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)},p.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},p.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=L(this.media.textTracks);a.forEach(function(s){Object(T.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},p.onSubtitleTrackLoaded=function(a,s){var u=s.id,b=s.details,m=this.trackId,h=this.tracksInGroup[m];if(!h){this.warn("Invalid subtitle track id "+u);return}var D=h.details;h.details=s.details,this.log("subtitle track "+u+" loaded ["+b.startSN+"-"+b.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,D))},p.onLevelLoading=function(a,s){this.switchLevel(s.level)},p.onLevelSwitching=function(a,s){this.switchLevel(s.level)},p.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 b=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(v){return!u||v.groupId===u});this.tracksInGroup=m;var h=this.findTrackId(b==null?void 0:b.name)||this.findTrackId();this.groupId=u;var D={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(F.Events.SUBTITLE_TRACKS_UPDATED,D),h!==-1&&this.setSubtitleTrack(h,b)}},p.findTrackId=function(a){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var b=s[u];if((!this.selectDefaultTrack||b.default)&&(!a||a===b.name))return b.id}return-1},p.onError=function(a,s){if(O.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===U.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},p.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,b=s.groupId,m=s.url;if(a)try{m=a.addDirectives(m)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADING,{url:m,id:u,groupId:b,deliveryDirectives:a||null})}},p.toggleTrackModes=function(a){var s=this,u=this.media,b=this.subtitleDisplay,m=this.trackId;if(!u)return;var h=L(u.textTracks),D=h.filter(function(f){return f.groupId===s.groupId});if(a===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var v=D[m];v&&(v.mode="disabled")}var c=D[a];c&&(c.mode=b?"showing":"hidden")},p.setSubtitleTrack=function(a,s){var u,b=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=b[a])!==null&&u!==void 0&&u.details)||a<-1||a>=b.length)return;this.clearTimer();var m=b[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,m){var h=m.id,D=m.groupId,v=D===void 0?"":D,c=m.name,f=m.type,d=m.url;this.hls.trigger(F.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:v,name:c,type:f,url:d});var o=this.switchParams(m.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(F.Events.SUBTITLE_TRACK_SWITCH,{id:a})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=L(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)},R(C,[{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)}}]),C}(M.default);function L(O){for(var C=[],p=0;p<O.length;p++){var l=O[p];l.kind==="subtitles"&&l.label&&C.push(O[p])}return C}K.default=w},"./src/controller/timeline-controller.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"TimelineController",function(){return L});var F=A("./src/polyfills/number.ts"),T=A("./src/events.ts"),M=A("./src/utils/cea-608-parser.ts"),U=A("./src/utils/output-filter.ts"),I=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),_=A("./src/utils/imsc1-ttml-parser.ts"),y=A("./src/types/loader.ts"),w=A("./src/utils/logger.ts"),L=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=p(),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 U.default(this,"textTrack1"),b=new U.default(this,"textTrack2"),m=new U.default(this,"textTrack3"),h=new U.default(this,"textTrack4");this.cea608Parser1=new M.default(1,u,b),this.cea608Parser2=new M.default(3,m,h)}s.on(T.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(T.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(T.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(T.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(T.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(T.Events.FRAG_LOADING,this.onFragLoading,this),s.on(T.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(T.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(T.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(T.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(T.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(T.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=l.prototype;return a.destroy=function(){var u=this.hls;u.off(T.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(T.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(T.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(T.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(T.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(T.Events.FRAG_LOADING,this.onFragLoading,this),u.off(T.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(T.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(T.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(T.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(T.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(T.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,b,m,h,D){for(var v=!1,c=D.length;c--;){var f=D[c],d=C(f[0],f[1],b,m);if(d>=0&&(f[0]=Math.min(f[0],b),f[1]=Math.max(f[1],m),v=!0,d/(m-b)>.5))return}if(v||D.push([b,m]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,b,m,h)}else{var E=this.Cues.newCue(null,b,m,h);this.hls.trigger(T.Events.CUES_PARSED,{type:"captions",cues:E,track:u})}},a.onInitPtsFound=function(u,b){var m=this,h=b.frag,D=b.id,v=b.initPTS,c=b.timescale,f=this.unparsedVttFrags;D==="main"&&(this.initPTS[h.cc]=v,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){m.onFragLoaded(T.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(u){var b=this.media;if(b)for(var m=0;m<b.textTracks.length;m++){var h=b.textTracks[m];if(h[u])return h}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 b=this.captionsProperties,m=this.captionsTracks,h=this.media,D=b[u],v=D.label,c=D.languageCode,f=this.getExistingTrack(u);if(f)m[u]=f,Object(R.clearCurrentCues)(m[u]),Object(R.sendAddTrackEvent)(m[u],h);else{var d=this.createTextTrack("captions",v,c);d&&(d[u]=!0,m[u]=d)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var b=this.captionsProperties[u];if(!b)return;var m=b.label,h={_id:u,label:m,kind:"captions",default:b.media?!!b.media.default:!1,closedCaptions:b.media};this.nonNativeCaptionsTracks[u]=h,this.hls.trigger(T.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},a.createTextTrack=function(u,b,m){var h=this.media;return h?h.addTextTrack(u,b,m):void 0},a.onMediaAttaching=function(u,b){this.media=b.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(b){Object(R.clearCurrentCues)(u[b]),delete u[b]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),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 b=u.textTracks;if(b)for(var m=0;m<b.length;m++)Object(R.clearCurrentCues)(b[m])},a.onSubtitleTracksUpdated=function(u,b){var m=this;this.textTracks=[];var h=b.subtitleTracks||[],D=h.some(function(d){return d.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var v=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var E;if(o<c.length){for(var g=null,S=0;S<c.length;S++)if(O(c[S],d)){g=c[S];break}g&&(E=g)}E?Object(R.clearCurrentCues)(E):(E=m.createTextTrack("subtitles",d.name,d.lang),E&&(E.mode="disabled")),E&&(E.groupId=d.groupId,m.textTracks.push(E))})}else if(!v&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(T.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},a.onManifestLoaded=function(u,b){var m=this;this.config.enableCEA708Captions&&b.captions&&b.captions.forEach(function(h){var D=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!D)return;var v="textTrack"+D[1],c=m.captionsProperties[v];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},a.onFragLoading=function(u,b){var m=this.cea608Parser1,h=this.cea608Parser2,D=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(m&&h))return;if(b.frag.type===y.PlaylistLevelType.MAIN){var c,f,d=b.frag.sn,o=(c=b==null||((f=b.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===D+1||d===D&&o===v+1||(m.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(u,b){var m=b.frag,h=b.payload,D=this.initPTS,v=this.unparsedVttFrags;if(m.type===y.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(F.isFiniteNumber)(D[m.cc])){v.push(b),D.length&&this.hls.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var c=m.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[m.level],d=this.vttCCs;d[m.cc]||(d[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),f&&f.textCodec===_.IMSC1_CODEC?this._parseIMSC1(m,h):this._parseVTTs(m,h,d)}}else this.hls.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,b){var m=this,h=this.hls;Object(_.parseIMSC1)(b,this.initPTS[u.cc],this.timescale[u.cc],function(D){m._appendCues(D,u.level),h.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(D){w.logger.log("Failed to parse IMSC1: "+D),h.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:D})})},a._parseVTTs=function(u,b,m){var h=this,D=this.hls;Object(I.parseWebVTT)(b,this.initPTS[u.cc],this.timescale[u.cc],m,u.cc,u.start,function(v){h._appendCues(v,u.level),D.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(v){h._fallbackToIMSC1(u,b),w.logger.log("Failed to parse VTT cue: "+v),D.trigger(T.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:v})})},a._fallbackToIMSC1=function(u,b){var m=this,h=this.tracks[u.level];h.textCodec||Object(_.parseIMSC1)(b,this.initPTS[u.cc],this.timescale[u.cc],function(){h.textCodec=_.IMSC1_CODEC,m._parseIMSC1(u,b)},function(){h.textCodec="wvtt"})},a._appendCues=function(u,b){var m=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[b];if(h.mode==="disabled")return;u.forEach(function(c){return Object(R.addCueToTrack)(h,c)})}else{var D=this.tracks[b],v=D.default?"default":"subtitles"+b;m.trigger(T.Events.CUES_PARSED,{type:"subtitles",cues:u,track:v})}},a.onFragDecrypted=function(u,b){var m=b.frag;if(m.type===y.PlaylistLevelType.SUBTITLE){if(!Object(F.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(b);return}this.onFragLoaded(T.Events.FRAG_LOADED,b)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,b){var m=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(m&&h))return;for(var D=0;D<b.samples.length;D++){var v=b.samples[D].bytes;if(v){var c=this.extractCea608Data(v);m.addData(b.samples[D].pts,c[0]),h.addData(b.samples[D].pts,c[1])}}},a.onBufferFlushing=function(u,b){var m=b.startOffset,h=b.endOffset,D=b.endOffsetSubtitles,v=b.type,c=this.media;if(!c||c.currentTime<h)return;if(!v||v==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(o){return Object(R.removeCuesInRange)(f[o],m,h)})}if(this.config.renderTextTracksNatively&&(m===0&&D!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(R.removeCuesInRange)(d[o],m,D)})}},a.extractCea608Data=function(u){for(var b=u[0]&31,m=2,h=[[],[]],D=0;D<b;D++){var v=u[m++],c=127&u[m++],f=127&u[m++],d=(4&v)!==0,o=3&v;if(c===0&&f===0)continue;d&&((o===0||o===1)&&(h[o].push(c),h[o].push(f)))}return h},l}();function O(l,a){return l&&l.label===a.name&&!(l.textTrack1||l.textTrack2)}function C(l,a,s,u){return Math.min(a,u)-Math.max(l,s)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return F});var F=function(){function T(U,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=U,this.aesIV=I}var M=T.prototype;return M.decrypt=function(I,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,I)},T}()},"./src/crypt/aes-decryptor.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"removePadding",function(){return T}),A.d(K,"default",function(){return M});var F=A("./src/utils/typed-array.ts");function T(U){var I=U.byteLength,R=I&&new DataView(U.buffer).getUint8(I-1);return R?Object(F.sliceUint8)(U,0,I-R):U}var M=function(){function U(){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 I=U.prototype;return I.uint8ArrayToUint32Array_=function(_){for(var y=new DataView(_),w=new Uint32Array(4),L=0;L<4;L++)w[L]=y.getUint32(L*4);return w},I.initTable=function(){var _=this.sBox,y=this.invSBox,w=this.subMix,L=w[0],O=w[1],C=w[2],p=w[3],l=this.invSubMix,a=l[0],s=l[1],u=l[2],b=l[3],m=new Uint32Array(256),h=0,D=0,v=0;for(v=0;v<256;v++)v<128?m[v]=v<<1:m[v]=v<<1^283;for(v=0;v<256;v++){var c=D^D<<1^D<<2^D<<3^D<<4;c=c>>>8^c&255^99,_[h]=c,y[c]=h;var f=m[h],d=m[f],o=m[d],E=m[c]*257^c*16843008;L[h]=E<<24|E>>>8,O[h]=E<<16|E>>>16,C[h]=E<<8|E>>>24,p[h]=E,E=o*16843009^d*65537^f*257^h*16843008,a[c]=E<<24|E>>>8,s[c]=E<<16|E>>>16,u[c]=E<<8|E>>>24,b[c]=E,h?(h=f^m[m[m[o^f]]],D^=m[m[D]]):h=D=1}},I.expandKey=function(_){for(var y=this.uint8ArrayToUint32Array_(_),w=!0,L=0;L<y.length&&w;)w=y[L]===this.key[L],L++;if(w)return;this.key=y;var O=this.keySize=y.length;if(O!==4&&O!==6&&O!==8)throw new Error("Invalid aes key size="+O);var C=this.ksRows=(O+6+1)*4,p,l,a=this.keySchedule=new Uint32Array(C),s=this.invKeySchedule=new Uint32Array(C),u=this.sBox,b=this.rcon,m=this.invSubMix,h=m[0],D=m[1],v=m[2],c=m[3],f,d;for(p=0;p<C;p++){if(p<O){f=a[p]=y[p];continue}d=f,p%O===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^=b[p/O|0]<<24):O>6&&p%O===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),a[p]=f=(a[p-O]^d)>>>0}for(l=0;l<C;l++)p=C-l,l&3?d=a[p]:d=a[p-4],l<4||p<=4?s[l]=d:s[l]=h[u[d>>>24]]^D[u[d>>>16&255]]^v[u[d>>>8&255]]^c[u[d&255]],s[l]=s[l]>>>0},I.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},I.decrypt=function(_,y,w){for(var L=this.keySize+6,O=this.invKeySchedule,C=this.invSBox,p=this.invSubMix,l=p[0],a=p[1],s=p[2],u=p[3],b=this.uint8ArrayToUint32Array_(w),m=b[0],h=b[1],D=b[2],v=b[3],c=new Int32Array(_),f=new Int32Array(c.length),d,o,E,g,S,P,B,H,Y,j,N,Q,ne,pe,xe=this.networkToHostOrderSwap;y<c.length;){for(Y=xe(c[y]),j=xe(c[y+1]),N=xe(c[y+2]),Q=xe(c[y+3]),S=Y^O[0],P=Q^O[1],B=N^O[2],H=j^O[3],ne=4,pe=1;pe<L;pe++)d=l[S>>>24]^a[P>>16&255]^s[B>>8&255]^u[H&255]^O[ne],o=l[P>>>24]^a[B>>16&255]^s[H>>8&255]^u[S&255]^O[ne+1],E=l[B>>>24]^a[H>>16&255]^s[S>>8&255]^u[P&255]^O[ne+2],g=l[H>>>24]^a[S>>16&255]^s[P>>8&255]^u[B&255]^O[ne+3],S=d,P=o,B=E,H=g,ne=ne+4;d=C[S>>>24]<<24^C[P>>16&255]<<16^C[B>>8&255]<<8^C[H&255]^O[ne],o=C[P>>>24]<<24^C[B>>16&255]<<16^C[H>>8&255]<<8^C[S&255]^O[ne+1],E=C[B>>>24]<<24^C[H>>16&255]<<16^C[S>>8&255]<<8^C[P&255]^O[ne+2],g=C[H>>>24]<<24^C[S>>16&255]<<16^C[P>>8&255]<<8^C[B&255]^O[ne+3],f[y]=xe(d^m),f[y+1]=xe(g^h),f[y+2]=xe(E^D),f[y+3]=xe(o^v),m=Y,h=j,D=N,v=Q,y=y+4}return f.buffer},U}()},"./src/crypt/decrypter.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return y});var F=A("./src/crypt/aes-crypto.ts"),T=A("./src/crypt/fast-aes-key.ts"),M=A("./src/crypt/aes-decryptor.ts"),U=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/utils/typed-array.ts"),_=16,y=function(){function w(O,C,p){var l=p===void 0?{}:p,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=O,this.config=C,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(b){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var L=w.prototype;return L.destroy=function(){this.observer=null},L.isSync=function(){return this.config.enableSoftwareAES},L.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var p=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(p):p},L.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},L.decrypt=function(C,p,l,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),p,l);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),p,l).then(a)},L.softwareDecrypt=function(C,p,l){var a=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(C=Object(I.appendUint8Array)(u,C),this.remainderData=null);var b=this.getValidChunk(C);if(!b.length)return null;a&&(l=a);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new M.default),m.expandKey(p);var h=s;return this.currentResult=m.decrypt(b.buffer,0,l),this.currentIV=Object(R.sliceUint8)(b,-16).buffer,h||null},L.webCryptoDecrypt=function(C,p,l){var a=this,s=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new T.default(s,p)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var b=new F.default(s,l);return b.decrypt(C.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,C,p,l)})},L.onWebCryptoError=function(C,p,l,a){return U.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,l,a)},L.getValidChunk=function(C){var p=C,l=C.length-C.length%_;return l!==C.length&&(p=Object(R.sliceUint8)(C,0,l),this.remainderData=Object(R.sliceUint8)(C,l)),p},L.logOnce=function(C){if(!this.logEnabled)return;U.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return F});var F=function(){function T(U,I){this.subtle=void 0,this.key=void 0,this.subtle=U,this.key=I}var M=T.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},T}()},"./src/demux/aacdemuxer.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/demux/base-audio-demuxer.ts"),T=A("./src/demux/adts.ts"),M=A("./src/utils/logger.ts"),U=A("./src/demux/id3.ts");function I(y,w){y.prototype=Object.create(w.prototype),y.prototype.constructor=y,R(y,w)}function R(y,w){return R=Object.setPrototypeOf||function(O,C){return O.__proto__=C,O},R(y,w)}var _=function(y){I(w,y);function w(O,C){var p;return p=y.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=O,p.config=C,p}var L=w.prototype;return L.resetInitSegment=function(C,p,l){y.prototype.resetInitSegment.call(this,C,p,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:l,inputTimeScale:9e4,dropped:0}},w.probe=function(C){if(!C)return!1;for(var p=U.getID3Data(C,0)||[],l=p.length,a=C.length;l<a;l++)if(T.probe(C,l))return M.logger.log("ADTS sync word found !"),!0;return!1},L.canParse=function(C,p){return T.canParse(C,p)},L.appendFrame=function(C,p,l){T.initTrackConfig(C,this.observer,p,l,C.manifestCodec);var a=T.appendFrame(C,p,l,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},w}(F.default);_.minProbeByteLength=9,K.default=_},"./src/demux/adts.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"getAudioConfig",function(){return U}),A.d(K,"isHeaderPattern",function(){return I}),A.d(K,"getHeaderLength",function(){return R}),A.d(K,"getFullFrameLength",function(){return _}),A.d(K,"canGetFrameLength",function(){return y}),A.d(K,"isHeader",function(){return w}),A.d(K,"canParse",function(){return L}),A.d(K,"probe",function(){return O}),A.d(K,"initTrackConfig",function(){return C}),A.d(K,"getFrameDuration",function(){return p}),A.d(K,"parseFrameHeader",function(){return l}),A.d(K,"appendFrame",function(){return a});var F=A("./src/utils/logger.ts"),T=A("./src/errors.ts"),M=A("./src/events.ts");function U(s,u,b,m){var h,D,v,c,f=navigator.userAgent.toLowerCase(),d=m,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((u[b+2]&192)>>>6)+1;var E=(u[b+2]&60)>>>2;if(E>o.length-1){s.trigger(M.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return v=(u[b+2]&1)<<2,v|=(u[b+3]&192)>>>6,F.logger.log("manifest codec:"+m+", ADTS type:"+h+", samplingIndex:"+E),/firefox/i.test(f)?E>=6?(h=5,c=new Array(4),D=E-3):(h=2,c=new Array(2),D=E):f.indexOf("android")!==-1?(h=2,c=new Array(2),D=E):(h=5,c=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&E>=6?D=E-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(E>=6&&v===1||/vivaldi/i.test(f))||!m&&v===1)&&(h=2,c=new Array(2)),D=E)),c[0]=h<<3,c[0]|=(E&14)>>1,c[1]|=(E&1)<<7,c[1]|=v<<3,h===5&&(c[1]|=(D&14)>>1,c[2]=(D&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:o[E],channelCount:v,codec:"mp4a.40."+h,manifestCodec:d}}function I(s,u){return s[u]===255&&(s[u+1]&246)===240}function R(s,u){return s[u+1]&1?7:9}function _(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function y(s,u){return u+5<s.length}function w(s,u){return u+1<s.length&&I(s,u)}function L(s,u){return y(s,u)&&I(s,u)&&_(s,u)<=s.length-u}function O(s,u){if(w(s,u)){var b=R(s,u);if(u+b>=s.length)return!1;var m=_(s,u);if(m<=b)return!1;var h=u+m;return h===s.length||w(s,h)}return!1}function C(s,u,b,m,h){if(!s.samplerate){var D=U(u,b,m,h);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,F.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function p(s){return 1024*9e4/s}function l(s,u,b,m,h){var D=R(s,u),v=_(s,u);if(v-=D,v>0){var c=b+m*h;return{headerLength:D,frameLength:v,stamp:c}}}function a(s,u,b,m,h){var D=p(s.samplerate),v=l(u,b,m,h,D);if(v){var c=v.frameLength,f=v.headerLength,d=v.stamp,o=f+c,E=Math.max(0,b+o-u.length),g;E?(g=new Uint8Array(o-f),g.set(u.subarray(b+f,u.length),0)):g=u.subarray(b+f,b+o);var S={unit:g,pts:d};return E||s.samples.push(S),{sample:S,length:o,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"initPTSFn",function(){return _});var F=A("./src/polyfills/number.ts"),T=A("./src/demux/id3.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),U=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/typed-array.ts"),R=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=y.prototype;return w.resetInitSegment=function(O,C,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(O,C){return!1},w.appendFrame=function(O,C,p){},w.demux=function(O,C){this.cachedData&&(O=Object(U.appendUint8Array)(this.cachedData,O),this.cachedData=null);var p=T.getID3Data(O,0),l=p?p.length:0,a,s,u=this._audioTrack,b=this._id3Track,m=p?T.getTimeStamp(p):void 0,h=O.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(m,C)),p&&p.length>0&&b.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),s=this.initPTS;l<h;){if(this.canParse(O,l)){var D=this.appendFrame(u,O,l);D?(this.frameIndex++,s=D.sample.pts,l+=D.length,a=l):l=h}else T.canParse(O,l)?(p=T.getID3Data(O,l),b.samples.push({pts:s,dts:s,data:p}),l+=p.length,a=l):l++;if(l===h&&a!==h){var v=Object(I.sliceUint8)(O,a);this.cachedData?this.cachedData=Object(U.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:u,avcTrack:Object(M.dummyTrack)(),id3Track:b,textTrack:Object(M.dummyTrack)()}},w.demuxSampleAes=function(O,C,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(O){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},w.destroy=function(){},y}(),_=function(w,L){return Object(F.isFiniteNumber)(w)?w*90:L*9e4};K.default=R},"./src/demux/chunk-cache.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return F});var F=function(){function M(){this.chunks=[],this.dataLength=0}var U=M.prototype;return U.push=function(R){this.chunks.push(R),this.dataLength+=R.length},U.flush=function(){var R=this.chunks,_=this.dataLength,y;if(R.length)R.length===1?y=R[0]:y=T(R,_);else return new Uint8Array(0);return this.reset(),y},U.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function T(M,U){for(var I=new Uint8Array(U),R=0,_=0;_<M.length;_++){var y=M[_];I.set(y,R),R+=y.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"dummyTrack",function(){return F});function F(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/utils/logger.ts"),T=function(){function M(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var U=M.prototype;return U.loadWord=function(){var R=this.data,_=this.bytesAvailable,y=R.byteLength-_,w=new Uint8Array(4),L=Math.min(4,_);if(L===0)throw new Error("no bytes available");w.set(R.subarray(y,y+L)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=L*8,this.bytesAvailable-=L},U.skipBits=function(R){var _;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,_=R>>3,R-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},U.readBits=function(R){var _=Math.min(this.bitsAvailable,R),y=this.word>>>32-_;return R>32&&F.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=R-_,_>0&&this.bitsAvailable?y<<_|this.readBits(_):y},U.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},U.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(R){for(var _=8,y=8,w,L=0;L<R;L++)y!==0&&(w=this.readEG(),y=(_+w+256)%256),_=y===0?_:y},U.readSPS=function(){var R=0,_=0,y=0,w=0,L,O,C,p=this.readUByte.bind(this),l=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),b=this.skipEG.bind(this),m=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);p();var D=p();if(l(5),u(3),p(),m(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var v=a();if(v===3&&u(1),m(),m(),u(1),s())for(O=v!==3?8:12,C=0;C<O;C++)s()&&(C<6?h(16):h(64))}m();var c=a();if(c===0)a();else if(c===1)for(u(1),b(),b(),L=a(),C=0;C<L;C++)b();m(),u(1);var f=a(),d=a(),o=l(1);o===0&&u(1),u(1),s()&&(R=a(),_=a(),y=a(),w=a());var E=[1,1];if(s()&&s()){var g=p();switch(g){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=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((f+1)*16-R*2-_*2),height:(2-o)*(d+1)*16-(o?2:4)*(y+w),pixelRatio:E}},U.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();K.default=T},"./src/demux/id3.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"isHeader",function(){return F}),A.d(K,"isFooter",function(){return T}),A.d(K,"getID3Data",function(){return M}),A.d(K,"canParse",function(){return I}),A.d(K,"getTimeStamp",function(){return R}),A.d(K,"isTimeStampFrame",function(){return _}),A.d(K,"getID3Frames",function(){return w}),A.d(K,"decodeFrame",function(){return L}),A.d(K,"utf8ArrayToStr",function(){return a}),A.d(K,"testables",function(){return s});var F=function(h,D){return D+10<=h.length&&(h[D]===73&&h[D+1]===68&&h[D+2]===51&&(h[D+3]<255&&h[D+4]<255&&(h[D+6]<128&&h[D+7]<128&&h[D+8]<128&&h[D+9]<128)))},T=function(h,D){return D+10<=h.length&&(h[D]===51&&h[D+1]===68&&h[D+2]===73&&(h[D+3]<255&&h[D+4]<255&&(h[D+6]<128&&h[D+7]<128&&h[D+8]<128&&h[D+9]<128)))},M=function(h,D){for(var v=D,c=0;F(h,D);){c+=10;var f=U(h,D+6);c+=f,T(h,D+10)&&(c+=10),D+=c}return c>0?h.subarray(v,v+c):void 0},U=function(h,D){var v=0;return v=(h[D]&127)<<21,v|=(h[D+1]&127)<<14,v|=(h[D+2]&127)<<7,v|=h[D+3]&127,v},I=function(h,D){return F(h,D)&&U(h,D+6)+10<=h.length-D},R=function(h){for(var D=w(h),v=0;v<D.length;v++){var c=D[v];if(_(c))return l(c)}return},_=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},y=function(h){var D=String.fromCharCode(h[0],h[1],h[2],h[3]),v=U(h,4),c=10;return{type:D,size:v,data:h.subarray(c,c+v)}},w=function(h){for(var D=0,v=[];F(h,D);){var c=U(h,D+6);D+=10;for(var f=D+c;D+8<f;){var d=y(h.subarray(D)),o=L(d);o&&v.push(o),D+=d.size+10}T(h,D)&&(D+=10)}return v},L=function(h){return h.type==="PRIV"?O(h):h.type[0]==="W"?p(h):C(h)},O=function(h){if(h.size<2)return;var D=a(h.data,!0),v=new Uint8Array(h.data.subarray(D.length+1));return{key:h.type,info:D,data:v.buffer}},C=function(h){if(h.size<2)return;if(h.type==="TXXX"){var D=1,v=a(h.data.subarray(D),!0);D+=v.length+1;var c=a(h.data.subarray(D));return{key:h.type,info:v,data:c}}var f=a(h.data.subarray(1));return{key:h.type,data:f}},p=function(h){if(h.type==="WXXX"){if(h.size<2)return;var D=1,v=a(h.data.subarray(D),!0);D+=v.length+1;var c=a(h.data.subarray(D));return{key:h.type,info:v,data:c}}var f=a(h.data);return{key:h.type,data:f}},l=function(h){if(h.data.byteLength===8){var D=new Uint8Array(h.data),v=D[3]&1,c=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return c/=45,v&&(c+=4772185884e-2),Math.round(c)}return},a=function(h,D){D===void 0&&(D=!1);var v=b();if(v){var c=v.decode(h);if(D){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,o,E,g,S="",P=0;P<d;){if(o=h[P++],o===0&&D)return S;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:S+=String.fromCharCode(o);break;case 12:case 13:E=h[P++],S+=String.fromCharCode((o&31)<<6|E&63);break;case 14:E=h[P++],g=h[P++],S+=String.fromCharCode((o&15)<<12|(E&63)<<6|(g&63)<<0);break;default:}}return S},s={decodeTextFrame:C},u;function b(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/demux/base-audio-demuxer.ts"),T=A("./src/demux/id3.ts"),M=A("./src/utils/logger.ts"),U=A("./src/demux/mpegaudio.ts");function I(y,w){y.prototype=Object.create(w.prototype),y.prototype.constructor=y,R(y,w)}function R(y,w){return R=Object.setPrototypeOf||function(O,C){return O.__proto__=C,O},R(y,w)}var _=function(y){I(w,y);function w(){return y.apply(this,arguments)||this}var L=w.prototype;return L.resetInitSegment=function(C,p,l){y.prototype.resetInitSegment.call(this,C,p,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:l,inputTimeScale:9e4,dropped:0}},w.probe=function(C){if(!C)return!1;for(var p=T.getID3Data(C,0)||[],l=p.length,a=C.length;l<a;l++)if(U.probe(C,l))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},L.canParse=function(C,p){return U.canParse(C,p)},L.appendFrame=function(C,p,l){return this.initPTS===null?void 0:U.appendFrame(C,p,l,this.initPTS,this.frameIndex)},w}(F.default);_.minProbeByteLength=4,K.default=_},"./src/demux/mp4demuxer.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/utils/mp4-tools.ts"),T=A("./src/demux/dummy-demuxed-track.ts"),M=function(){function U(R,_){this.remainderData=null,this.config=void 0,this.config=_}var I=U.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},U.probe=function(_){return Object(F.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},I.demux=function(_){var y=_,w=Object(T.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(F.appendUint8Array)(this.remainderData,_));var L=Object(F.segmentValidRange)(y);this.remainderData=L.remainder,w.samples=L.valid||new Uint8Array}else w.samples=y;return{audioTrack:Object(T.dummyTrack)(),avcTrack:w,id3Track:Object(T.dummyTrack)(),textTrack:Object(T.dummyTrack)()}},I.flush=function(){var _=Object(T.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(T.dummyTrack)(),avcTrack:_,id3Track:Object(T.dummyTrack)(),textTrack:Object(T.dummyTrack)()}},I.demuxSampleAes=function(_,y,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},U}();M.minProbeByteLength=1024,K.default=M},"./src/demux/mpegaudio.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"appendFrame",function(){return R}),A.d(K,"parseHeader",function(){return _}),A.d(K,"isHeaderPattern",function(){return y}),A.d(K,"isHeader",function(){return w}),A.d(K,"canParse",function(){return L}),A.d(K,"probe",function(){return O});var F=null,T=[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],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function R(C,p,l,a,s){if(l+24>p.length)return;var u=_(p,l);if(u&&l+u.frameLength<=p.length){var b=u.samplesPerFrame*9e4/u.sampleRate,m=a+s*b,h={unit:p.subarray(l,l+u.frameLength),pts:m,dts:m};return C.config=[],C.channelCount=u.channelCount,C.samplerate=u.sampleRate,C.samples.push(h),{sample:h,length:u.frameLength,missing:0}}}function _(C,p){var l=C[p+1]>>3&3,a=C[p+1]>>1&3,s=C[p+2]>>4&15,u=C[p+2]>>2&3;if(l!==1&&s!==0&&s!==15&&u!==3){var b=C[p+2]>>1&1,m=C[p+3]>>6,h=l===3?3-a:a===3?3:4,D=T[h*14+s-1]*1e3,v=l===3?0:l===2?1:2,c=M[v*3+u],f=m===3?1:2,d=U[l][a],o=I[a],E=d*8*o,g=Math.floor(d*D/c+b)*o;if(F===null){var S=navigator.userAgent||"",P=S.match(/Chrome\/(\d+)/i);F=P?parseInt(P[1]):0}var B=!!F&&F<=87;return B&&a===2&&D>=224e3&&m===0&&(C[p+3]=C[p+3]|128),{sampleRate:c,channelCount:f,frameLength:g,samplesPerFrame:E}}}function y(C,p){return C[p]===255&&(C[p+1]&224)===224&&(C[p+1]&6)!==0}function w(C,p){return p+1<C.length&&y(C,p)}function L(C,p){var l=4;return y(C,p)&&l<=C.length-p}function O(C,p){if(p+1<C.length&&y(C,p)){var l=4,a=_(C,p),s=l;a!=null&&a.frameLength&&(s=a.frameLength);var u=p+s;return u===C.length||w(C,u)}return!1}},"./src/demux/sample-aes.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/crypt/decrypter.ts"),T=A("./src/demux/tsdemuxer.ts"),M=function(){function U(R,_,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new F.default(R,_,{removePKCS7Padding:!1})}var I=U.prototype;return I.decryptBuffer=function(_,y){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,y)},I.decryptAacSample=function(_,y,w,L){var O=_[y].unit,C=O.subarray(16,O.length-O.length%16),p=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),l=this;this.decryptBuffer(p,function(a){var s=new Uint8Array(a);O.set(s,16),L||l.decryptAacSamples(_,y+1,w)})},I.decryptAacSamples=function(_,y,w){for(;;y++){if(y>=_.length){w();return}if(_[y].unit.length<32)continue;var L=this.decrypter.isSync();if(this.decryptAacSample(_,y,w,L),!L)return}},I.getAvcEncryptedData=function(_){for(var y=Math.floor((_.length-48)/160)*16+16,w=new Int8Array(y),L=0,O=32;O<=_.length-16;O+=160,L+=16)w.set(_.subarray(O,O+16),L);return w},I.getAvcDecryptedUnit=function(_,y){for(var w=new Uint8Array(y),L=0,O=32;O<=_.length-16;O+=160,L+=16)_.set(w.subarray(L,L+16),O);return _},I.decryptAvcSample=function(_,y,w,L,O,C){var p=Object(T.discardEPB)(O.data),l=this.getAvcEncryptedData(p),a=this;this.decryptBuffer(l.buffer,function(s){O.data=a.getAvcDecryptedUnit(p,s),C||a.decryptAvcSamples(_,y,w+1,L)})},I.decryptAvcSamples=function(_,y,w,L){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,w=0){if(y>=_.length){L();return}for(var O=_[y].units;!(w>=O.length);w++){var C=O[w];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(_,y,w,L,C,p),!p)return}}},U}();K.default=M},"./src/demux/transmuxer-interface.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var F=A("./node_modules/webworkify-webpack/index.js"),T=A.n(F),M=A("./src/events.ts"),U=A("./src/demux/transmuxer.ts"),I=A("./src/utils/logger.ts"),R=A("./src/errors.ts"),_=A("./src/utils/mediasource-helper.ts"),y=A("./node_modules/eventemitter3/index.js"),w=A.n(y),L=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},O=function(){function C(l,a,s,u){var b=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 m=l.config,h=function(d,o){o=o||{},o.frag=b.frag,o.id=b.id,l.trigger(d,o)};this.observer=new y.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,h),this.observer.on(M.Events.ERROR,h);var D={mp4:L.isTypeSupported("video/mp4"),mpeg:L.isTypeSupported("audio/mpeg"),mp3:L.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var c;try{c=this.worker=F("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){l.trigger(M.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:D,vendor:v,id:a,config:JSON.stringify(m)})}catch(f){I.logger.warn("Error in worker:",f),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new U.default(this.observer,D,m,v,a),this.worker=null}}else this.transmuxer=new U.default(this.observer,D,m,v,a)}var p=C.prototype;return p.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},p.push=function(a,s,u,b,m,h,D,v,c,f){var d=this;c.transmuxing.start=self.performance.now();var o=this.transmuxer,E=this.worker,g=h?h.start:m.start,S=m.decryptdata,P=this.frag,B=!(P&&m.cc===P.cc),H=!(P&&c.level===P.level),Y=P?c.sn-P.sn:-1,j=this.part?c.part-this.part.index:1,N=!H&&(Y===1||Y===0&&j===1),Q=self.performance.now();(H||Y||m.stats.parsing.start===0)&&(m.stats.parsing.start=Q),h&&(j||!N)&&(h.stats.parsing.start=Q);var ne=new U.TransmuxState(B,N,v,H,g);if(!N||B){I.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+H+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+g);var pe=new U.TransmuxConfig(u,b,s,D,f);this.configureTransmuxer(pe)}if(this.frag=m,this.part=h,E)E.postMessage({cmd:"demux",data:a,decryptdata:S,chunkMeta:c,state:ne},a instanceof ArrayBuffer?[a]:[]);else if(o){var xe=o.push(a,S,c,ne);Object(U.isPromise)(xe)?xe.then(function(Ie){d.handleTransmuxComplete(Ie)}):this.handleTransmuxComplete(xe)}},p.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,b=this.worker;if(b)b.postMessage({cmd:"flush",chunkMeta:a});else if(u){var m=u.flush(a);Object(U.isPromise)(m)?m.then(function(h){s.handleFlushResult(h,a)}):this.handleFlushResult(m,a)}},p.handleFlushResult=function(a,s){var u=this;a.forEach(function(b){u.handleTransmuxComplete(b)}),this.onFlush(s)},p.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}}},p.configureTransmuxer=function(a){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},p.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},C}()},"./src/demux/transmuxer-worker.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var F=A("./src/demux/transmuxer.ts"),T=A("./src/events.ts"),M=A("./src/utils/logger.ts"),U=A("./node_modules/eventemitter3/index.js"),I=A.n(U);function R(O){var C=new U.EventEmitter,p=function(a,s){O.postMessage({event:a,data:s})};C.on(T.Events.FRAG_DECRYPTED,p),C.on(T.Events.ERROR,p),O.addEventListener("message",function(l){var a=l.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);O.transmuxer=new F.default(C,a.typeSupported,s,a.vendor,a.id),Object(M.enableLogs)(s.debug),p("init",null);break}case"configure":{O.transmuxer.configure(a.config);break}case"demux":{var u=O.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(F.isPromise)(u)?u.then(function(h){_(O,h)}):_(O,u);break}case"flush":{var b=a.chunkMeta,m=O.transmuxer.flush(b);Object(F.isPromise)(m)?m.then(function(h){w(O,h,b)}):w(O,m,b);break}default:break}})}function _(O,C){if(L(C.remuxResult))return;var p=[],l=C.remuxResult,a=l.audio,s=l.video;a&&y(p,a),s&&y(p,s),O.postMessage({event:"transmuxComplete",data:C},p)}function y(O,C){C.data1&&O.push(C.data1.buffer),C.data2&&O.push(C.data2.buffer)}function w(O,C,p){C.forEach(function(l){_(O,l)}),O.postMessage({event:"flush",data:p})}function L(O){return!O.audio&&!O.video&&!O.text&&!O.id3&&!O.initSegment}},"./src/demux/transmuxer.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s}),A.d(K,"isPromise",function(){return m}),A.d(K,"TransmuxConfig",function(){return h}),A.d(K,"TransmuxState",function(){return D});var F=A("./src/events.ts"),T=A("./src/errors.ts"),M=A("./src/crypt/decrypter.ts"),U=A("./src/demux/aacdemuxer.ts"),I=A("./src/demux/mp4demuxer.ts"),R=A("./src/demux/tsdemuxer.ts"),_=A("./src/demux/mp3demuxer.ts"),y=A("./src/remux/mp4-remuxer.ts"),w=A("./src/remux/passthrough-remuxer.ts"),L=A("./src/demux/chunk-cache.ts"),O=A("./src/utils/mp4-tools.ts"),C=A("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(v){C.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var l=[{demux:R.default,remux:y.default},{demux:I.default,remux:w.default},{demux:U.default,remux:y.default},{demux:_.default,remux:y.default}],a=1024;l.forEach(function(v){var c=v.demux;a=Math.max(a,c.minProbeByteLength)});var s=function(){function v(f,d,o,E,g){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 L.default,this.observer=f,this.typeSupported=d,this.config=o,this.vendor=E,this.id=g}var c=v.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,o,E,g){var S=this,P=E.transmuxing;P.executeStart=p();var B=new Uint8Array(d),H=this.cache,Y=this.config,j=this.currentTransmuxState,N=this.transmuxConfig;g&&(this.currentTransmuxState=g);var Q=u(B,o);if(Q&&Q.method==="AES-128"){var ne=this.getDecrypter();if(Y.enableSoftwareAES){var pe=ne.softwareDecrypt(B,Q.key.buffer,Q.iv.buffer);if(!pe)return P.executeEnd=p(),b(E);B=new Uint8Array(pe)}else return this.decryptionPromise=ne.webCryptoDecrypt(B,Q.key.buffer,Q.iv.buffer).then(function(Be){var Xe=S.push(Be,null,E);return S.decryptionPromise=null,Xe}),this.decryptionPromise}var xe=g||j,Ie=xe.contiguous,Ae=xe.discontinuity,De=xe.trackSwitch,Ce=xe.accurateTimeOffset,Oe=xe.timeOffset,ce=N.audioCodec,fe=N.videoCodec,Pe=N.defaultInitPts,qe=N.duration,Ve=N.initSegmentData;if((Ae||De)&&this.resetInitSegment(Ve,ce,fe,qe),Ae&&this.resetInitialTimestamp(Pe),Ie||this.resetContiguity(),this.needsProbing(B,Ae,De)){if(H.dataLength){var Ze=H.flush();B=Object(O.appendUint8Array)(Ze,B)}this.configureTransmuxer(B,N)}var ct=this.transmux(B,Q,Oe,Ce,E),je=this.currentTransmuxState;return je.contiguous=!0,je.discontinuity=!1,je.trackSwitch=!1,P.executeEnd=p(),ct},c.flush=function(d){var o=this,E=d.transmuxing;E.executeStart=p();var g=this.decrypter,S=this.cache,P=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return o.flush(d)});var H=[],Y=P.timeOffset;if(g){var j=g.flush();j&&H.push(this.push(j,null,d))}var N=S.dataLength;S.reset();var Q=this.demuxer,ne=this.remuxer;if(!Q||!ne)return N>=a&&this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=p(),[b(d)];var pe=Q.flush(Y);return m(pe)?pe.then(function(xe){return o.flushRemux(H,xe,d),H}):(this.flushRemux(H,pe,d),H)},c.flushRemux=function(d,o,E){var g=o.audioTrack,S=o.avcTrack,P=o.id3Track,B=o.textTrack,H=this.currentTransmuxState,Y=H.accurateTimeOffset,j=H.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var N=this.remuxer.remux(g,S,P,B,j,Y,!0,this.id);d.push({remuxResult:N,chunkMeta:E}),E.transmuxing.executeEnd=p()},c.resetInitialTimestamp=function(d){var o=this.demuxer,E=this.remuxer;if(!o||!E)return;o.resetTimeStamp(d),E.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},c.resetInitSegment=function(d,o,E,g){var S=this.demuxer,P=this.remuxer;if(!S||!P)return;S.resetInitSegment(o,E,g),P.resetInitSegment(d,o,E)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,o,E,g,S){var P;return o&&o.method==="SAMPLE-AES"?P=this.transmuxSampleAes(d,o,E,g,S):P=this.transmuxUnencrypted(d,E,g,S),P},c.transmuxUnencrypted=function(d,o,E,g){var S=this.demuxer.demux(d,o,!1,!this.config.progressive),P=S.audioTrack,B=S.avcTrack,H=S.id3Track,Y=S.textTrack,j=this.remuxer.remux(P,B,H,Y,o,E,!1,this.id);return{remuxResult:j,chunkMeta:g}},c.transmuxSampleAes=function(d,o,E,g,S){var P=this;return this.demuxer.demuxSampleAes(d,o,E).then(function(B){var H=P.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,E,g,!1,P.id);return{remuxResult:H,chunkMeta:S}})},c.configureTransmuxer=function(d,o){for(var E=this.config,g=this.observer,S=this.typeSupported,P=this.vendor,B=o.audioCodec,H=o.defaultInitPts,Y=o.duration,j=o.initSegmentData,N=o.videoCodec,Q,ne=0,pe=l.length;ne<pe;ne++)if(l[ne].demux.probe(d)){Q=l[ne];break}Q||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Q={demux:I.default,remux:w.default});var xe=this.demuxer,Ie=this.remuxer,Ae=Q.remux,De=Q.demux;(!Ie||!(Ie instanceof Ae))&&(this.remuxer=new Ae(g,E,S,P)),(!xe||!(xe instanceof De))&&(this.demuxer=new De(g,E,S),this.probe=De.probe),this.resetInitSegment(j,B,N,Y),this.resetInitialTimestamp(H)},c.needsProbing=function(d,o,E){return!this.demuxer||!this.remuxer||o||E},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new M.default(this.observer,this.config)),d},v}();function u(v,c){var f=null;return v.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var b=function(c){return{remuxResult:{},chunkMeta:c}};function m(v){return"then"in v&&v.then instanceof Function}var h=function(c,f,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=c,this.videoCodec=f,this.initSegmentData=d,this.duration=o,this.defaultInitPts=E},D=function(c,f,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=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"discardEPB",function(){return b});var F=A("./src/demux/adts.ts"),T=A("./src/demux/mpegaudio.ts"),M=A("./src/demux/exp-golomb.ts"),U=A("./src/demux/id3.ts"),I=A("./src/demux/sample-aes.ts"),R=A("./src/events.ts"),_=A("./src/utils/mp4-tools.ts"),y=A("./src/utils/logger.ts"),w=A("./src/errors.ts"),L={video:1,audio:2,id3:3,text:4},O=function(){function m(D,v,c){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=v,this.typeSupported=c}m.probe=function(v){var c=m.syncOffset(v);return c<0?!1:(c&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},m.syncOffset=function(v){for(var c=Math.min(1e3,v.length-3*188),f=0;f<c;){if(v[f]===71&&v[f+188]===71&&v[f+2*188]===71)return f;f++}return-1},m.createTrack=function(v,c){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:L[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?c:void 0}};var h=m.prototype;return h.resetInitSegment=function(v,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",f),this._audioTrack=m.createTrack("audio",f),this._id3Track=m.createTrack("id3",f),this._txtTrack=m.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var v=this._audioTrack,c=this._avcTrack,f=this._id3Track;v&&(v.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(v,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var o,E=this._avcTrack,g=this._audioTrack,S=this._id3Track,P=E.pid,B=E.pesData,H=g.pid,Y=S.pid,j=g.pesData,N=S.pesData,Q=!1,ne=this.pmtParsed,pe=this._pmtId,xe=v.length;if(this.remainderData&&(v=Object(_.appendUint8Array)(this.remainderData,v),xe=v.length,this.remainderData=null),xe<188&&!d)return this.remainderData=v,{audioTrack:g,avcTrack:E,id3Track:S,textTrack:this._txtTrack};var Ie=Math.max(0,m.syncOffset(v));xe-=(xe+Ie)%188,xe<v.byteLength&&!d&&(this.remainderData=new Uint8Array(v.buffer,xe,v.buffer.byteLength-xe));for(var Ae=Ie;Ae<xe;Ae+=188)if(v[Ae]===71){var De=!!(v[Ae+1]&64),Ce=((v[Ae+1]&31)<<8)+v[Ae+2],Oe=(v[Ae+3]&48)>>4,ce=void 0;if(Oe>1){if(ce=Ae+5+v[Ae+4],ce===Ae+188)continue}else ce=Ae+4;switch(Ce){case P:De&&(B&&(o=a(B))&&this.parseAVCPES(o,!1),B={data:[],size:0}),B&&(B.data.push(v.subarray(ce,Ae+188)),B.size+=Ae+188-ce);break;case H:De&&(j&&(o=a(j))&&(g.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),j={data:[],size:0}),j&&(j.data.push(v.subarray(ce,Ae+188)),j.size+=Ae+188-ce);break;case Y:De&&(N&&(o=a(N))&&this.parseID3PES(o),N={data:[],size:0}),N&&(N.data.push(v.subarray(ce,Ae+188)),N.size+=Ae+188-ce);break;case 0:De&&(ce+=v[ce]+1),pe=this._pmtId=p(v,ce);break;case pe:{De&&(ce+=v[ce]+1);var fe=l(v,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);P=fe.avc,P>0&&(E.pid=P),H=fe.audio,H>0&&(g.pid=H,g.isAAC=fe.isAAC),Y=fe.id3,Y>0&&(S.pid=Y),Q&&!ne&&(y.logger.log("reparse from beginning"),Q=!1,Ae=Ie-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:Q=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=B,g.pesData=j,S.pesData=N;var Pe={audioTrack:g,avcTrack:E,id3Track:S,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(Pe),Pe},h.flush=function(){var v=this.remainderData;this.remainderData=null;var c;return v?c=this.demux(v,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(v){var c=v.audioTrack,f=v.avcTrack,d=v.id3Track,o=f.pesData,E=c.pesData,g=d.pesData,S;o&&(S=a(o))?(this.parseAVCPES(S,!0),f.pesData=null):f.pesData=o,E&&(S=a(E))?(c.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),c.pesData=null):(E!=null&&E.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=E),g&&(S=a(g))?(this.parseID3PES(S),d.pesData=null):d.pesData=g},h.demuxSampleAes=function(v,c,f){var d=this.demux(v,f,!0,!this.config.progressive),o=this.sampleAes=new I.default(this.observer,this.config,c);return this.decrypt(d,o)},h.decrypt=function(v,c){return new Promise(function(f){var d=v.audioTrack,o=v.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){o.samples?c.decryptAvcSamples(o.samples,0,0,function(){f(v)}):f(v)}):o.samples&&c.decryptAvcSamples(o.samples,0,0,function(){f(v)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(v,c){var f=this,d=this._avcTrack,o=this.parseAVCNALu(v.data),E=!1,g=this.avcSample,S,P=!1;v.data=null,g&&o.length&&!d.audFound&&(s(g,d),g=this.avcSample=C(!1,v.pts,v.dts,"")),o.forEach(function(B){switch(B.type){case 1:{S=!0,g||(g=f.avcSample=C(!0,v.pts,v.dts,"")),E&&(g.debug+="NDR "),g.frame=!0;var H=B.data;if(P&&H.length>4){var Y=new M.default(H).readSliceType();(Y===2||Y===4||Y===7||Y===9)&&(g.key=!0)}break}case 5:S=!0,g||(g=f.avcSample=C(!0,v.pts,v.dts,"")),E&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{S=!0,E&&g&&(g.debug+="SEI ");var j=new M.default(b(B.data));j.readUByte();for(var N=0,Q=0,ne=!1,pe=0;!ne&&j.bytesAvailable>1;){N=0;do pe=j.readUByte(),N+=pe;while(pe===255);Q=0;do pe=j.readUByte(),Q+=pe;while(pe===255);if(N===4&&j.bytesAvailable!==0){ne=!0;var xe=j.readUByte();if(xe===181){var Ie=j.readUShort();if(Ie===49){var Ae=j.readUInt();if(Ae===1195456820){var De=j.readUByte();if(De===3){for(var Ce=j.readUByte(),Oe=j.readUByte(),ce=31&Ce,fe=[Ce,Oe],Pe=0;Pe<ce;Pe++)fe.push(j.readUByte()),fe.push(j.readUByte()),fe.push(j.readUByte());u(f._txtTrack.samples,{type:3,pts:v.pts,bytes:fe})}}}}}else if(N===5&&j.bytesAvailable!==0){if(ne=!0,Q>16){for(var qe=[],Ve=0;Ve<16;Ve++)qe.push(j.readUByte().toString(16)),(Ve===3||Ve===5||Ve===7||Ve===9)&&qe.push("-");for(var Ze=Q-16,ct=new Uint8Array(Ze),je=0;je<Ze;je++)ct[je]=j.readUByte();u(f._txtTrack.samples,{pts:v.pts,payloadType:N,uuid:qe.join(""),userData:Object(U.utf8ArrayToStr)(ct),userDataBytes:ct})}}else if(Q<j.bytesAvailable)for(var Be=0;Be<Q;Be++)j.readUByte()}break}case 7:if(S=!0,P=!0,E&&g&&(g.debug+="SPS "),!d.sps){var Xe=new M.default(B.data),et=Xe.readSPS();d.width=et.width,d.height=et.height,d.pixelRatio=et.pixelRatio,d.sps=[B.data],d.duration=f._duration;for(var Qe=B.data.subarray(1,4),Ne="avc1.",Ue=0;Ue<3;Ue++){var lt=Qe[Ue].toString(16);lt.length<2&&(lt="0"+lt),Ne+=lt}d.codec=Ne}break;case 8:S=!0,E&&g&&(g.debug+="PPS "),d.pps||(d.pps=[B.data]);break;case 9:S=!1,d.audFound=!0,g&&s(g,d),g=f.avcSample=C(!1,v.pts,v.dts,E?"AUD ":"");break;case 12:S=!1;break;default:S=!1,g&&(g.debug+="unknown NAL "+B.type+" ");break}if(g&&S){var ut=g.units;ut.push(B)}}),c&&g&&(s(g,d),this.avcSample=null)},h.getLastNalUnit=function(){var v,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((v=c)!==null&&v!==void 0&&v.units){var o=c.units;f=o[o.length-1]}return f},h.parseAVCNALu=function(v){var c=v.byteLength,f=this._avcTrack,d=f.naluState||0,o=d,E=[],g=0,S,P,B,H=-1,Y=0;for(d===-1&&(H=0,Y=v[0]&31,d=0,g=1);g<c;){if(S=v[g++],!d){d=S?0:1;continue}if(d===1){d=S?0:2;continue}if(!S)d=3;else if(S===1){if(H>=0){var j={data:v.subarray(H,g-d-1),type:Y};E.push(j)}else{var N=this.getLastNalUnit();if(N&&(o&&g<=4-o&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-o))),P=g-d-1,P>0)){var Q=new Uint8Array(N.data.byteLength+P);Q.set(N.data,0),Q.set(v.subarray(0,P),N.data.byteLength),N.data=Q,N.state=0}}g<c?(B=v[g]&31,H=g,Y=B,d=0):d=-1}else d=0}if(H>=0&&d>=0){var ne={data:v.subarray(H,c),type:Y,state:d};E.push(ne)}if(E.length===0){var pe=this.getLastNalUnit();if(pe){var xe=new Uint8Array(pe.data.byteLength+v.byteLength);xe.set(pe.data,0),xe.set(v,pe.data.byteLength),pe.data=xe}}return f.naluState=d,E},h.parseAACPES=function(v){var c=0,f=this._audioTrack,d=this.aacOverFlow,o=v.data;if(d){this.aacOverFlow=null;var E=d.sample.unit.byteLength,g=Math.min(d.missing,E),S=E-g;d.sample.unit.set(o.subarray(0,g),S),f.samples.push(d.sample),c=d.missing}var P,B;for(P=c,B=o.length;P<B-1&&!F.isHeader(o,P);P++);if(P!==c){var H,Y;if(P<B-1?(H="AAC PES did not start with ADTS header,offset:"+P,Y=!1):(H="no ADTS header found in AAC PES",Y=!0),y.logger.warn("parsing error:"+H),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:Y,reason:H}),Y)return}F.initTrackConfig(f,this.observer,o,P,this.audioCodec);var j;if(v.pts!==void 0)j=v.pts;else if(d){var N=F.getFrameDuration(f.samplerate);j=d.sample.pts+N}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Q=0;P<B;)if(F.isHeader(o,P)){if(P+5<B){var ne=F.appendFrame(f,o,P,j,Q);if(ne)if(ne.missing)this.aacOverFlow=ne;else{P+=ne.length,Q++;continue}}break}else P++},h.parseMPEGPES=function(v){var c=v.data,f=c.length,d=0,o=0,E=v.pts;if(E===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<f;)if(T.isHeader(c,o)){var g=T.appendFrame(this._audioTrack,c,o,E,d);if(g)o+=g.length,d++;else break}else o++},h.parseID3PES=function(v){if(v.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},m}();O.minProbeByteLength=188;function C(m,h,D,v){return{key:m,frame:!1,pts:h,dts:D,units:[],debug:v,length:0}}function p(m,h){return(m[h+10]&31)<<8|m[h+11]}function l(m,h,D,v){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(m[h+1]&15)<<8|m[h+2],d=h+3+f-4,o=(m[h+10]&15)<<8|m[h+11];for(h+=12+o;h<d;){var E=(m[h+1]&31)<<8|m[h+2];switch(m[h]){case 207:if(!v){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=E);break;case 21:c.id3===-1&&(c.id3=E);break;case 219:if(!v){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=E);break;case 3:case 4:D?c.audio===-1&&(c.audio=E,c.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((m[h+3]&15)<<8|m[h+4])+5}return c}function a(m){var h=0,D,v,c,f,d,o=m.data;if(!m||m.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 g=(D[0]<<16)+(D[1]<<8)+D[2];if(g===1){if(v=(D[4]<<8)+D[5],v&&v>m.size-6)return null;var S=D[7];S&192&&(f=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,S&64?(d=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,f-d>60*9e4&&(y.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=D[8];var P=c+9;if(m.size<=P)return null;m.size-=P;for(var B=new Uint8Array(m.size),H=0,Y=o.length;H<Y;H++){D=o[H];var j=D.byteLength;if(P)if(P>j){P-=j;continue}else D=D.subarray(P),j-=P,P=0;B.set(D,h),h+=j}return v&&(v-=c+3),{data:B,pts:f,dts:d,len:v}}return null}function s(m,h){if(m.units.length&&m.frame){if(m.pts===void 0){var D=h.samples,v=D.length;if(v){var c=D[v-1];m.pts=c.pts,m.dts=c.dts}else{h.dropped++;return}}h.samples.push(m)}m.debug.length&&y.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function u(m,h){var D=m.length;if(D>0){if(h.pts>=m[D-1].pts)m.push(h);else for(var v=D-1;v>=0;v--)if(h.pts<m[v].pts){m.splice(v,0,h);break}}else m.push(h)}function b(m){for(var h=m.byteLength,D=[],v=1;v<h-2;)m[v]===0&&m[v+1]===0&&m[v+2]===3?(D.push(v+2),v+=2):v++;if(D.length===0)return m;var c=h-D.length,f=new Uint8Array(c),d=0;for(v=0;v<c;d++,v++)d===D[0]&&(d++,D.shift()),f[v]=m[d];return f}K.default=O},"./src/errors.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"ErrorTypes",function(){return F}),A.d(K,"ErrorDetails",function(){return T});var F;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(F||(F={}));var T;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(T||(T={}))},"./src/events.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"Events",function(){return F});var F;(function(T){T.MEDIA_ATTACHING="hlsMediaAttaching",T.MEDIA_ATTACHED="hlsMediaAttached",T.MEDIA_DETACHING="hlsMediaDetaching",T.MEDIA_DETACHED="hlsMediaDetached",T.BUFFER_RESET="hlsBufferReset",T.BUFFER_CODECS="hlsBufferCodecs",T.BUFFER_CREATED="hlsBufferCreated",T.BUFFER_APPENDING="hlsBufferAppending",T.BUFFER_APPENDED="hlsBufferAppended",T.BUFFER_EOS="hlsBufferEos",T.BUFFER_FLUSHING="hlsBufferFlushing",T.BUFFER_FLUSHED="hlsBufferFlushed",T.MANIFEST_LOADING="hlsManifestLoading",T.MANIFEST_LOADED="hlsManifestLoaded",T.MANIFEST_PARSED="hlsManifestParsed",T.LEVEL_SWITCHING="hlsLevelSwitching",T.LEVEL_SWITCHED="hlsLevelSwitched",T.LEVEL_LOADING="hlsLevelLoading",T.LEVEL_LOADED="hlsLevelLoaded",T.LEVEL_UPDATED="hlsLevelUpdated",T.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",T.LEVELS_UPDATED="hlsLevelsUpdated",T.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",T.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",T.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",T.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",T.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",T.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",T.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",T.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",T.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",T.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",T.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",T.CUES_PARSED="hlsCuesParsed",T.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",T.INIT_PTS_FOUND="hlsInitPtsFound",T.FRAG_LOADING="hlsFragLoading",T.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",T.FRAG_LOADED="hlsFragLoaded",T.FRAG_DECRYPTED="hlsFragDecrypted",T.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",T.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",T.FRAG_PARSING_METADATA="hlsFragParsingMetadata",T.FRAG_PARSED="hlsFragParsed",T.FRAG_BUFFERED="hlsFragBuffered",T.FRAG_CHANGED="hlsFragChanged",T.FPS_DROP="hlsFpsDrop",T.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",T.ERROR="hlsError",T.DESTROYING="hlsDestroying",T.KEY_LOADING="hlsKeyLoading",T.KEY_LOADED="hlsKeyLoaded",T.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",T.BACK_BUFFER_REACHED="hlsBackBufferReached"})(F||(F={}))},"./src/hls.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return m});var F=A("./node_modules/url-toolkit/src/url-toolkit.js"),T=A.n(F),M=A("./src/loader/playlist-loader.ts"),U=A("./src/loader/key-loader.ts"),I=A("./src/controller/id3-track-controller.ts"),R=A("./src/controller/latency-controller.ts"),_=A("./src/controller/level-controller.ts"),y=A("./src/controller/fragment-tracker.ts"),w=A("./src/controller/stream-controller.ts"),L=A("./src/is-supported.ts"),O=A("./src/utils/logger.ts"),C=A("./src/config.ts"),p=A("./node_modules/eventemitter3/index.js"),l=A.n(p),a=A("./src/events.ts"),s=A("./src/errors.ts");function u(h,D){for(var v=0;v<D.length;v++){var c=D[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function b(h,D,v){return D&&u(h.prototype,D),v&&u(h,v),h}var m=function(){h.isSupported=function(){return Object(L.isSupported)()};function h(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 c=this.config=Object(C.mergeConfig)(h.DefaultConfig,v);this.userConfig=v,Object(O.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(C.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,o=c.capLevelController,E=c.fpsController,g=this.abrController=new f(this),S=this.bufferController=new d(this),P=this.capLevelController=new o(this),B=new E(this),H=new M.default(this),Y=new U.default(this),j=new I.default(this),N=this.levelController=new _.default(this),Q=new y.FragmentTracker(this),ne=this.streamController=new w.default(this,Q);P.setStreamController(ne),B.setStreamController(ne);var pe=[N,ne];this.networkControllers=pe;var xe=[H,Y,g,S,P,B,j,Q];this.audioTrackController=this.createController(c.audioTrackController,null,pe),this.createController(c.audioStreamController,Q,pe),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,pe),this.createController(c.subtitleStreamController,Q,pe),this.createController(c.timelineController,null,xe),this.emeController=this.createController(c.emeController,null,xe),this.cmcdController=this.createController(c.cmcdController,null,xe),this.latencyController=this.createController(R.default,null,xe),this.coreComponents=xe}var D=h.prototype;return D.createController=function(c,f,d){if(c){var o=f?new c(this,f):new c(this);return d&&d.push(o),o}return null},D.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},D.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},D.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},D.off=function(c,f,d,o){d===void 0&&(d=this),this._emitter.off(c,f,d,o)},D.listeners=function(c){return this._emitter.listeners(c)},D.emit=function(c,f,d){return this._emitter.emit(c,f,d)},D.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){O.logger.error("An internal error happened while handling event "+c+'. 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:c,error:d})}return!1},D.listenerCount=function(c){return this._emitter.listenerCount(c)},D.destroy=function(){O.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},D.attachMedia=function(c){O.logger.log("attachMedia"),this._media=c,this.trigger(a.Events.MEDIA_ATTACHING,{media:c})},D.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,o=this.url=F.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});O.logger.log("loadSource:"+o),f&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(a.Events.MANIFEST_LOADING,{url:c})},D.startLoad=function(c){c===void 0&&(c=-1),O.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},D.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},D.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){O.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},D.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},b(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){O.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){O.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){O.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){O.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){O.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(O.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,o=0;o<d;o++)if(c[o].maxBitrate>f)return o;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 h.defaultConfig?h.defaultConfig:C.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();m.defaultConfig=void 0},"./src/is-supported.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"isSupported",function(){return M}),A.d(K,"changeTypeSupported",function(){return U});var F=A("./src/utils/mediasource-helper.ts");function T(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var I=Object(F.getMediaSource)();if(!I)return!1;var R=T(),_=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!_&&!!y}function U(){var I,R=T();return typeof(R==null||((I=R.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O}),A.d(K,"LoadError",function(){return p});var F=A("./src/polyfills/number.ts"),T=A("./src/errors.ts");function M(l,a){l.prototype=Object.create(a.prototype),l.prototype.constructor=l,y(l,a)}function U(l){var a=typeof Map=="function"?new Map:void 0;return U=function(u){if(u===null||!_(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,b)}function b(){return I(u,arguments,w(this).constructor)}return b.prototype=Object.create(u.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),y(b,u)},U(l)}function I(l,a,s){return R()?I=Reflect.construct:I=function(b,m,h){var D=[null];D.push.apply(D,m);var v=Function.bind.apply(b,D),c=new v;return h&&y(c,h.prototype),c},I.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function _(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function y(l,a){return y=Object.setPrototypeOf||function(u,b){return u.__proto__=b,u},y(l,a)}function w(l){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},w(l)}var L=Math.pow(2,17),O=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,b){var m=this,h=u.url;if(!h)return Promise.reject(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var D=this.config,v=D.fLoader,c=D.loader;return new Promise(function(f,d){m.loader&&m.loader.destroy();var o=m.loader=u.loader=v?new v(D):new c(D),E=C(u),g={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:L};u.stats=o.stats,o.load(E,g,{onSuccess:function(P,B,H,Y){m.resetLoader(u,o),f({frag:u,part:null,payload:P.data,networkDetails:Y})},onError:function(P,B,H){m.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:P,networkDetails:H}))},onAbort:function(P,B,H){m.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:H}))},onTimeout:function(P,B,H){m.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:H}))},onProgress:function(P,B,H,Y){b&&b({frag:u,part:null,payload:H,networkDetails:Y})}})})},a.loadPart=function(u,b,m){var h=this;this.abort();var D=this.config,v=D.fLoader,c=D.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var o=h.loader=u.loader=v?new v(D):new c(D),E=C(u,b),g={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:L};b.stats=o.stats,o.load(E,g,{onSuccess:function(P,B,H,Y){h.resetLoader(u,o),h.updateStatsFromPart(u,b);var j={frag:u,part:b,payload:P.data,networkDetails:Y};m(j),f(j)},onError:function(P,B,H){h.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:b,response:P,networkDetails:H}))},onAbort:function(P,B,H){u.stats.aborted=b.stats.aborted,h.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:b,networkDetails:H}))},onTimeout:function(P,B,H){h.resetLoader(u,o),d(new p({type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:b,networkDetails:H}))}})})},a.updateStatsFromPart=function(u,b){var m=u.stats,h=b.stats,D=h.total;if(m.loaded+=h.loaded,D){var v=Math.round(u.duration/b.duration),c=Math.min(Math.round(m.loaded/D),v),f=v-c,d=f*Math.round(m.loaded/c);m.total=m.loaded+d}else m.total=Math.max(m.loaded,m.total);var o=m.loading,E=h.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,b){u.loader=null,this.loader===b&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),b.destroy()},l}();function C(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},b=s.byteRangeStartOffset,m=s.byteRangeEndOffset;return Object(F.isFiniteNumber)(b)&&Object(F.isFiniteNumber)(m)&&(u.rangeStart=b,u.rangeEnd=m),u}var p=function(l){M(a,l);function a(s){for(var u,b=arguments.length,m=new Array(b>1?b-1:0),h=1;h<b;h++)m[h-1]=arguments[h];return u=l.call.apply(l,[this].concat(m))||this,u.data=void 0,u.data=s,u}return a}(U(Error))},"./src/loader/fragment.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"ElementaryStreamTypes",function(){return O}),A.d(K,"BaseSegment",function(){return C}),A.d(K,"Fragment",function(){return p}),A.d(K,"Part",function(){return l});var F=A("./src/polyfills/number.ts"),T=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(T),U=A("./src/utils/logger.ts"),I=A("./src/loader/level-key.ts"),R=A("./src/loader/load-stats.ts");function _(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,y(a,s)}function y(a,s){return y=Object.setPrototypeOf||function(b,m){return b.__proto__=m,b},y(a,s)}function w(a,s){for(var u=0;u<s.length;u++){var b=s[u];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(a,b.key,b)}}function L(a,s,u){return s&&w(a.prototype,s),u&&w(a,u),a}var O;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(O||(O={}));var C=function(){function a(u){var b;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(b={},b[O.AUDIO]=null,b[O.VIDEO]=null,b[O.AUDIOVIDEO]=null,b),this.baseurl=u}var s=a.prototype;return s.setByteRange=function(b,m){var h=b.split("@",2),D=[];h.length===1?D[0]=m?m.byteRangeEndOffset:0:D[0]=parseInt(h[1]),D[1]=parseInt(h[0])+D[0],this._byteRange=D},L(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(T.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(b){this._url=b}}]),a}(),p=function(a){_(s,a);function s(b,m){var h;return h=a.call(this,m)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new R.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=b,h}var u=s.prototype;return u.createInitializationVector=function(m){for(var h=new Uint8Array(16),D=12;D<16;D++)h[D]=m>>8*(15-D)&255;return h},u.setDecryptDataFromLevelKey=function(m,h){var D=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(D=I.LevelKey.fromURI(m.uri),D.method=m.method,D.iv=this.createInitializationVector(h),D.keyFormat="identity"),D},u.setElementaryStreamInfo=function(m,h,D,v,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,o=d[m];if(!o){d[m]={startPTS:h,endPTS:D,startDTS:v,endDTS:c,partial:f};return}o.startPTS=Math.min(o.startPTS,h),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,v),o.endDTS=Math.max(o.endDTS,c)},u.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[O.AUDIO]=null,m[O.VIDEO]=null,m[O.AUDIOVIDEO]=null},L(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&U.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(F.isFiniteNumber)(this.programDateTime))return null;var m=Object(F.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),s}(C),l=function(a){_(s,a);function s(u,b,m,h,D){var v;v=a.call(this,m)||this,v.fragOffset=0,v.duration=0,v.gap=!1,v.independent=!1,v.relurl=void 0,v.fragment=void 0,v.index=void 0,v.stats=new R.LoadStats,v.duration=u.decimalFloatingPoint("DURATION"),v.gap=u.bool("GAP"),v.independent=u.bool("INDEPENDENT"),v.relurl=u.enumeratedString("URI"),v.fragment=b,v.index=h;var c=u.enumeratedString("BYTERANGE");return c&&v.setByteRange(c,D),D&&(v.fragOffset=D.fragOffset+D.duration),v}return L(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 b=this.elementaryStreams;return!!(b.audio||b.video||b.audiovideo)}}]),s}(C)},"./src/loader/key-loader.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return U});var F=A("./src/events.ts"),T=A("./src/errors.ts"),M=A("./src/utils/logger.ts"),U=function(){function I(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var R=I.prototype;return R._registerListeners=function(){this.hls.on(F.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(F.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var w=this.loaders[y];w&&w.destroy()}this.loaders={}},R.onKeyLoading=function(y,w){var L=w.frag,O=L.type,C=this.loaders[O];if(!L.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=L.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(C&&(M.logger.warn("abort previous key loader for type:"+O),C.abort()),!p){M.logger.warn("key uri is falsy");return}var a=l.loader,s=L.loader=this.loaders[O]=new a(l);this.decrypturl=p,this.decryptkey=null;var u={url:p,frag:L,responseType:"arraybuffer"},b={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,b,m)}else this.decryptkey&&(L.decryptdata.key=this.decryptkey,this.hls.trigger(F.Events.KEY_LOADED,{frag:L}))},R.loadsuccess=function(y,w,L){var O=L.frag;if(!O.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=O.decryptdata.key=new Uint8Array(y.data),O.loader=null,delete this.loaders[O.type],this.hls.trigger(F.Events.KEY_LOADED,{frag:O})},R.loaderror=function(y,w){var L=w.frag,O=L.loader;O&&O.abort(),delete this.loaders[L.type],this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:L,response:y})},R.loadtimeout=function(y,w){var L=w.frag,O=L.loader;O&&O.abort(),delete this.loaders[L.type],this.hls.trigger(F.Events.ERROR,{type:T.ErrorTypes.NETWORK_ERROR,details:T.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:L})},I}()},"./src/loader/level-details.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"LevelDetails",function(){return I});var F=A("./src/polyfills/number.ts");function T(R,_){for(var y=0;y<_.length;y++){var w=_[y];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(R,w.key,w)}}function M(R,_,y){return _&&T(R.prototype,_),y&&T(R,y),R}var U=10,I=function(){function R(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var _=R.prototype;return _.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var L=this.lastPartSn-w.lastPartSn,O=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!O||!!L,this.advanced=this.endSN>w.endSN||L>0||L===0&&O>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},M(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(F.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var L=this.driftEnd-this.driftStart;return L*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"LevelKey",function(){return I});var F=A("./node_modules/url-toolkit/src/url-toolkit.js"),T=A.n(F);function M(R,_){for(var y=0;y<_.length;y++){var w=_[y];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(R,w.key,w)}}function U(R,_,y){return _&&M(R.prototype,_),y&&M(R,y),R}var I=function(){R.fromURL=function(y,w){return new R(y,w)},R.fromURI=function(y){return new R(y)};function R(_,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(F.buildAbsoluteURL)(_,y,{alwaysNormalize:!0}):this._uri=_}return U(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"LoadStats",function(){return F});var F=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s});var F=A("./src/polyfills/number.ts"),T=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(T),U=A("./src/loader/fragment.ts"),I=A("./src/loader/level-details.ts"),R=A("./src/loader/level-key.ts"),_=A("./src/utils/attr-list.ts"),y=A("./src/utils/logger.ts"),w=A("./src/utils/codecs.ts"),L=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,O=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=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 v,c;return l.test((v=(c=T.parseURL(D))===null||c===void 0?void 0:c.path)!=null?v:"")}var s=function(){function D(){}return D.findGroup=function(c,f){for(var d=0;d<c.length;d++){var o=c[d];if(o.id===f)return o}},D.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},D.resolve=function(c,f){return T.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(c,f){var d=[],o={},E=!1;L.lastIndex=0;for(var g;(g=L.exec(c))!=null;)if(g[1]){var S=new _.AttrList(g[1]),P={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:D.resolve(g[2],f)},B=S.decimalResolution("RESOLUTION");B&&(P.width=B.width,P.height=B.height),u((S.CODECS||"").split(/[ ,]+/).filter(function(Y){return Y}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=D.convertAVC1ToAVCOTI(P.videoCodec)),d.push(P)}else if(g[3]){var H=new _.AttrList(g[3]);H["DATA-ID"]&&(E=!0,o[H["DATA-ID"]]=H)}return{levels:d,sessionData:E?o:null}},D.parseMasterPlaylistMedia=function(c,f,d,o){o===void 0&&(o=[]);var E,g=[],S=0;for(O.lastIndex=0;(E=O.exec(c))!==null;){var P=new _.AttrList(E[1]);if(P.TYPE===d){var B={attrs:P,bitrate:0,id:S++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:d,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?D.resolve(P.URI,f):""};if(o.length){var H=D.findGroup(o,B.groupId)||o[0];b(B,H,"audioCodec"),b(B,H,"textCodec")}g.push(B)}}return g},D.parseLevelPlaylist=function(c,f,d,o,E){var g=new I.LevelDetails(f),S=g.fragments,P=null,B=0,H=0,Y=0,j=0,N=null,Q=new U.Fragment(o,f),ne,pe,xe,Ie=-1,Ae=!1;for(C.lastIndex=0,g.m3u8=c;(ne=C.exec(c))!==null;){Ae&&(Ae=!1,Q=new U.Fragment(o,f),Q.start=Y,Q.sn=B,Q.cc=j,Q.level=d,P&&(Q.initSegment=P,Q.rawProgramDateTime=P.rawProgramDateTime));var De=ne[1];if(De){Q.duration=parseFloat(De);var Ce=(" "+ne[2]).slice(1);Q.title=Ce||null,Q.tagList.push(Ce?["INF",De,Ce]:["INF",De])}else if(ne[3])Object(F.isFiniteNumber)(Q.duration)&&(Q.start=Y,xe&&(Q.levelkey=xe),Q.sn=B,Q.level=d,Q.cc=j,Q.urlId=E,S.push(Q),Q.relurl=(" "+ne[3]).slice(1),h(Q,N),N=Q,Y+=Q.duration,B++,H=0,Ae=!0);else if(ne[4]){var Oe=(" "+ne[4]).slice(1);N?Q.setByteRange(Oe,N):Q.setByteRange(Oe)}else if(ne[5])Q.rawProgramDateTime=(" "+ne[5]).slice(1),Q.tagList.push(["PROGRAM-DATE-TIME",Q.rawProgramDateTime]),Ie===-1&&(Ie=S.length);else{if(ne=ne[0].match(p),!ne){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<ne.length&&!(typeof ne[pe]!="undefined");pe++);var ce=(" "+ne[pe]).slice(1),fe=(" "+ne[pe+1]).slice(1),Pe=ne[pe+2]?(" "+ne[pe+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":g.type=fe.toUpperCase();break;case"MEDIA-SEQUENCE":B=g.startSN=parseInt(fe);break;case"SKIP":{var qe=new _.AttrList(fe),Ve=qe.decimalInteger("SKIPPED-SEGMENTS");if(Object(F.isFiniteNumber)(Ve)){g.skippedSegments=Ve;for(var Ze=Ve;Ze--;)S.unshift(null);B+=Ve}var ct=qe.enumeratedString("RECENTLY-REMOVED-DATERANGES");ct&&(g.recentlyRemovedDateranges=ct.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(fe);break;case"VERSION":g.version=parseInt(fe);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(fe||Pe)&&Q.tagList.push(Pe?[fe,Pe]:[fe]);break;case"DIS":j++;case"GAP":Q.tagList.push([ce]);break;case"BITRATE":Q.tagList.push([ce,fe]);break;case"DISCONTINUITY-SEQ":j=parseInt(fe);break;case"KEY":{var je,Be=new _.AttrList(fe),Xe=Be.enumeratedString("METHOD"),et=Be.URI,Qe=Be.hexadecimalInteger("IV"),Ne=Be.enumeratedString("KEYFORMATVERSIONS"),Ue=Be.enumeratedString("KEYID"),lt=(je=Be.enumeratedString("KEYFORMAT"))!=null?je:"identity",ut=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ut.indexOf(lt)>-1){y.logger.warn("Keyformat "+lt+" is not supported from the manifest");continue}else if(lt!=="identity")continue;Xe&&(xe=R.LevelKey.fromURL(f,et),et&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Xe)>=0&&(xe.method=Xe,xe.keyFormat=lt,Ue&&(xe.keyID=Ue),Ne&&(xe.keyFormatVersions=Ne),xe.iv=Qe));break}case"START":{var ot=new _.AttrList(fe),Je=ot.decimalFloatingPoint("TIME-OFFSET");Object(F.isFiniteNumber)(Je)&&(g.startTimeOffset=Je);break}case"MAP":{var vt=new _.AttrList(fe);Q.relurl=vt.URI,vt.BYTERANGE&&Q.setByteRange(vt.BYTERANGE),Q.level=d,Q.sn="initSegment",xe&&(Q.levelkey=xe),Q.initSegment=null,P=Q,Ae=!0;break}case"SERVER-CONTROL":{var ft=new _.AttrList(fe);g.canBlockReload=ft.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=ft.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&ft.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=ft.optionalFloat("PART-HOLD-BACK",0),g.holdBack=ft.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var st=new _.AttrList(fe);g.partTarget=st.decimalFloatingPoint("PART-TARGET");break}case"PART":{var _e=g.partList;_e||(_e=g.partList=[]);var pt=H>0?_e[_e.length-1]:void 0,dt=H++,Re=new U.Part(new _.AttrList(fe),Q,f,dt,pt);_e.push(Re),Q.duration+=Re.duration;break}case"PRELOAD-HINT":{var Ke=new _.AttrList(fe);g.preloadHint=Ke;break}case"RENDITION-REPORT":{var be=new _.AttrList(fe);g.renditionReports=g.renditionReports||[],g.renditionReports.push(be);break}default:y.logger.warn("line parsed but not handled: "+ne);break}}}N&&!N.relurl?(S.pop(),Y-=N.duration,g.partList&&(g.fragmentHint=N)):g.partList&&(h(Q,N),Q.cc=j,g.fragmentHint=Q);var de=S.length,he=S[0],$=S[de-1];if(Y+=g.skippedSegments*g.targetduration,Y>0&&de&&$){g.averagetargetduration=Y/de;var J=$.sn;g.endSN=J!=="initSegment"?J:0,he&&(g.startCC=he.cc,he.initSegment||g.fragments.every(function(re){return re.relurl&&a(re.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Q=new U.Fragment(o,f),Q.relurl=$.relurl,Q.level=d,Q.sn="initSegment",he.initSegment=Q,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(Y+=g.fragmentHint.duration),g.totalduration=Y,g.endCC=j,Ie>0&&m(S,Ie),g},D}();function u(D,v){["video","audio","text"].forEach(function(c){var f=D.filter(function(o){return Object(w.isCodecType)(o,c)});if(f.length){var d=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});v[c+"Codec"]=d.length>0?d[0]:f[0],D=D.filter(function(o){return f.indexOf(o)===-1})}}),v.unknownCodecs=D}function b(D,v,c){var f=v[c];f&&(D[c]=f)}function m(D,v){for(var c=D[v],f=v;f--;){var d=D[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(D,v){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):v!=null&&v.programDateTime&&(D.programDateTime=v.endProgramDateTime),Object(F.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/polyfills/number.ts"),T=A("./src/events.ts"),M=A("./src/errors.ts"),U=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/m3u8-parser.ts"),_=A("./src/types/loader.ts"),y=A("./src/utils/attr-list.ts");function w(C){var p=C.type;switch(p){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function L(C,p){var l=C.url;return(l===void 0||l.indexOf("data:")===0)&&(l=p.url),l}var O=function(){function C(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var p=C.prototype;return p.registerListeners=function(){var a=this.hls;a.on(T.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(T.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(T.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(T.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var a=this.hls;a.off(T.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(T.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(T.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(T.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(a){var s=this.hls.config,u=s.pLoader,b=s.loader,m=u||b,h=new m(s);return a.loader=h,this.loaders[a.type]=h,h},p.getInternalLoader=function(a){return this.loaders[a.type]},p.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},p.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(a,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},p.onLevelLoading=function(a,s){var u=s.id,b=s.level,m=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:null,level:b,responseType:"text",type:_.PlaylistContextType.LEVEL,url:m,deliveryDirectives:h})},p.onAudioTrackLoading=function(a,s){var u=s.id,b=s.groupId,m=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:b,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:h})},p.onSubtitleTrackLoading=function(a,s){var u=s.id,b=s.groupId,m=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:b,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:h})},p.load=function(a){var s,u=this.hls.config,b=this.getInternalLoader(a);if(b){var m=b.context;if(m&&m.url===a.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),b.abort()}var h,D,v,c;switch(a.type){case _.PlaylistContextType.MANIFEST:h=u.manifestLoadingMaxRetry,D=u.manifestLoadingTimeOut,v=u.manifestLoadingRetryDelay,c=u.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:h=0,D=u.levelLoadingTimeOut;break;default:h=u.levelLoadingMaxRetry,D=u.levelLoadingTimeOut,v=u.levelLoadingRetryDelay,c=u.levelLoadingMaxRetryTimeout;break}if(b=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(a.type===_.PlaylistContextType.LEVEL&&a.level!==null?f=this.hls.levels[a.level].details:a.type===_.PlaylistContextType.AUDIO_TRACK&&a.id!==null?f=this.hls.audioTracks[a.id].details:a.type===_.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(f=this.hls.subtitleTracks[a.id].details),f){var d=f.partTarget,o=f.targetduration;d&&o&&(D=Math.min(Math.max(d*3,o*.8)*1e3,D))}}var E={timeout:D,maxRetry:h,retryDelay:v,maxRetryDelay:c,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};b.load(a,E,g)},p.loadsuccess=function(a,s,u,b){if(b===void 0&&(b=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,s,u,b);return}this.resetInternalLoader(u.type);var m=a.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",b);return}s.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,u,b):this.handleMasterPlaylist(a,s,u,b)},p.loaderror=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,a)},p.loadtimeout=function(a,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},p.handleMasterPlaylist=function(a,s,u,b){var m=this.hls,h=a.data,D=L(a,u),v=R.default.parseMasterPlaylist(h,D),c=v.levels,f=v.sessionData;if(!c.length){this.handleManifestParsingError(a,u,"no level found in manifest",b);return}var d=c.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),o=c.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),E=R.default.parseMasterPlaylistMedia(h,D,"AUDIO",d),g=R.default.parseMasterPlaylistMedia(h,D,"SUBTITLES",o),S=R.default.parseMasterPlaylistMedia(h,D,"CLOSED-CAPTIONS");if(E.length){var P=E.some(function(B){return!B.url});!P&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(U.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 y.AttrList({}),bitrate:0,url:""}))}m.trigger(T.Events.MANIFEST_LOADED,{levels:c,audioTracks:E,subtitles:g,captions:S,url:D,stats:s,networkDetails:b,sessionData:f})},p.handleTrackOrLevelPlaylist=function(a,s,u,b){var m=this.hls,h=u.id,D=u.level,v=u.type,c=L(a,u),f=Object(F.isFiniteNumber)(h)?h:0,d=Object(F.isFiniteNumber)(D)?D:f,o=w(u),E=R.default.parseLevelPlaylist(a.data,c,d,o,f);if(!E.fragments.length){m.trigger(T.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(v===_.PlaylistContextType.MANIFEST){var g={attrs:new y.AttrList({}),bitrate:0,details:E,name:"",url:c};m.trigger(T.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:s,networkDetails:b,sessionData:null})}if(s.parsing.end=performance.now(),E.needSidxRanges){var S,P=(S=E.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:P,isSidxRequest:!0,type:v,level:D,levelDetails:E,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=E,this.handlePlaylistLoaded(a,s,u,b)},p.handleSidxRequest=function(a,s){var u=Object(I.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var b=u.references,m=s.levelDetails;b.forEach(function(h,D){var v=h.info,c=m.fragments[D];c.byteRange.length===0&&c.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),c.initSegment&&c.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(a,s,u,b){this.hls.trigger(T.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:s,networkDetails:b})},p.handleNetworkError=function(a,s,u,b){u===void 0&&(u=!1),U.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 m=M.ErrorDetails.UNKNOWN,h=!1,D=this.getInternalLoader(a);switch(a.type){case _.PlaylistContextType.MANIFEST:m=u?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case _.PlaylistContextType.LEVEL:m=u?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case _.PlaylistContextType.AUDIO_TRACK:m=u?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:m=u?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}D&&this.resetInternalLoader(a.type);var v={type:M.ErrorTypes.NETWORK_ERROR,details:m,fatal:h,url:a.url,loader:D,context:a,networkDetails:s};b&&(v.response=b),this.hls.trigger(T.Events.ERROR,v)},p.handlePlaylistLoaded=function(a,s,u,b){var m=u.type,h=u.level,D=u.id,v=u.groupId,c=u.loader,f=u.levelDetails,d=u.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",b);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(m){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(T.Events.LEVEL_LOADED,{details:f,level:h||0,id:D||0,stats:s,networkDetails:b,deliveryDirectives:d});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(T.Events.AUDIO_TRACK_LOADED,{details:f,id:D||0,groupId:v||"",stats:s,networkDetails:b,deliveryDirectives:d});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(T.Events.SUBTITLE_TRACK_LOADED,{details:f,id:D||0,groupId:v||"",stats:s,networkDetails:b,deliveryDirectives:d});break}},C}();K.default=O},"./src/polyfills/number.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"isFiniteNumber",function(){return F}),A.d(K,"MAX_SAFE_INTEGER",function(){return T});var F=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},T=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,K,A){"use strict";A.r(K);var F=function(){function T(){}return T.getSilentFrame=function(U,I){switch(U){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},T}();K.default=F},"./src/remux/mp4-generator.ts":function(q,K,A){"use strict";A.r(K);var F=Math.pow(2,32)-1,T=function(){function M(){}return M.init=function(){M.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 I;for(I in M.types)M.types.hasOwnProperty(I)&&(M.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=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]);M.HDLR_TYPES={video:R,audio:_};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=w,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var L=new Uint8Array([105,115,111,109]),O=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,L,C,L,O),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,y))},M.box=function(I){for(var R=8,_=arguments.length,y=new Array(_>1?_-1:0),w=1;w<_;w++)y[w-1]=arguments[w];for(var L=y.length,O=L;L--;)R+=y[L].byteLength;var C=new Uint8Array(R);for(C[0]=R>>24&255,C[1]=R>>16&255,C[2]=R>>8&255,C[3]=R&255,C.set(I,4),L=0,R=8;L<O;L++)C.set(y[L],R),R+=y[L].byteLength;return C},M.hdlr=function(I){return M.box(M.types.hdlr,M.HDLR_TYPES[I])},M.mdat=function(I){return M.box(M.types.mdat,I)},M.mdhd=function(I,R){R*=I;var _=Math.floor(R/(F+1)),y=Math.floor(R%(F+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},M.mdia=function(I){return M.box(M.types.mdia,M.mdhd(I.timescale,I.duration),M.hdlr(I.type),M.minf(I))},M.mfhd=function(I){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},M.minf=function(I){return I.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(I)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(I))},M.moof=function(I,R,_){return M.box(M.types.moof,M.mfhd(I),M.traf(_,R))},M.moov=function(I){for(var R=I.length,_=[];R--;)_[R]=M.trak(I[R]);return M.box.apply(null,[M.types.moov,M.mvhd(I[0].timescale,I[0].duration)].concat(_).concat(M.mvex(I)))},M.mvex=function(I){for(var R=I.length,_=[];R--;)_[R]=M.trex(I[R]);return M.box.apply(null,[M.types.mvex].concat(_))},M.mvhd=function(I,R){R*=I;var _=Math.floor(R/(F+1)),y=Math.floor(R%(F+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,w)},M.sdtp=function(I){var R=I.samples||[],_=new Uint8Array(4+R.length),y,w;for(y=0;y<R.length;y++)w=R[y].flags,_[y+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return M.box(M.types.sdtp,_)},M.stbl=function(I){return M.box(M.types.stbl,M.stsd(I),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(I){var R=[],_=[],y,w,L;for(y=0;y<I.sps.length;y++)w=I.sps[y],L=w.byteLength,R.push(L>>>8&255),R.push(L&255),R=R.concat(Array.prototype.slice.call(w));for(y=0;y<I.pps.length;y++)w=I.pps[y],L=w.byteLength,_.push(L>>>8&255),_.push(L&255),_=_.concat(Array.prototype.slice.call(w));var O=M.box(M.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|I.sps.length].concat(R).concat([I.pps.length]).concat(_))),C=I.width,p=I.height,l=I.pixelRatio[0],a=I.pixelRatio[1];return M.box(M.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,C>>8&255,C&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),O,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,a>>24,a>>16&255,a>>8&255,a&255])))},M.esds=function(I){var R=I.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(I.config).concat([6,1,2]))},M.mp4a=function(I){var R=I.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),M.box(M.types.esds,M.esds(I)))},M.mp3=function(I){var R=I.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},M.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(I)):M.box(M.types.stsd,M.STSD,M.mp4a(I)):M.box(M.types.stsd,M.STSD,M.avc1(I))},M.tkhd=function(I){var R=I.id,_=I.duration*I.timescale,y=I.width,w=I.height,L=Math.floor(_/(F+1)),O=Math.floor(_%(F+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,L>>24,L>>16&255,L>>8&255,L&255,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,w>>8&255,w&255,0,0]))},M.traf=function(I,R){var _=M.sdtp(I),y=I.id,w=Math.floor(R/(F+1)),L=Math.floor(R%(F+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,L>>24,L>>16&255,L>>8&255,L&255])),M.trun(I,_.length+16+20+8+16+8+8),_)},M.trak=function(I){return I.duration=I.duration||4294967295,M.box(M.types.trak,M.tkhd(I),M.mdia(I))},M.trex=function(I){var R=I.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(I,R){var _=I.samples||[],y=_.length,w=12+16*y,L=new Uint8Array(w),O,C,p,l,a,s;for(R+=8+w,L.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),O=0;O<y;O++)C=_[O],p=C.duration,l=C.size,a=C.flags,s=C.cts,L.set([p>>>24&255,p>>>16&255,p>>>8&255,p&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*O);return M.box(M.types.trun,L)},M.initSegment=function(I){M.types||M.init();var R=M.moov(I),_=new Uint8Array(M.FTYP.byteLength+R.byteLength);return _.set(M.FTYP),_.set(R,M.FTYP.byteLength),_},M}();T.types=void 0,T.HDLR_TYPES=void 0,T.STTS=void 0,T.STSC=void 0,T.STCO=void 0,T.STSZ=void 0,T.VMHD=void 0,T.SMHD=void 0,T.STSD=void 0,T.FTYP=void 0,T.DINF=void 0,K.default=T},"./src/remux/mp4-remuxer.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return s}),A.d(K,"normalizePts",function(){return u});var F=A("./src/polyfills/number.ts"),T=A("./src/remux/aac-helper.ts"),M=A("./src/remux/mp4-generator.ts"),U=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),_=A("./src/types/loader.ts"),y=A("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(D){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(D[f]=c[f])}return D},w.apply(this,arguments)}var L=10*1e3,O=1024,C=1152,p=null,l=null,a=!1,s=function(){function D(c,f,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=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,p===null){var E=navigator.userAgent||"",g=E.match(/Chrome\/(\d+)/i);p=g?parseInt(g[1]):0}if(l===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);l=S?parseInt(S[1]):0}a=!!p&&p<75||!!l&&l<600}var v=D.prototype;return v.destroy=function(){},v.resetTimeStamp=function(f){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},v.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},v.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},v.getVideoStartPts=function(f){var d=!1,o=f.reduce(function(E,g){var S=g.pts-E;return S<-4294967296?(d=!0,u(E,g.pts)):S>0?E:g.pts},f[0].pts);return d&&R.logger.debug("PTS rollover detected"),o},v.remux=function(f,d,o,E,g,S,P,B){var H,Y,j,N,Q,ne,pe=g,xe=g,Ie=f.pid>-1,Ae=d.pid>-1,De=d.samples.length,Ce=f.samples.length>0,Oe=De>1,ce=(!Ie||Ce)&&(!Ae||Oe)||this.ISGenerated||P;if(ce){this.ISGenerated||(j=this.generateIS(f,d,g));var fe=this.isVideoContiguous,Pe=-1;if(Oe&&(Pe=b(d.samples),!fe&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,Pe>0){R.logger.warn("[mp4-remuxer]: Dropped "+Pe+" out of "+De+" video samples due to a missing keyframe");var qe=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(Pe),d.dropped+=Pe,xe+=(d.samples[0].pts-qe)/(d.timescale||9e4)}else Pe===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+De+" video samples"),ne=!1);if(this.ISGenerated){if(Ce&&Oe){var Ve=this.getVideoStartPts(d.samples),Ze=u(f.samples[0].pts,Ve)-Ve,ct=Ze/d.inputTimeScale;pe+=Math.max(0,ct),xe+=Math.max(0,-ct)}if(Ce){if(f.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(f,d,g)),Y=this.remuxAudio(f,pe,this.isAudioContiguous,S,Ae||Oe||B===_.PlaylistLevelType.AUDIO?xe:void 0),Oe){var je=Y?Y.endPTS-Y.startPTS:0;d.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(f,d,g)),H=this.remuxVideo(d,xe,fe,je)}}else Oe&&(H=this.remuxVideo(d,xe,fe,0));H&&(H.firstKeyFrame=Pe,H.independent=Pe!==-1)}}return this.ISGenerated&&(o.samples.length&&(Q=this.remuxID3(o,g)),E.samples.length&&(N=this.remuxText(E,g))),{audio:Y,video:H,initSegment:j,independent:ne,text:N,id3:Q}},v.generateIS=function(f,d,o){var E=f.samples,g=d.samples,S=this.typeSupported,P={},B=!Object(F.isFiniteNumber)(this._initPTS),H="audio/mp4",Y,j,N;if(B&&(Y=j=Infinity),f.config&&E.length&&(f.timescale=f.samplerate,f.isAAC||(S.mpeg?(H="audio/mpeg",f.codec=""):S.mp3&&(f.codec="mp3")),P.audio={id:"audio",container:H,codec:f.codec,initSegment:!f.isAAC&&S.mpeg?new Uint8Array(0):M.default.initSegment([f]),metadata:{channelCount:f.channelCount}},B&&(N=f.inputTimeScale,Y=j=E[0].pts-Math.round(N*o))),d.sps&&d.pps&&g.length&&(d.timescale=d.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:M.default.initSegment([d]),metadata:{width:d.width,height:d.height}},B)){N=d.inputTimeScale;var Q=this.getVideoStartPts(g),ne=Math.round(N*o);j=Math.min(j,u(g[0].dts,Q)-ne),Y=Math.min(Y,Q-ne)}if(Object.keys(P).length)return this.ISGenerated=!0,B&&(this._initPTS=Y,this._initDTS=j),{tracks:P,initPTS:Y,timescale:N}},v.remuxVideo=function(f,d,o,E){var g=f.inputTimeScale,S=f.samples,P=[],B=S.length,H=this._initPTS,Y=this.nextAvcDts,j=8,N,Q,ne,pe=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,Ie=0,Ae=!1;if(!o||Y===null){var De=d*g,Ce=S[0].pts-u(S[0].dts,S[0].pts);Y=De-Ce}for(var Oe=0;Oe<B;Oe++){var ce=S[Oe];if(ce.pts=u(ce.pts-H,Y),ce.dts=u(ce.dts-H,Y),ce.dts>ce.pts){var fe=9e4*.2;Ie=Math.max(Math.min(Ie,ce.pts-ce.dts),-1*fe)}ce.dts<S[Oe>0?Oe-1:Oe].dts&&(Ae=!0)}Ae&&S.sort(function(Zt,Rt){var Tt=Zt.dts-Rt.dts,nr=Zt.pts-Rt.pts;return Tt||nr}),Q=S[0].dts,ne=S[S.length-1].dts;var Pe=Math.round((ne-Q)/(B-1));if(Ie<0){if(Ie<Pe*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-Pe,!0)+" ms");for(var qe=Ie,Ve=0;Ve<B;Ve++)S[Ve].dts=qe=Math.max(qe,S[Ve].pts-Pe),S[Ve].pts=Math.max(qe,S[Ve].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Ie,!0)+" ms to overcome this issue");for(var Ze=0;Ze<B;Ze++)S[Ze].dts=S[Ze].dts+Ie}Q=S[0].dts}if(o){var ct=Q-Y,je=ct>Pe,Be=ct<-1;if(je||Be){je?R.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(ct,!0)+" ms ("+ct+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-ct,!0)+" ms ("+ct+"dts) overlapping between fragments detected"),Q=Y;var Xe=S[0].pts-ct;S[0].dts=Q,S[0].pts=Xe,R.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Xe,!0)+"/"+Object(y.toMsFromMpegTsClock)(Q,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(ct,!0)+" ms")}}a&&(Q=Math.max(0,Q));for(var et=0,Qe=0,Ne=0;Ne<B;Ne++){for(var Ue=S[Ne],lt=Ue.units,ut=lt.length,ot=0,Je=0;Je<ut;Je++)ot+=lt[Je].data.length;Qe+=ot,et+=ut,Ue.length=ot,Ue.dts=Math.max(Ue.dts,Q),Ue.pts=Math.max(Ue.pts,Ue.dts,0),pe=Math.min(Ue.pts,pe),xe=Math.max(Ue.pts,xe)}ne=S[B-1].dts;var vt=Qe+4*et+8,ft;try{ft=new Uint8Array(vt)}catch(Zt){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:vt,reason:"fail allocating video mdat "+vt});return}var st=new DataView(ft.buffer);st.setUint32(0,vt),ft.set(M.default.types.mdat,4);for(var _e=0;_e<B;_e++){for(var pt=S[_e],dt=pt.units,Re=0,Ke=0,be=dt.length;Ke<be;Ke++){var de=dt[Ke],he=de.data,$=de.data.byteLength;st.setUint32(j,$),j+=4,ft.set(he,j),j+=$,Re+=4+$}if(_e<B-1)N=S[_e+1].dts-pt.dts;else{var J=this.config,re=pt.dts-S[_e>0?_e-1:_e].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(J.maxBufferHole*g),ve=(E?pe+E*g:this.nextAudioPts)-pt.pts;ve>le?(N=ve-re,N<0&&(N=re),R.logger.log("[mp4-remuxer]: It is approximately "+ve/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=re}else N=re}var Le=Math.round(pt.pts-pt.dts);P.push(new m(pt.key,N,Re,Le))}if(P.length&&p&&p<70){var Fe=P[0].flags;Fe.dependsOn=2,Fe.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Y=ne+N,this.isVideoContiguous=!0;var it=M.default.moof(f.sequenceNumber++,Q,w({},f,{samples:P})),xt="video",gt={data1:it,data2:ft,startPTS:pe/g,endPTS:(xe+N)/g,startDTS:Q/g,endDTS:Y/g,type:xt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(ft.length,"MDAT length must not be zero"),gt},v.remuxAudio=function(f,d,o,E,g){var S=f.inputTimeScale,P=f.samplerate?f.samplerate:S,B=S/P,H=f.isAAC?O:C,Y=H*B,j=this._initPTS,N=!f.isAAC&&this.typeSupported.mpeg,Q=[],ne=f.samples,pe=N?0:8,xe=this.nextAudioPts||-1,Ie=d*S;if(this.isAudioContiguous=o=o||ne.length&&xe>0&&(E&&Math.abs(Ie-xe)<9e3||Math.abs(u(ne[0].pts-j,Ie)-xe)<20*Y),ne.forEach(function(he){he.pts=u(he.pts-j,Ie)}),!o||xe<0){if(ne=ne.filter(function(he){return he.pts>=0}),!ne.length)return;g===0?xe=0:E?xe=Math.max(0,Ie):xe=ne[0].pts}if(f.isAAC)for(var Ae=g!==void 0,De=this.config.maxAudioFramesDrift,Ce=0,Oe=xe;Ce<ne.length;Ce++){var ce=ne[Ce],fe=ce.pts,Pe=fe-Oe,qe=Math.abs(1e3*Pe/S);if(Pe<=-De*Y&&Ae)Ce===0&&(R.logger.warn("Audio frame @ "+(fe/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Pe/S)+" ms."),this.nextAudioPts=xe=Oe=fe);else if(Pe>=De*Y&&qe<L&&Ae){var Ve=Math.round(Pe/Y);Oe=fe-Ve*Y,Oe<0&&(Ve--,Oe+=Y),Ce===0&&(this.nextAudioPts=xe=Oe),R.logger.warn("[mp4-remuxer]: Injecting "+Ve+" audio frame @ "+(Oe/S).toFixed(3)+"s due to "+Math.round(1e3*Pe/S)+" ms gap.");for(var Ze=0;Ze<Ve;Ze++){var ct=Math.max(Oe,0),je=T.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);je||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=ce.unit.subarray()),ne.splice(Ce,0,{unit:je,pts:ct}),Oe+=Y,Ce++}}ce.pts=Oe,Oe+=Y}for(var Be=null,Xe=null,et,Qe=0,Ne=ne.length;Ne--;)Qe+=ne[Ne].unit.byteLength;for(var Ue=0,lt=ne.length;Ue<lt;Ue++){var ut=ne[Ue],ot=ut.unit,Je=ut.pts;if(Xe!==null){var vt=Q[Ue-1];vt.duration=Math.round((Je-Xe)/B)}else if(o&&f.isAAC&&(Je=xe),Be=Je,Qe>0){Qe+=pe;try{et=new Uint8Array(Qe)}catch(he){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Qe,reason:"fail allocating audio mdat "+Qe});return}if(!N){var ft=new DataView(et.buffer);ft.setUint32(0,Qe),et.set(M.default.types.mdat,4)}}else return;et.set(ot,pe);var st=ot.byteLength;pe+=st,Q.push(new m(!0,H,st,0)),Xe=Je}var _e=Q.length;if(!_e)return;var pt=Q[Q.length-1];this.nextAudioPts=xe=Xe+B*pt.duration;var dt=N?new Uint8Array(0):M.default.moof(f.sequenceNumber++,Be/B,w({},f,{samples:Q}));f.samples=[];var Re=Be/S,Ke=xe/S,be="audio",de={data1:dt,data2:et,startPTS:Re,endPTS:Ke,startDTS:Re,endDTS:Ke,type:be,hasAudio:!0,hasVideo:!1,nb:_e};return this.isAudioContiguous=!0,console.assert(et.length,"MDAT length must not be zero"),de},v.remuxEmptyAudio=function(f,d,o,E){var g=f.inputTimeScale,S=f.samplerate?f.samplerate:g,P=g/S,B=this.nextAudioPts,H=(B!==null?B:E.startDTS*g)+this._initDTS,Y=E.endDTS*g+this._initDTS,j=P*O,N=Math.ceil((Y-H)/j),Q=T.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!Q){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ne=[],pe=0;pe<N;pe++){var xe=H+pe*j;ne.push({unit:Q,pts:xe,dts:xe})}return f.samples=ne,this.remuxAudio(f,d,o,!1)},v.remuxID3=function(f,d){var o=f.samples.length;if(!o)return;for(var E=f.inputTimeScale,g=this._initPTS,S=this._initDTS,P=0;P<o;P++){var B=f.samples[P];B.pts=u(B.pts-g,d*E)/E,B.dts=u(B.dts-S,d*E)/E}var H=f.samples;return f.samples=[],{samples:H}},v.remuxText=function(f,d){var o=f.samples.length;if(!o)return;for(var E=f.inputTimeScale,g=this._initPTS,S=0;S<o;S++){var P=f.samples[S];P.pts=u(P.pts-g,d*E)/E}f.samples.sort(function(H,Y){return H.pts-Y.pts});var B=f.samples;return f.samples=[],{samples:B}},D}();function u(D,v){var c;if(v===null)return D;for(v<D?c=-8589934592:c=8589934592;Math.abs(D-v)>4294967296;)D+=c;return D}function b(D){for(var v=0;v<D.length;v++)if(D[v].key)return v;return-1}var m=function(v,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(v)},h=function(v){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=v?2:1,this.isNonSync=v?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/polyfills/number.ts"),T=A("./src/utils/mp4-tools.ts"),M=A("./src/loader/fragment.ts"),U=A("./src/utils/logger.ts"),I=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var w=y.prototype;return w.destroy=function(){},w.resetTimeStamp=function(O){this.initPTS=O,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(O,C,p){this.audioCodec=C,this.videoCodec=p,this.generateInitSegment(O),this.emitInitSegment=!0},w.generateInitSegment=function(O){var C=this.audioCodec,p=this.videoCodec;if(!O||!O.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(T.parseInitSegment)(O);C||(C=_(l.audio,M.ElementaryStreamTypes.AUDIO)),p||(p=_(l.video,M.ElementaryStreamTypes.VIDEO));var a={};l.audio&&l.video?a.audiovideo={container:"video/mp4",codec:C+","+p,initSegment:O,id:"main"}:l.audio?a.audio={container:"audio/mp4",codec:C,initSegment:O,id:"audio"}:l.video?a.video={container:"video/mp4",codec:p,initSegment:O,id:"main"}:U.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},w.remux=function(O,C,p,l,a){var s=this.initPTS,u=this.lastEndDTS,b={audio:void 0,video:void 0,text:l,id3:p,initSegment:void 0};Object(F.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var m=C.samples;if(!m||!m.length)return b;var h={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(m),D=this.initData),!D||!D.length)return U.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),b;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(F.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=R(D,m,u));var v=Object(T.getDuration)(m,D),c=u,f=v+c;Object(T.offsetStartDTS)(D,m,s),v>0?this.lastEndDTS=f:(U.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 g={data1:m,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:E,hasAudio:d,hasVideo:o,nb:1,dropped:0};return b.audio=g.type==="audio"?g:void 0,b.video=g.type!=="audio"?g:void 0,b.text=l,b.id3=p,b.initSegment=h,b},y}(),R=function(w,L,O){return Object(T.getStartDTS)(w,L)-O};function _(y,w){var L=y==null?void 0:y.codec;return L&&L.length>4?L:L==="hvc1"?"hvc1.1.c.L120.90":L==="av01"?"av01.0.04M.08":L==="avc1"||w===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=I},"./src/task-loop.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return F});var F=function(){function T(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=T.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},T}()},"./src/types/cmcd.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"CMCDVersion",function(){return F}),A.d(K,"CMCDObjectType",function(){return T}),A.d(K,"CMCDStreamingFormat",function(){return M}),A.d(K,"CMCDStreamType",function(){return U});var F=1,T;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(T||(T={}));var M;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(M||(M={}));var U;(function(I){I.VOD="v",I.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"HlsSkip",function(){return M}),A.d(K,"getSkipValue",function(){return U}),A.d(K,"HlsUrlParameters",function(){return I}),A.d(K,"Level",function(){return R});function F(_,y){for(var w=0;w<y.length;w++){var L=y[w];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(_,L.key,L)}}function T(_,y,w){return y&&F(_.prototype,y),w&&F(_,w),_}var M;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(M||(M={}));function U(_,y){var w=_.canSkipUntil,L=_.canSkipDateRanges,O=_.endSN,C=y!==void 0?y-O:0;return w&&C<w?L?M.v2:M.Yes:M.No}var I=function(){function _(w,L,O){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=L,this.skip=O}var y=_.prototype;return y.addDirectives=function(L){var O=new self.URL(L);return this.msn!==void 0&&O.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&O.searchParams.set("_HLS_part",this.part.toString()),this.skip&&O.searchParams.set("_HLS_skip",this.skip),O.toString()},_}(),R=function(){function _(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return T(_,[{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(w){var L=w%this.url.length;this._urlId!==L&&(this.details=void 0,this._urlId=L)}}]),_}()},"./src/types/loader.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"PlaylistContextType",function(){return F}),A.d(K,"PlaylistLevelType",function(){return T});var F;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(F||(F={}));var T;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(T||(T={}))},"./src/types/transmuxer.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"ChunkMetadata",function(){return F});var F=function(U,I,R,_,y,w){_===void 0&&(_=0),y===void 0&&(y=-1),w===void 0&&(w=!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=T(),this.buffering={audio:T(),video:T(),audiovideo:T()},this.level=U,this.sn=I,this.id=R,this.size=_,this.part=y,this.partial=w};function T(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"AttrList",function(){return M});var F=/^(\d+)x(\d+)$/,T=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function U(R){typeof R=="string"&&(R=U.parseAttrList(R));for(var _ in R)R.hasOwnProperty(_)&&(this[_]=R[_])}var I=U.prototype;return I.decimalInteger=function(_){var y=parseInt(this[_],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},I.hexadecimalInteger=function(_){if(this[_]){var y=(this[_]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var w=new Uint8Array(y.length/2),L=0;L<y.length/2;L++)w[L]=parseInt(y.slice(L*2,L*2+2),16);return w}else return null},I.hexadecimalIntegerAsNumber=function(_){var y=parseInt(this[_],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},I.decimalFloatingPoint=function(_){return parseFloat(this[_])},I.optionalFloat=function(_,y){var w=this[_];return w?parseFloat(w):y},I.enumeratedString=function(_){return this[_]},I.bool=function(_){return this[_]==="YES"},I.decimalResolution=function(_){var y=F.exec(this[_]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},U.parseAttrList=function(_){var y,w={},L='"';for(T.lastIndex=0;(y=T.exec(_))!==null;){var O=y[2];O.indexOf(L)===0&&O.lastIndexOf(L)===O.length-1&&(O=O.slice(1,-1)),w[y[1]]=O}return w},U}()},"./src/utils/binary-search.ts":function(q,K,A){"use strict";A.r(K);var F={search:function(M,U){for(var I=0,R=M.length-1,_=null,y=null;I<=R;){_=(I+R)/2|0,y=M[_];var w=U(y);if(w>0)I=_+1;else if(w<0)R=_-1;else return y}return null}};K.default=F},"./src/utils/buffer-helper.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"BufferHelper",function(){return M});var F=A("./src/utils/logger.ts"),T={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function U(){}return U.isBuffered=function(R,_){try{if(R){for(var y=U.getBuffered(R),w=0;w<y.length;w++)if(_>=y.start(w)&&_<=y.end(w))return!0}}catch(L){}return!1},U.bufferInfo=function(R,_,y){try{if(R){var w=U.getBuffered(R),L=[],O;for(O=0;O<w.length;O++)L.push({start:w.start(O),end:w.end(O)});return this.bufferedInfo(L,_,y)}}catch(C){}return{len:0,start:_,end:_,nextStart:void 0}},U.bufferedInfo=function(R,_,y){_=Math.max(0,_),R.sort(function(h,D){var v=h.start-D.start;return v||D.end-h.end});var w=[];if(y)for(var L=0;L<R.length;L++){var O=w.length;if(O){var C=w[O-1].end;R[L].start-C<y?R[L].end>C&&(w[O-1].end=R[L].end):w.push(R[L])}else w.push(R[L])}else w=R;for(var p=0,l,a=_,s=_,u=0;u<w.length;u++){var b=w[u].start,m=w[u].end;if(_+y>=b&&_<m)a=b,s=m,p=s-_;else if(_+y<b){l=b;break}}return{len:p,start:a||0,end:s||0,nextStart:l}},U.getBuffered=function(R){try{return R.buffered}catch(_){return F.logger.log("failed to get media.buffered",_),T}},U}()},"./src/utils/cea-608-parser.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"Row",function(){return s}),A.d(K,"CaptionScreen",function(){return u});var F=A("./src/utils/logger.ts"),T={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},M=function(f){var d=f;return T.hasOwnProperty(f)&&(d=T[f]),String.fromCharCode(d)},U=15,I=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},L=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],O;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(O||(O={}));var C=function(){function c(){this.time=null,this.verboseLevel=O.ERROR}var f=c.prototype;return f.log=function(o,E){this.verboseLevel>=o&&F.logger.log(this.time+" ["+o+"] "+E)},c}(),p=function(f){for(var d=[],o=0;o<f.length;o++)d.push(f[o].toString(16));return d},l=function(){function c(d,o,E,g,S){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=g||"black",this.flash=S||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(o){for(var E=["foreground","underline","italics","background","flash"],g=0;g<E.length;g++){var S=E[g];o.hasOwnProperty(S)&&(this[S]=o[S])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},f.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),a=function(){function c(d,o,E,g,S,P){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new l(o,E,g,S,P)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(o,E){this.uchar=o,this.penState.copy(E)},f.setPenState=function(o){this.penState.copy(o)},f.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},f.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(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<I;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new l}var f=c.prototype;return f.equals=function(o){for(var E=!0,g=0;g<I;g++)if(!this.chars[g].equals(o.chars[g])){E=!1;break}return E},f.copy=function(o){for(var E=0;E<I;E++)this.chars[E].copy(o.chars[E])},f.isEmpty=function(){for(var o=!0,E=0;E<I;E++)if(!this.chars[E].isEmpty()){o=!1;break}return o},f.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(O.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(O.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},f.moveCursor=function(o){var E=this.pos+o;if(o>1)for(var g=this.pos+1;g<E+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(E)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(o){o>=144&&this.backSpace();var E=M(o);if(this.pos>=I){this.logger.log(O.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)},f.clearFromPos=function(o){var E;for(E=o;E<I;E++)this.chars[E].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var o=[],E=!0,g=0;g<I;g++){var S=this.chars[g].uchar;S!==" "&&(E=!1),o.push(S)}return E?"":o.join("")},f.setPenStyles=function(o){this.currPenState.setStyles(o);var E=this.chars[this.pos];E.setPenState(this.currPenState)},c}(),u=function(){function c(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<U;o++)this.rows.push(new s(d));this.logger=d,this.currRow=U-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var o=0;o<U;o++)this.rows[o].clear();this.currRow=U-1},f.equals=function(o){for(var E=!0,g=0;g<U;g++)if(!this.rows[g].equals(o.rows[g])){E=!1;break}return E},f.copy=function(o){for(var E=0;E<U;E++)this.rows[E].copy(o.rows[E])},f.isEmpty=function(){for(var o=!0,E=0;E<U;E++)if(!this.rows[E].isEmpty()){o=!1;break}return o},f.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},f.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},f.insertChar=function(o){var E=this.rows[this.currRow];E.insertChar(o)},f.setPen=function(o){var E=this.rows[this.currRow];E.setPenStyles(o)},f.moveCursor=function(o){var E=this.rows[this.currRow];E.moveCursor(o)},f.setCursor=function(o){this.logger.log(O.INFO,"setCursor: "+o);var E=this.rows[this.currRow];E.setCursor(o)},f.setPAC=function(o){this.logger.log(O.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 g=0;g<U;g++)this.rows[g].clear();var S=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var B=P.rows[S].cueStartTime,H=this.logger.time;if(B&&H!==null&&B<H)for(var Y=0;Y<this.nrRollUpRows;Y++)this.rows[E-this.nrRollUpRows+Y+1].copy(P.rows[S+Y])}}this.currRow=E;var j=this.rows[this.currRow];if(o.indent!==null){var N=o.indent,Q=Math.max(N-1,0);j.setCursor(o.indent),o.color=j.chars[Q].penState.foreground}var ne={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(ne)},f.setBkgData=function(o){this.logger.log(O.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},f.setRollUpRows=function(o){this.nrRollUpRows=o},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(O.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(O.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(o,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(O.INFO,"Rolling up")},f.getDisplayText=function(o){o=o||!1;for(var E=[],g="",S=-1,P=0;P<U;P++){var B=this.rows[P].getTextString();B&&(S=P+1,o?E.push("Row "+S+": '"+B+"'"):E.push(B.trim()))}return E.length>0&&(o?g="["+E.join(" | ")+"]":g=E.join(`
|
|
`)),g},f.getTextAndFormat=function(){return this.rows},c}(),b=function(){function c(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[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(O.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},f.insertChars=function(o){for(var E=0;E<o.length;E++)this.writeScreen.insertChar(o[E]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(O.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(O.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(O.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(O.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(O.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(o){this.logger.log(O.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},f.ccFON=function(){this.logger.log(O.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(O.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(O.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(O.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(O.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(O.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(O.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(O.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(O.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(o){this.logger.log(O.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},f.ccMIDROW=function(o){var E={flash:!1};if(E.underline=o%2===1,E.italics=o>=46,E.italics)E.foreground="white";else{var g=Math.floor(o/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=S[g]}this.logger.log(O.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},f.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))},f.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},c}(),m=function(){function c(d,o,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new C;this.channels=[null,new b(d,o,g),new b(d+1,E,g)],this.cmdHistory=v(),this.logger=g}var f=c.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,E){this.channels[o].setHandler(E)},f.addData=function(o,E){var g,S,P,B=!1;this.logger.time=o;for(var H=0;H<E.length;H+=2){if(S=E[H]&127,P=E[H+1]&127,S===0&&P===0)continue;if(this.logger.log(O.DATA,"["+p([E[H],E[H+1]])+"] -> ("+p([S,P])+")"),g=this.parseCmd(S,P),g||(g=this.parseMidrow(S,P)),g||(g=this.parsePAC(S,P)),g||(g=this.parseBackgroundAttributes(S,P)),!g&&(B=this.parseChars(S,P),B)){var Y=this.currentChannel;if(Y&&Y>0){var j=this.channels[Y];j.insertChars(B)}else this.logger.log(O.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!B&&this.logger.log(O.WARNING,"Couldn't parse cleaned data "+p([S,P])+" orig: "+p([E[H],E[H+1]]))}},f.parseCmd=function(o,E){var g=this.cmdHistory,S=(o===20||o===28||o===21||o===29)&&E>=32&&E<=47,P=(o===23||o===31)&&E>=33&&E<=35;if(!(S||P))return!1;if(D(o,E,g))return h(null,null,g),this.logger.log(O.DEBUG,"Repeated command ("+p([o,E])+") is dropped"),!0;var B=o===20||o===21||o===23?1:2,H=this.channels[B];return o===20||o===21||o===28||o===29?E===32?H.ccRCL():E===33?H.ccBS():E===34?H.ccAOF():E===35?H.ccAON():E===36?H.ccDER():E===37?H.ccRU(2):E===38?H.ccRU(3):E===39?H.ccRU(4):E===40?H.ccFON():E===41?H.ccRDC():E===42?H.ccTR():E===43?H.ccRTD():E===44?H.ccEDM():E===45?H.ccCR():E===46?H.ccENM():E===47&&H.ccEOC():H.ccTO(E-32),h(o,E,g),this.currentChannel=B,!0},f.parseMidrow=function(o,E){var g=0;if((o===17||o===25)&&E>=32&&E<=47){if(o===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(O.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[g];return S?(S.ccMIDROW(E),this.logger.log(O.DEBUG,"MIDROW ("+p([o,E])+")"),!0):!1}return!1},f.parsePAC=function(o,E){var g,S=this.cmdHistory,P=(o>=17&&o<=23||o>=25&&o<=31)&&E>=64&&E<=127,B=(o===16||o===24)&&E>=64&&E<=95;if(!(P||B))return!1;if(D(o,E,S))return h(null,null,S),!0;var H=o<=23?1:2;E>=64&&E<=95?g=H===1?R[o]:y[o]:g=H===1?_[o]:w[o];var Y=this.channels[H];return Y?(Y.setPAC(this.interpretPAC(g,E)),h(o,E,S),this.currentChannel=H,!0):!1},f.interpretPAC=function(o,E){var g,S={color:null,italics:!1,indent:null,underline:!1,row:o};return E>95?g=E-96:g=E-64,S.underline=(g&1)===1,g<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((g-16)/2)*4,S},f.parseChars=function(o,E){var g,S=null,P=null;if(o>=25?(g=2,P=o-8):(g=1,P=o),P>=17&&P<=19){var B;P===17?B=E+80:P===18?B=E+112:B=E+144,this.logger.log(O.INFO,"Special char '"+M(B)+"' in channel "+g),S=[B]}else o>=32&&o<=127&&(S=E===0?[o]:[o,E]);if(S){var H=p(S);this.logger.log(O.DEBUG,"Char codes = "+H.join(",")),h(o,E,this.cmdHistory)}return S},f.parseBackgroundAttributes=function(o,E){var g=(o===16||o===24)&&E>=32&&E<=47,S=(o===23||o===31)&&E>=45&&E<=47;if(!(g||S))return!1;var P,B={};o===16||o===24?(P=Math.floor((E-32)/2),B.background=L[P],E%2===1&&(B.background=B.background+"_semi")):E===45?B.background="transparent":(B.foreground="black",E===47&&(B.underline=!0));var H=o<=23?1:2,Y=this.channels[H];return Y.setBkgData(B),h(o,E,this.cmdHistory),!0},f.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var E=this.channels[o];E&&E.reset()}this.cmdHistory=v()},f.cueSplitAtTime=function(o){for(var E=0;E<this.channels.length;E++){var g=this.channels[E];g&&g.cueSplitAtTime(o)}},c}();function h(c,f,d){d.a=c,d.b=f}function D(c,f,d){return d.a===c&&d.b===f}function v(){return{a:null,b:null}}K.default=m},"./src/utils/codecs.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"isCodecType",function(){return T}),A.d(K,"isCodecSupportedInMp4",function(){return M});var F={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 T(U,I){var R=F[I];return!!R&&R[U.slice(0,4)]===!0}function M(U,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+U+'"')}},"./src/utils/cues.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/utils/vttparser.ts"),T=A("./src/utils/webvtt-parser.ts"),M=A("./src/utils/texttrack-utils.ts"),U=/\s/,I={newCue:function(_,y,w,L){for(var O=[],C,p,l,a,s,u=self.VTTCue||self.TextTrackCue,b=0;b<L.rows.length;b++)if(C=L.rows[b],l=!0,a=0,s="",!C.isEmpty()){for(var m=0;m<C.chars.length;m++)U.test(C.chars[m].uchar)&&l?a++:(s+=C.chars[m].uchar,l=!1);C.cueStartTime=y,y===w&&(w+=1e-4),a>=16?a--:a++;var h=Object(F.fixLineBreaks)(s.trim()),D=Object(T.generateCueId)(y,w,h);(!_||!_.cues||!_.cues.getCueById(D))&&(p=new u(y,w,h),p.id=D,p.line=b+1,p.align="left",p.position=10+Math.min(80,Math.floor(a*8/32)*10),O.push(p))}return _&&O.length&&(O.sort(function(v,c){return v.line==="auto"||c.line==="auto"?0:v.line>8&&c.line>8?c.line-v.line:v.line-c.line}),O.forEach(function(v){return Object(M.addCueToTrack)(_,v)})),O}};K.default=I},"./src/utils/discontinuities.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"findFirstFragWithCC",function(){return U}),A.d(K,"shouldAlignOnDiscontinuities",function(){return I}),A.d(K,"findDiscontinuousReferenceFrag",function(){return R}),A.d(K,"adjustSlidingStart",function(){return y}),A.d(K,"alignStream",function(){return w}),A.d(K,"alignPDT",function(){return O}),A.d(K,"alignFragmentByPDTDelta",function(){return C}),A.d(K,"alignMediaPlaylistByPDT",function(){return p});var F=A("./src/polyfills/number.ts"),T=A("./src/utils/logger.ts"),M=A("./src/controller/level-helper.ts");function U(l,a){for(var s=null,u=0,b=l.length;u<b;u++){var m=l[u];if(m&&m.cc===a){s=m;break}}return s}function I(l,a,s){return!!(a.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function R(l,a){var s=l.fragments,u=a.fragments;if(!u.length||!s.length){T.logger.log("No fragments to align");return}var b=U(s,u[0].cc);if(!b||b&&!b.startPTS){T.logger.log("No frag in previous level to align on");return}return b}function _(l,a){if(l){var s=l.start+a;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function y(l,a){for(var s=a.fragments,u=0,b=s.length;u<b;u++)_(s[u],l);a.fragmentHint&&_(a.fragmentHint,l),a.alignedSliding=!0}function w(l,a,s){if(!a)return;L(l,s,a),!s.alignedSliding&&a.details&&O(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(M.adjustSliding)(a.details,s)}function L(l,a,s){if(I(l,s,a)){var u=R(s.details,a);u&&Object(F.isFiniteNumber)(u.start)&&(T.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),y(u.start,a))}}function O(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=l.fragments[0].programDateTime,b=(u-s)/1e3+a.fragments[0].start;b&&Object(F.isFiniteNumber)(b)&&(T.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+b.toFixed(3)+" "+l.url+" "),y(b,l))}function C(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 p(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,u=a.fragments[0].start,b=s-u*1e3;l.fragments.forEach(function(m){C(m,b)}),l.fragmentHint&&C(l.fragmentHint,b),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/utils/ewma.ts"),T=function(){function M(I,R,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new F.default(I),this.fast_=new F.default(R)}var U=M.prototype;return U.update=function(R,_){var y=this.slow_,w=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new F.default(R,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new F.default(_,w.getEstimate(),w.getTotalWeight()))},U.sample=function(R,_){R=Math.max(R,this.minDelayMs_);var y=8*_,w=R/1e3,L=y/w;this.fast_.sample(w,L),this.slow_.sample(w,L)},U.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},M}();K.default=T},"./src/utils/ewma.ts":function(q,K,A){"use strict";A.r(K);var F=function(){function T(U,I,R){I===void 0&&(I=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=I,this.totalWeight_=R}var M=T.prototype;return M.sample=function(I,R){var _=Math.pow(this.alpha_,I);this.estimate_=R*(1-_)+_*this.estimate_,this.totalWeight_+=I},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},T}();K.default=F},"./src/utils/fetch-loader.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"fetchSupported",function(){return C});var F=A("./src/polyfills/number.ts"),T=A("./src/loader/load-stats.ts"),M=A("./src/demux/chunk-cache.ts");function U(u,b){u.prototype=Object.create(b.prototype),u.prototype.constructor=u,w(u,b)}function I(u){var b=typeof Map=="function"?new Map:void 0;return I=function(h){if(h===null||!y(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof b!="undefined"){if(b.has(h))return b.get(h);b.set(h,D)}function D(){return R(h,arguments,L(this).constructor)}return D.prototype=Object.create(h.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),w(D,h)},I(u)}function R(u,b,m){return _()?R=Reflect.construct:R=function(D,v,c){var f=[null];f.push.apply(f,v);var d=Function.bind.apply(D,f),o=new d;return c&&w(o,c.prototype),o},R.apply(null,arguments)}function _(){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 y(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function w(u,b){return w=Object.setPrototypeOf||function(h,D){return h.__proto__=D,h},w(u,b)}function L(u){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},L(u)}function O(){return O=Object.assign||function(u){for(var b=1;b<arguments.length;b++){var m=arguments[b];for(var h in m)Object.prototype.hasOwnProperty.call(m,h)&&(u[h]=m[h])}return u},O.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var p=function(){function u(m){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=m.fetchSetup||a,this.controller=new self.AbortController,this.stats=new T.LoadStats}var b=u.prototype;return b.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},b.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},b.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},b.load=function(h,D,v){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=l(h,this.controller.signal),o=v.onProgress,E=h.responseType==="arraybuffer",g=E?"byteLength":"length";this.context=h,this.config=D,this.callbacks=v,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),v.onTimeout(f,h,c.response)},D.timeout),self.fetch(this.request).then(function(S){if(c.response=c.loader=S,!S.ok){var P=S.status,B=S.statusText;throw new s(B||"fetch, bad network response",P,S)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(S.headers.get("Content-Length")||"0"),o&&Object(F.isFiniteNumber)(D.highWaterMark)?c.loadProgressively(S,f,h,D.highWaterMark,o):E?S.arrayBuffer():S.text()}).then(function(S){var P=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=S[g];var B={url:P.url,data:S};o&&!Object(F.isFiniteNumber)(D.highWaterMark)&&o(f,h,S,P),v.onSuccess(B,f,h,P)}).catch(function(S){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var P=S.code||0;v.onError({code:P,text:S.message},h,S.details)})},b.getCacheAge=function(){var h=null;if(this.response){var D=this.response.headers.get("age");h=D?parseFloat(D):null}return h},b.loadProgressively=function(h,D,v,c,f){c===void 0&&(c=0);var d=new M.default,o=h.body.getReader(),E=function g(){return o.read().then(function(S){if(S.done)return d.dataLength&&f(D,v,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var P=S.value,B=P.length;return D.loaded+=B,B<c||d.dataLength?(d.push(P),d.dataLength>=c&&f(D,v,d.flush(),h)):f(D,v,P,h),g()}).catch(function(){return Promise.reject()})};return E()},u}();function l(u,b){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:b,headers:new self.Headers(O({},u.headers))};return u.rangeEnd&&m.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),m}function a(u,b){return new self.Request(u.url,b)}var s=function(u){U(b,u);function b(m,h,D){var v;return v=u.call(this,m)||this,v.code=void 0,v.details=void 0,v.code=h,v.details=D,v}return b}(I(Error));K.default=p},"./src/utils/imsc1-ttml-parser.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"IMSC1_CODEC",function(){return y}),A.d(K,"parseIMSC1",function(){return C});var F=A("./src/utils/mp4-tools.ts"),T=A("./src/utils/vttparser.ts"),M=A("./src/utils/vttcue.ts"),U=A("./src/demux/id3.ts"),I=A("./src/utils/timescale-conversion.ts"),R=A("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(c[o]=d[o])}return c},_.apply(this,arguments)}var y="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,L=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,O={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(c,f,d,o,E){var g=Object(F.findBox)(new Uint8Array(c),["mdat"]);if(g.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var S=g[0],P=Object(U.utf8ArrayToStr)(new Uint8Array(c,S.start,S.end-S.start)),B=Object(I.toTimescaleFromScale)(f,1,d);try{o(p(P,B))}catch(H){E(H)}}function p(c,f){var d=new DOMParser,o=d.parseFromString(c,"text/xml"),E=o.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(g).reduce(function(j,N){return j[N]=E.getAttribute("ttp:"+N)||g[N],j},{}),P=E.getAttribute("xml:space")!=="preserve",B=a(l(E,"styling","style")),H=a(l(E,"layout","region")),Y=l(E,"body","[begin]");return[].map.call(Y,function(j){var N=s(j,P);if(!N||!j.hasAttribute("begin"))return null;var Q=h(j.getAttribute("begin"),S),ne=h(j.getAttribute("dur"),S),pe=h(j.getAttribute("end"),S);if(Q===null)throw m(j);if(pe===null){if(ne===null)throw m(j);pe=Q+ne}var xe=new M.default(Q-f,pe-f,N);xe.id=Object(R.generateCueId)(xe.startTime,xe.endTime,xe.text);var Ie=H[j.getAttribute("region")],Ae=B[j.getAttribute("style")];xe.position=10,xe.size=80;var De=u(Ie,Ae),Ce=De.textAlign;if(Ce){var Oe=O[Ce];Oe&&(xe.lineAlign=Oe),xe.align=Ce}return _(xe,De),xe}).filter(function(j){return j!==null})}function l(c,f,d){var o=c.getElementsByTagName(f)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(c){return c.reduce(function(f,d){var o=d.getAttribute("xml:id");return o&&(f[o]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,o,E){var g;return o.nodeName==="br"&&E?d+`
|
|
`:(g=o.childNodes)!==null&&g!==void 0&&g.length?s(o,f):f?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function u(c,f){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(E,g){var S=b(f,d,g)||b(c,d,g);return S&&(E[g]=S),E},{})}function b(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function m(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(T.parseTimeStamp)(c);return d===null&&(w.test(c)?d=D(c,f):L.test(c)&&(d=v(c,f))),d}function D(c,f){var d=w.exec(c),o=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/f.frameRate}function v(c,f){var d=L.exec(c),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/f.frameRate;case"t":return o/f.tickRate}return o}},"./src/utils/logger.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"enableLogs",function(){return R}),A.d(K,"logger",function(){return _});var F=function(){},T={trace:F,debug:F,log:F,warn:F,info:F,error:F},M=T;function U(y){var w=self.console[y];return w?w.bind(self.console,"["+y+"] >"):F}function I(y){for(var w=arguments.length,L=new Array(w>1?w-1:0),O=1;O<w;O++)L[O-1]=arguments[O];L.forEach(function(C){M[C]=y[C]?y[C].bind(y):U(C)})}function R(y){if(self.console&&y===!0||typeof y=="object"){I(y,"debug","log","info","warn","error");try{M.log()}catch(w){M=T}}else M=T}var _=M},"./src/utils/mediakeys-helper.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"KeySystems",function(){return F}),A.d(K,"requestMediaKeySystemAccess",function(){return T});var F;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(F||(F={}));var T=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"getMediaSource",function(){return F});function F(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"bin2str",function(){return I}),A.d(K,"readUint16",function(){return R}),A.d(K,"readUint32",function(){return _}),A.d(K,"writeUint32",function(){return y}),A.d(K,"findBox",function(){return w}),A.d(K,"parseSegmentIndex",function(){return L}),A.d(K,"parseInitSegment",function(){return O}),A.d(K,"getStartDTS",function(){return C}),A.d(K,"getDuration",function(){return p}),A.d(K,"computeRawDurationFromSamples",function(){return l}),A.d(K,"offsetStartDTS",function(){return a}),A.d(K,"segmentValidRange",function(){return s}),A.d(K,"appendUint8Array",function(){return u});var F=A("./src/utils/typed-array.ts"),T=A("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,U=[].push;function I(b){return String.fromCharCode.apply(null,b)}function R(b,m){"data"in b&&(m+=b.start,b=b.data);var h=b[m]<<8|b[m+1];return h<0?65536+h:h}function _(b,m){"data"in b&&(m+=b.start,b=b.data);var h=b[m]<<24|b[m+1]<<16|b[m+2]<<8|b[m+3];return h<0?4294967296+h:h}function y(b,m,h){"data"in b&&(m+=b.start,b=b.data),b[m]=h>>24,b[m+1]=h>>16&255,b[m+2]=h>>8&255,b[m+3]=h&255}function w(b,m){var h=[];if(!m.length)return h;var D,v,c;"data"in b?(D=b.data,v=b.start,c=b.end):(D=b,v=0,c=D.byteLength);for(var f=v;f<c;){var d=_(D,f),o=I(D.subarray(f+4,f+8)),E=d>1?f+d:c;if(o===m[0])if(m.length===1)h.push({data:D,start:f+8,end:E});else{var g=w({data:D,start:f+8,end:E},m.slice(1));g.length&&U.apply(h,g)}f=E}return h}function L(b){var m=w(b,["moov"]),h=m[0],D=h?h.end:null,v=w(b,["sidx"]);if(!v||!v[0])return null;var c=[],f=v[0],d=f.data[0],o=d===0?8:16,E=_(f,o);o+=4;var g=0,S=0;d===0?o+=8:o+=16,o+=2;var P=f.end+S,B=R(f,o);o+=2;for(var H=0;H<B;H++){var Y=o,j=_(f,Y);Y+=4;var N=j&2147483647,Q=(j&2147483648)>>>31;if(Q===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=_(f,Y);Y+=4,c.push({referenceSize:N,subsegmentDuration:ne,info:{duration:ne/E,start:P,end:P+N-1}}),P+=N,Y+=4,o=Y}return{earliestPresentationTime:g,timescale:E,version:d,referencesCount:B,references:c,moovEndOffset:D}}function O(b){for(var m=[],h=w(b,["moov","trak"]),D=0;D<h.length;D++){var v=h[D],c=w(v,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,o=_(c,d),E=w(v,["mdia","mdhd"])[0];if(E){f=E.data[E.start],d=f===0?12:20;var g=_(E,d),S=w(v,["mdia","hdlr"])[0];if(S){var P=I(S.data.subarray(S.start+8,S.start+12)),B={soun:T.ElementaryStreamTypes.AUDIO,vide:T.ElementaryStreamTypes.VIDEO}[P];if(B){var H=w(v,["mdia","minf","stbl","stsd"])[0],Y=void 0;H&&(Y=I(H.data.subarray(H.start+12,H.start+16))),m[o]={timescale:g,type:B},m[B]={timescale:g,id:o,codec:Y}}}}}}var j=w(b,["moov","mvex","trex"]);return j.forEach(function(N){var Q=_(N,4),ne=m[Q];ne&&(ne.default={duration:_(N,12),flags:_(N,20)})}),m}function C(b,m){return w(m,["moof","traf"]).reduce(function(h,D){var v=w(D,["tfdt"])[0],c=v.data[v.start],f=w(D,["tfhd"]).reduce(function(d,o){var E=_(o,4),g=b[E];if(g){var S=_(v,4);c===1&&(S*=Math.pow(2,32),S+=_(v,8));var P=g.timescale||9e4,B=S/P;if(isFinite(B)&&(d===null||B<d))return B}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function p(b,m){for(var h=0,D=0,v=0,c=w(b,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],o=w(d,["tfhd"])[0],E=_(o,4),g=m[E];if(!g)continue;var S=g.default,P=_(o,0)|(S==null?void 0:S.flags),B=S==null?void 0:S.duration;P&8&&(P&2?B=_(o,12):B=_(o,8));for(var H=g.timescale||9e4,Y=w(d,["trun"]),j=0;j<Y.length;j++){if(B){var N=_(Y[j],4);h=B*N}else h=l(Y[j]);g.type===T.ElementaryStreamTypes.VIDEO?D+=h/H:g.type===T.ElementaryStreamTypes.AUDIO&&(v+=h/H)}}if(D===0&&v===0){var Q=L(b);if(Q!=null&&Q.references)return Q.references.reduce(function(ne,pe){return ne+pe.info.duration||0},0)}return D||v}function l(b){var m=_(b,0),h=8;m&1&&(h+=4),m&4&&(h+=4);for(var D=0,v=_(b,4),c=0;c<v;c++){if(m&256){var f=_(b,h);D+=f,h+=4}m&512&&(h+=4),m&1024&&(h+=4),m&2048&&(h+=4)}return D}function a(b,m,h){w(m,["moof","traf"]).forEach(function(D){w(D,["tfhd"]).forEach(function(v){var c=_(v,4),f=b[c];if(!f)return;var d=f.timescale||9e4;w(D,["tfdt"]).forEach(function(o){var E=o.data[o.start],g=_(o,4);if(E===0)y(o,4,g-h*d);else{g*=Math.pow(2,32),g+=_(o,8),g-=h*d,g=Math.max(g,0);var S=Math.floor(g/(M+1)),P=Math.floor(g%(M+1));y(o,4,S),y(o,8,P)}})})})}function s(b){var m={valid:null,remainder:null},h=w(b,["moof"]);if(h){if(h.length<2)return m.remainder=b,m}else return m;var D=h[h.length-1];return m.valid=Object(F.sliceUint8)(b,0,D.start-8),m.remainder=Object(F.sliceUint8)(b,D.start-8),m}function u(b,m){var h=new Uint8Array(b.length+m.length);return h.set(b),h.set(m,b.length),h}},"./src/utils/output-filter.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"default",function(){return F});var F=function(){function T(U,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=U,this.trackName=I}var M=T.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(I,R,_){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=R,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},T}()},"./src/utils/texttrack-utils.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"sendAddTrackEvent",function(){return T}),A.d(K,"addCueToTrack",function(){return M}),A.d(K,"clearCurrentCues",function(){return U}),A.d(K,"removeCuesInRange",function(){return I}),A.d(K,"getCuesInRange",function(){return _});var F=A("./src/utils/logger.ts");function T(y,w){var L;try{L=new Event("addtrack")}catch(O){L=document.createEvent("Event"),L.initEvent("addtrack",!1,!1)}L.track=y,w.dispatchEvent(L)}function M(y,w){var L=y.mode;if(L==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(w.id))try{if(y.addCue(w),!y.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(C){F.logger.debug("[texttrack-utils]: "+C);var O=new self.TextTrackCue(w.startTime,w.endTime,w.text);O.id=w.id,y.addCue(O)}L==="disabled"&&(y.mode=L)}function U(y){var w=y.mode;if(w==="disabled"&&(y.mode="hidden"),y.cues)for(var L=y.cues.length;L--;)y.removeCue(y.cues[L]);w==="disabled"&&(y.mode=w)}function I(y,w,L){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var C=_(y.cues,w,L),p=0;p<C.length;p++)y.removeCue(C[p]);O==="disabled"&&(y.mode=O)}function R(y,w){if(w<y[0].startTime)return 0;var L=y.length-1;if(w>y[L].endTime)return-1;for(var O=0,C=L;O<=C;){var p=Math.floor((C+O)/2);if(w<y[p].startTime)C=p-1;else if(w>y[p].startTime&&O<L)O=p+1;else return p}return y[O].startTime-w<w-y[C].startTime?O:C}function _(y,w,L){var O=[],C=R(y,w);if(C>-1)for(var p=C,l=y.length;p<l;p++){var a=y[p];if(a.startTime>=w&&a.endTime<=L)O.push(a);else if(a.startTime>L)return O}return O}},"./src/utils/time-ranges.ts":function(q,K,A){"use strict";A.r(K);var F={toString:function(M){for(var U="",I=M.length,R=0;R<I;R++)U+="["+M.start(R).toFixed(3)+","+M.end(R).toFixed(3)+"]";return U}};K.default=F},"./src/utils/timescale-conversion.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"toTimescaleFromBase",function(){return T}),A.d(K,"toTimescaleFromScale",function(){return M}),A.d(K,"toMsFromMpegTsClock",function(){return U}),A.d(K,"toMpegTsClockFromTimescale",function(){return I});var F=9e4;function T(R,_,y,w){y===void 0&&(y=1),w===void 0&&(w=!1);var L=R*_*y;return w?Math.round(L):L}function M(R,_,y,w){return y===void 0&&(y=1),w===void 0&&(w=!1),T(R,_,1/y,w)}function U(R,_){return _===void 0&&(_=!1),T(R,1e3,1/F,_)}function I(R,_){return _===void 0&&(_=1),T(R,F,1/_)}},"./src/utils/typed-array.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"sliceUint8",function(){return F});function F(T,M,U){return Uint8Array.prototype.slice?T.slice(M,U):new Uint8Array(Array.prototype.slice.call(T,M,U))}},"./src/utils/vttcue.ts":function(q,K,A){"use strict";A.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var F=["","lr","rl"],T=["start","middle","end","left","right"];function M(y,w){if(typeof w!="string")return!1;if(!Array.isArray(y))return!1;var L=w.toLowerCase();return~y.indexOf(L)?L:!1}function U(y){return M(F,y)}function I(y){return M(T,y)}function R(y){for(var w=arguments.length,L=new Array(w>1?w-1:0),O=1;O<w;O++)L[O-1]=arguments[O];for(var C=1;C<arguments.length;C++){var p=arguments[C];for(var l in p)y[l]=p[l]}return y}function _(y,w,L){var O=this,C={enumerable:!0};O.hasBeenReset=!1;var p="",l=!1,a=y,s=w,u=L,b=null,m="",h=!0,D="auto",v="start",c=50,f="middle",d=50,o="middle";Object.defineProperty(O,"id",R({},C,{get:function(){return p},set:function(g){p=""+g}})),Object.defineProperty(O,"pauseOnExit",R({},C,{get:function(){return l},set:function(g){l=!!g}})),Object.defineProperty(O,"startTime",R({},C,{get:function(){return a},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");a=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"endTime",R({},C,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"text",R({},C,{get:function(){return u},set:function(g){u=""+g,this.hasBeenReset=!0}})),Object.defineProperty(O,"region",R({},C,{get:function(){return b},set:function(g){b=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"vertical",R({},C,{get:function(){return m},set:function(g){var S=U(g);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"snapToLines",R({},C,{get:function(){return h},set:function(g){h=!!g,this.hasBeenReset=!0}})),Object.defineProperty(O,"line",R({},C,{get:function(){return D},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"lineAlign",R({},C,{get:function(){return v},set:function(g){var S=I(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");v=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"position",R({},C,{get:function(){return c},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");c=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"positionAlign",R({},C,{get:function(){return f},set:function(g){var S=I(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");f=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"size",R({},C,{get:function(){return d},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(O,"align",R({},C,{get:function(){return o},set:function(g){var S=I(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");o=S,this.hasBeenReset=!0}})),O.displayState=void 0}return _.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"parseTimeStamp",function(){return M}),A.d(K,"fixLineBreaks",function(){return w}),A.d(K,"VTTParser",function(){return L});var F=A("./src/utils/vttcue.ts"),T=function(){function O(){}var C=O.prototype;return C.decode=function(l,a){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},O}();function M(O){function C(l,a,s,u){return(l|0)*3600+(a|0)*60+(s|0)+parseFloat(u||0)}var p=O.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?C(p[2],p[3],0,p[4]):C(p[1],p[2],p[3],p[4]):null}var U=function(){function O(){this.values=Object.create(null)}var C=O.prototype;return C.set=function(l,a){!this.get(l)&&a!==""&&(this.values[l]=a)},C.get=function(l,a,s){return s?this.has(l)?this.values[l]:a[s]:this.has(l)?this.values[l]:a},C.has=function(l){return l in this.values},C.alt=function(l,a,s){for(var u=0;u<s.length;++u)if(a===s[u]){this.set(l,a);break}},C.integer=function(l,a){/^-?\d+$/.test(a)&&this.set(l,parseInt(a,10))},C.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},O}();function I(O,C,p,l){var a=l?O.split(l):[O];for(var s in a){if(typeof a[s]!="string")continue;var u=a[s].split(p);if(u.length!==2)continue;var b=u[0],m=u[1];C(b,m)}}var R=new F.default(0,0,""),_=R.align==="middle"?"middle":"center";function y(O,C,p){var l=O;function a(){var b=M(O);if(b===null)throw new Error("Malformed timestamp: "+l);return O=O.replace(/^[^\sa-zA-Z-]+/,""),b}function s(b,m){var h=new U;I(b,function(c,f){var d;switch(c){case"region":for(var o=p.length-1;o>=0;o--)if(p[o].id===f){h.set(c,p[o].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",_,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",_,"end","left","right"]);break}},/:/,/\s/),m.region=h.get("region",null),m.vertical=h.get("vertical","");var D=h.get("line","auto");D==="auto"&&R.line===-1&&(D=-1),m.line=D,m.lineAlign=h.get("lineAlign","start"),m.snapToLines=h.get("snapToLines",!0),m.size=h.get("size",100),m.align=h.get("align",_);var v=h.get("position","auto");v==="auto"&&R.position===50&&(v=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=v}function u(){O=O.replace(/^\s+/,"")}if(u(),C.startTime=a(),u(),O.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);O=O.substr(3),u(),C.endTime=a(),u(),s(O,C)}function w(O){return O.replace(/<br(?: \/)?>/gi,`
|
|
`)}var L=function(){function O(){this.state="INITIAL",this.buffer="",this.decoder=new T,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var C=O.prototype;return C.parse=function(l){var a=this;l&&(a.buffer+=a.decoder.decode(l,{stream:!0}));function s(){var v=a.buffer,c=0;for(v=w(v);c<v.length&&v[c]!=="\r"&&v[c]!==`
|
|
`;)++c;var f=v.substr(0,c);return v[c]==="\r"&&++c,v[c]===`
|
|
`&&++c,a.buffer=v.substr(c),f}function u(v){I(v,function(c,f){},/:/)}try{var b="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;b=s();var m=b.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var h=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;h?h=!1:b=s();switch(a.state){case"HEADER":/:/.test(b)?u(b):b||(a.state="ID");continue;case"NOTE":b||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(b)){a.state="NOTE";break}if(!b)continue;if(a.cue=new F.default(0,0,""),a.state="CUE",b.indexOf("-->")===-1){a.cue.id=b;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{y(b,a.cue,a.regionList)}catch(v){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=b.indexOf("-->")!==-1;if(!b||D&&(h=!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+=b}continue;case"BADCUE":b||(a.state="ID")}}}catch(v){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.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},O}()},"./src/utils/webvtt-parser.ts":function(q,K,A){"use strict";A.r(K),A.d(K,"generateCueId",function(){return L}),A.d(K,"parseWebVTT",function(){return C});var F=A("./src/polyfills/number.ts"),T=A("./src/utils/vttparser.ts"),M=A("./src/demux/id3.ts"),U=A("./src/utils/timescale-conversion.ts"),I=A("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,_=function(l,a,s){return s===void 0&&(s=0),l.substr(s,a.length)===a},y=function(l){var a=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),u=parseInt(l.substr(-9,2)),b=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(F.isFiniteNumber)(a)||!Object(F.isFiniteNumber)(s)||!Object(F.isFiniteNumber)(u)||!Object(F.isFiniteNumber)(b))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return a+=1e3*s,a+=60*1e3*u,a+=60*60*1e3*b,a},w=function(l){for(var a=5381,s=l.length;s;)a=a*33^l.charCodeAt(--s);return(a>>>0).toString()};function L(p,l,a){return w(p.toString())+w(l.toString())+w(a)}var O=function(l,a,s){var u=l[a],b=l[u.prevCC];if(!b||!b.new&&u.new){l.ccOffset=l.presentationOffset=u.start,u.new=!1;return}for(;(m=b)!==null&&m!==void 0&&m.new;){var m;l.ccOffset+=u.start-b.start,u.new=!1,u=b,b=l[u.prevCC]}l.presentationOffset=s};function C(p,l,a,s,u,b,m,h){var D=new T.VTTParser,v=Object(M.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(R,`
|
|
`).split(`
|
|
`),c=[],f=Object(U.toMpegTsClockFromTimescale)(l,a),d="00:00.000",o=0,E=0,g,S=!0,P=!1;D.oncue=function(B){var H=s[u],Y=s.ccOffset,j=(o-f)/9e4;if(H!=null&&H.new&&(E!==void 0?Y=s.ccOffset=H.start:O(s,u,j)),j&&(Y=j-s.presentationOffset),P){var N=B.endTime-B.startTime,Q=Object(I.normalizePts)((B.startTime+Y-E)*9e4,b*9e4)/9e4;B.startTime=Q,B.endTime=Q+N}var ne=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(ne)),B.id||(B.id=L(B.startTime,B.endTime,ne)),B.endTime>0&&c.push(B)},D.onparsingerror=function(B){g=B},D.onflush=function(){if(g){h(g);return}m(c)},v.forEach(function(B){if(S)if(_(B,"X-TIMESTAMP-MAP=")){S=!1,P=!0,B.substr(16).split(",").forEach(function(H){_(H,"LOCAL:")?d=H.substr(6):_(H,"MPEGTS:")&&(o=parseInt(H.substr(7)))});try{E=y(d)/1e3}catch(H){P=!1,g=H}return}else B===""&&(S=!1);D.parse(B+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(q,K,A){"use strict";A.r(K);var F=A("./src/utils/logger.ts"),T=A("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,U=function(){function I(_){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=_?_.xhrSetup:null,this.stats=new T.LoadStats,this.retryDelay=0}var R=I.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},R.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(y,w,L){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=w,this.callbacks=L,this.retryDelay=w.retryDelay,this.loadInternal()},R.loadInternal=function(){var y=this.config,w=this.context;if(!y)return;var L=this.loader=new self.XMLHttpRequest,O=this.stats;O.loading.first=0,O.loaded=0;var C=this.xhrSetup;try{if(C)try{C(L,w.url)}catch(a){L.open("GET",w.url,!0),C(L,w.url)}L.readyState||L.open("GET",w.url,!0);var p=this.context.headers;if(p)for(var l in p)L.setRequestHeader(l,p[l])}catch(a){this.callbacks.onError({code:L.status,text:a.message},w,L);return}w.rangeEnd&&L.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),L.onreadystatechange=this.readystatechange.bind(this),L.onprogress=this.loadprogress.bind(this),L.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),L.send()},R.readystatechange=function(){var y=this.context,w=this.loader,L=this.stats;if(!y||!w)return;var O=w.readyState,C=this.config;if(L.aborted)return;if(O>=2)if(self.clearTimeout(this.requestTimeout),L.loading.first===0&&(L.loading.first=Math.max(self.performance.now(),L.loading.start)),O===4){w.onreadystatechange=null,w.onprogress=null;var p=w.status;if(p>=200&&p<300){L.loading.end=Math.max(self.performance.now(),L.loading.first);var l,a;if(y.responseType==="arraybuffer"?(l=w.response,a=l.byteLength):(l=w.responseText,a=l.length),L.loaded=L.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(L,y,l,w),!this.callbacks)return;var u={url:w.responseURL,data:l};this.callbacks.onSuccess(u,L,y,w)}else L.retry>=C.maxRetry||p>=400&&p<499?(F.logger.error(p+" while loading "+y.url),this.callbacks.onError({code:p,text:w.statusText},y,w)):(F.logger.warn(p+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,C.maxRetryDelay),L.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},R.loadtimeout=function(){F.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(y){var w=this.stats;w.loaded=y.loaded,y.lengthComputable&&(w.total=y.total)},R.getCacheAge=function(){var y=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");y=w?parseFloat(w):null}return y},I}();K.default=U}}).default})},vHTk:function(Dt,at,Z){Dt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|