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
766 KiB
133 lines
766 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[198,7,8],{"+NIl":function(yt,it,Q){(function(q){q(Q("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(G,A){"use strict";function H(S,w){S.cmdState.push(w)}function M(S){return S.cmdState.length>0?S.cmdState[S.cmdState.length-1]:null}function P(S){var w=S.cmdState.pop();w&&w.closeBracket()}function F(S){for(var w=S.cmdState,T=w.length-1;T>=0;T--){var c=w[T];if(c.name=="DEFAULT")continue;return c}return{styleIdentifier:function(){return null}}}function I(S,w,T){return function(){this.name=S,this.bracketNo=0,this.style=w,this.styles=T,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(S,w){S.f=w}function b(S,w){var T;if(S.match(/^\\[a-zA-Z@]+/)){var c=S.current().slice(1);return T=R.hasOwnProperty(c)?R[c]:R.DEFAULT,T=new T,H(w,T),O(w,L),T.style}if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/\\]/))return"tag";if(S.match("\\["))return O(w,function(d,u){return C(d,u,"\\]")}),"keyword";if(S.match("\\("))return O(w,function(d,u){return C(d,u,"\\)")}),"keyword";if(S.match("$$"))return O(w,function(d,u){return C(d,u,"$$")}),"keyword";if(S.match("$"))return O(w,function(d,u){return C(d,u,"$")}),"keyword";var o=S.next();if(o=="%")return S.skipToEnd(),"comment";if(o=="}"||o=="]"){if(T=M(w),T)T.closeBracket(o),O(w,L);else return"error";return"bracket"}else return o=="{"||o=="["?(T=R.DEFAULT,T=new T,H(w,T),"bracket"):/\d/.test(o)?(S.eatWhile(/[\w.%]/),"atom"):(S.eatWhile(/[\w\-_]/),T=F(w),T.name=="begin"&&(T.argument=S.current()),T.styleIdentifier())}function C(S,w,T){if(S.eatSpace())return null;if(T&&S.match(T))return O(w,b),"keyword";if(S.match(/^\\[a-zA-Z@]+/))return"tag";if(S.match(/^[a-zA-Z]+/))return"variable-2";if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/]/))return"tag";if(S.match(/^[\^_&]/))return"tag";if(S.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(S.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var c=S.next();return c=="{"||c=="}"||c=="["||c=="]"||c=="("||c==")"?"bracket":c=="%"?(S.skipToEnd(),"comment"):"error"}function L(S,w){var T=S.peek(),c;return T=="{"||T=="["?(c=M(w),c.openBracket(T),S.eat(T),O(w,b),"bracket"):/[ \t\r]/.test(T)?(S.eat(T),null):(O(w,b),P(w),b(S,w))}return{startState:function(){var S=A.inMathMode?function(w,T){return C(w,T)}:b;return{cmdState:[],f:S}},copyState:function(S){return{cmdState:S.cmdState.slice(),f:S.f}},token:function(S,w){return w.f(S,w)},blankLine:function(S){S.f=b,S.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+yhJ":function(yt,it,Q){yt.exports=Q.p+"static/xixi.d492fb65.svg"},"0eGx":function(yt,it,Q){yt.exports=Q.p+"static/zhong.c1924b73.svg"},"19Vz":function(yt,it,Q){(function(q){q(Q("VrN/"))})(function(q){q.defineOption("placeholder","",function(I,R,O){var b=O&&O!=q.Init;if(R&&!b)I.on("blur",M),I.on("change",P),I.on("swapDoc",P),q.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){H(I)}),P(I);else if(!R&&b){I.off("blur",M),I.off("change",P),I.off("swapDoc",P),q.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),G(I);var C=I.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}R&&!I.hasFocus()&&M(I)});function G(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function A(I){G(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 O=I.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),R.appendChild(O),I.display.lineSpace.insertBefore(R,I.display.lineSpace.firstChild)}function H(I){setTimeout(function(){var R=!1,O=I.getInputField();O.nodeName=="TEXTAREA"?R=!O.value:I.lineCount()==1&&(R=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),R?A(I):G(I)},20)}function M(I){F(I)&&A(I)}function P(I){var R=I.getWrapperElement(),O=F(I);R.className=R.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?A(I):G(I)}function F(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(yt,it,Q){(function(q){q(Q("VrN/"))})(function(q){"use strict";var G={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(H,M){var P=H.indentUnit,F={},I=M.htmlMode?G:A;for(var R in I)F[R]=I[R];for(var R in M)F[R]=M[R];var O,b;function C(a,v){function p(N){return v.tokenize=N,N(a,v)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(w("atom","]]>")):null:a.match("--")?p(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(T(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=w("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",v.tokenize=L,"tag bracket");if(E=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}C.isInText=!0;function L(a,v){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return v.tokenize=C,O=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return O="equals",null;if(p=="<"){v.tokenize=C,v.state=u,v.tagName=v.tagStart=null;var E=v.tokenize(a,v);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(p)?(v.tokenize=S(p),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function S(a){var v=function(p,E){for(;!p.eol();)if(p.next()==a){E.tokenize=L;break}return"string"};return v.isInAttribute=!0,v}function w(a,v){return function(p,E){for(;!p.eol();){if(p.match(v)){E.tokenize=C;break}p.next()}return a}}function T(a){return function(v,p){for(var E;(E=v.next())!=null;){if(E=="<")return p.tokenize=T(a+1),p.tokenize(v,p);if(E==">")if(a==1){p.tokenize=C;break}else return p.tokenize=T(a-1),p.tokenize(v,p)}return"meta"}}function c(a,v,p){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=p,(F.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function d(a,v){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!F.contextGrabbers.hasOwnProperty(p)||!F.contextGrabbers[p].hasOwnProperty(v))return;o(a)}}function u(a,v,p){return a=="openTag"?(p.tagStart=v.column(),x):a=="closeTag"?g:u}function x(a,v,p){return a=="word"?(p.tagName=v.current(),b="tag",y):F.allowMissingTagName&&a=="endTag"?(b="tag bracket",y(a,v,p)):(b="error",x)}function g(a,v,p){if(a=="word"){var E=v.current();return p.context&&p.context.tagName!=E&&F.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==E||F.matchClosing===!1?(b="tag",m):(b="tag error",l)}else return F.allowMissingTagName&&a=="endTag"?(b="tag bracket",m(a,v,p)):(b="error",l)}function m(a,v,p){return a!="endTag"?(b="error",m):(o(p),u)}function l(a,v,p){return b="error",m(a,v,p)}function y(a,v,p){if(a=="word")return b="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var E=p.tagName,D=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(E)?d(p,E):(d(p,E),p.context=new c(p,E,D==p.indented)),u}return b="error",y}function f(a,v,p){return a=="equals"?h:(F.allowMissing||(b="error"),y(a,v,p))}function h(a,v,p){return a=="string"?s:a=="word"&&F.allowUnquoted?(b="string",y):(b="error",y(a,v,p))}function s(a,v,p){return a=="string"?s:y(a,v,p)}return{startState:function(a){var v={tokenize:C,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;O=null;var p=v.tokenize(a,v);return(p||O)&&p!="comment"&&(b=null,v.state=v.state(O||p,a,v),b&&(p=b=="error"?p+" error":b)),p},indent:function(a,v,p){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(E&&E.noIndent)return q.Pass;if(a.tokenize!=L&&a.tokenize!=C)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return F.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var D=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(D&&D[1])for(;E;)if(E.tagName==D[2]){E=E.prev;break}else if(F.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(D)for(;E;){var N=F.contextGrabbers[E.tagName];if(N&&N.hasOwnProperty(D[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(a){a.state==h&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],p=a.context;p;p=p.prev)p.tagName&&v.push(p.tagName);return v.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(yt,it,Q){"use strict";Q.d(it,"a",function(){return m});var q=Q("wx14"),G=Q("rePB"),A=Q("VTBJ"),H=Q("1OyB"),M=Q("vuIU"),P=Q("Ji7U"),F=Q("LK+K"),I=Q("cDcd"),R=Q.n(I),O=Q("TSYQ"),b=Q.n(O),C=function(y){var f,h="".concat(y.rootPrefixCls,"-item"),s=b()(h,"".concat(h,"-").concat(y.page),(f={},Object(G.a)(f,"".concat(h,"-active"),y.active),Object(G.a)(f,y.className,!!y.className),Object(G.a)(f,"".concat(h,"-disabled"),!y.page),f)),a=function(){y.onClick(y.page)},v=function(E){y.onKeyPress(E,y.onClick,y.page)};return R.a.createElement("li",{title:y.showTitle?y.page:null,className:s,onClick:a,onKeyPress:v,tabIndex:"0"},y.itemRender(y.page,"page",R.a.createElement("a",{rel:"nofollow"},y.page)))},L=C,S={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},w=function(l){Object(P.a)(f,l);var y=Object(F.a)(f);function f(){var h;Object(H.a)(this,f);for(var s=arguments.length,a=new Array(s),v=0;v<s;v++)a[v]=arguments[v];return h=y.call.apply(y,[this].concat(a)),h.state={goInputText:""},h.buildOptionText=function(p){return"".concat(p," ").concat(h.props.locale.items_per_page)},h.changeSize=function(p){h.props.changeSize(Number(p))},h.handleChange=function(p){h.setState({goInputText:p.target.value})},h.handleBlur=function(p){var E=h.props,D=E.goButton,N=E.quickGo,W=E.rootPrefixCls,z=h.state.goInputText;if(D||z==="")return;if(p.relatedTarget&&(p.relatedTarget.className.indexOf("".concat(W,"-prev"))>=0||p.relatedTarget.className.indexOf("".concat(W,"-next"))>=0))return;h.setState({goInputText:""}),N(h.getValidValue())},h.go=function(p){var E=h.state.goInputText;if(E==="")return;(p.keyCode===S.ENTER||p.type==="click")&&(h.setState({goInputText:""}),h.props.quickGo(h.getValidValue()))},h}return Object(M.a)(f,[{key:"getValidValue",value:function(){var s=this.state,a=s.goInputText,v=s.current;return!a||isNaN(a)?v:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,v=s.pageSizeOptions;return v.some(function(p){return p.toString()===a.toString()})?v:v.concat([a.toString()]).sort(function(p,E){var D=isNaN(Number(p))?0:Number(p),N=isNaN(Number(E))?0:Number(E);return D-N})}},{key:"render",value:function(){var s=this,a=this.props,v=a.pageSize,p=a.locale,E=a.rootPrefixCls,D=a.changeSize,N=a.quickGo,W=a.goButton,z=a.selectComponentClass,B=a.buildOptionText,U=a.selectPrefixCls,X=a.disabled,ne=this.state.goInputText,le="".concat(E,"-options"),de=z,we=null,ge=null,ve=null;if(!D&&!N)return null;var he=this.getPageSizeOptions();if(D&&de){var fe=he.map(function(oe,Z){return R.a.createElement(de.Option,{key:Z,value:oe.toString()},(B||s.buildOptionText)(oe))});we=R.a.createElement(de,{disabled:X,prefixCls:U,showSearch:!1,className:"".concat(le,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(v||he[0]).toString(),onChange:this.changeSize,getPopupContainer:function(Z){return Z.parentNode}},fe)}return N&&(W&&(ve=typeof W=="boolean"?R.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:X,className:"".concat(le,"-quick-jumper-button")},p.jump_to_confirm):R.a.createElement("span",{onClick:this.go,onKeyUp:this.go},W)),ge=R.a.createElement("div",{className:"".concat(le,"-quick-jumper")},p.jump_to,R.a.createElement("input",{disabled:X,type:"text",value:ne,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),p.page,ve)),R.a.createElement("li",{className:"".concat(le)},we,ge)}}]),f}(R.a.Component);w.defaultProps={pageSizeOptions:["10","20","50","100"]};var T=w,c=Q("N2Kk");function o(){}function d(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}function u(l,y,f){return f}function x(l,y,f){var h=typeof l=="undefined"?y.pageSize:l;return Math.floor((f.total-1)/h)+1}var g=function(l){Object(P.a)(f,l);var y=Object(F.a)(f);function f(h){var s;Object(H.a)(this,f),s=y.call(this,h),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(x(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(D,N){var W=s.props.prefixCls,z=D||R.a.createElement("button",{type:"button","aria-label":N,className:"".concat(W,"-item-link")});return typeof D=="function"&&(z=R.a.createElement(D,Object(A.a)({},s.props))),z},s.savePaginationNode=function(D){s.paginationNode=D},s.isValid=function(D){return d(D)&&D!==s.state.current},s.shouldDisplayQuickJumper=function(){var D=s.props,N=D.showQuickJumper,W=D.pageSize,z=D.total;return z<=W?!1:N},s.handleKeyDown=function(D){(D.keyCode===S.ARROW_UP||D.keyCode===S.ARROW_DOWN)&&D.preventDefault()},s.handleKeyUp=function(D){var N=s.getValidValue(D),W=s.state.currentInputValue;N!==W&&s.setState({currentInputValue:N}),D.keyCode===S.ENTER?s.handleChange(N):D.keyCode===S.ARROW_UP?s.handleChange(N-1):D.keyCode===S.ARROW_DOWN&&s.handleChange(N+1)},s.changePageSize=function(D){var N=s.state.current,W=x(D,s.state,s.props);N=N>W?W:N,W===0&&(N=s.state.current),typeof D=="number"&&("pageSize"in s.props||s.setState({pageSize:D}),"current"in s.props||s.setState({current:N,currentInputValue:N})),s.props.onShowSizeChange(N,D),"onChange"in s.props&&s.props.onChange&&s.props.onChange(N,D)},s.handleChange=function(D){var N=s.props.disabled,W=D;if(s.isValid(W)&&!N){var z=x(void 0,s.state,s.props);W>z?W=z:W<1&&(W=1),"current"in s.props||s.setState({current:W,currentInputValue:W});var B=s.state.pageSize;return s.props.onChange(W,B),W}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current<x(void 0,s.state,s.props)},s.runIfEnter=function(D,N){if(D.key==="Enter"||D.charCode===13){for(var W=arguments.length,z=new Array(W>2?W-2:0),B=2;B<W;B++)z[B-2]=arguments[B];N.apply(void 0,z)}},s.runIfEnterPrev=function(D){s.runIfEnter(D,s.prev)},s.runIfEnterNext=function(D){s.runIfEnter(D,s.next)},s.runIfEnterJumpPrev=function(D){s.runIfEnter(D,s.jumpPrev)},s.runIfEnterJumpNext=function(D){s.runIfEnter(D,s.jumpNext)},s.handleGoTO=function(D){(D.keyCode===S.ENTER||D.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=h.onChange!==o,v="current"in h;v&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var p=h.defaultCurrent;"current"in h&&(p=h.current);var E=h.defaultPageSize;return"pageSize"in h&&(E=h.pageSize),p=Math.min(p,x(E,void 0,h)),s.state={current:p,currentInputValue:p,pageSize:E},s}return Object(M.a)(f,[{key:"componentDidUpdate",value:function(s,a){var v=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var p=this.paginationNode.querySelector(".".concat(v,"-item-").concat(a.current));p&&document.activeElement===p&&p.blur()}}},{key:"getValidValue",value:function(s){var a=s.target.value,v=x(void 0,this.state,this.props),p=this.state.currentInputValue,E;return a===""?E=a:isNaN(Number(a))?E=p:a>=v?E=v:E=Number(a),E}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,v=s.total,p=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:v>p}},{key:"renderPrev",value:function(s){var a=this.props,v=a.prevIcon,p=a.itemRender,E=p(s,"prev",this.getItemIcon(v,"prev page")),D=!this.hasPrev();return Object(I.isValidElement)(E)?Object(I.cloneElement)(E,{disabled:D}):E}},{key:"renderNext",value:function(s){var a=this.props,v=a.nextIcon,p=a.itemRender,E=p(s,"next",this.getItemIcon(v,"next page")),D=!this.hasNext();return Object(I.isValidElement)(E)?Object(I.cloneElement)(E,{disabled:D}):E}},{key:"render",value:function(){var s=this,a=this.props,v=a.prefixCls,p=a.className,E=a.style,D=a.disabled,N=a.hideOnSinglePage,W=a.total,z=a.locale,B=a.showQuickJumper,U=a.showLessItems,X=a.showTitle,ne=a.showTotal,le=a.simple,de=a.itemRender,we=a.showPrevNextJumpers,ge=a.jumpPrevIcon,ve=a.jumpNextIcon,he=a.selectComponentClass,fe=a.selectPrefixCls,oe=a.pageSizeOptions,Z=this.state,Ee=Z.current,Be=Z.pageSize,Ne=Z.currentInputValue;if(N===!0&&W<=Be)return null;var He=x(void 0,this.state,this.props),ze=[],Ae=null,Ce=null,Me=null,Ue=null,Ie=null,De=B&&B.goButton,Te=U?1:2,rt=Ee-1>0?Ee-1:0,Qe=Ee+1<He?Ee+1:He,Ve=Object.keys(this.props).reduce(function(Y,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(Y[$]=s.props[$]),Y},{});if(le)return De&&(typeof De=="boolean"?Ie=R.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},z.jump_to_confirm):Ie=R.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},De),Ie=R.a.createElement("li",{title:X?"".concat(z.jump_to).concat(Ee,"/").concat(He):null,className:"".concat(v,"-simple-pager")},Ie)),R.a.createElement("ul",Object(q.a)({className:b()(v,"".concat(v,"-simple"),Object(G.a)({},"".concat(v,"-disabled"),D),p),style:E,ref:this.savePaginationNode},Ve),R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:b()("".concat(v,"-prev"),Object(G.a)({},"".concat(v,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(rt)),R.a.createElement("li",{title:X?"".concat(Ee,"/").concat(He):null,className:"".concat(v,"-simple-pager")},R.a.createElement("input",{type:"text",value:Ne,disabled:D,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),R.a.createElement("span",{className:"".concat(v,"-slash")},"/"),He),R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:b()("".concat(v,"-next"),Object(G.a)({},"".concat(v,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Qe)),Ie);if(He<=3+Te*2){var Xe={locale:z,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:X,itemRender:de};He||ze.push(R.a.createElement(L,Object(q.a)({},Xe,{key:"noPager",page:He,className:"".concat(v,"-disabled")})));for(var ut=1;ut<=He;ut+=1){var tt=Ee===ut;ze.push(R.a.createElement(L,Object(q.a)({},Xe,{key:ut,page:ut,active:tt})))}}else{var qe=U?z.prev_3:z.prev_5,be=U?z.next_3:z.next_5;we&&(Ae=R.a.createElement("li",{title:X?qe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:b()("".concat(v,"-jump-prev"),Object(G.a)({},"".concat(v,"-jump-prev-custom-icon"),!!ge))},de(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(ge,"prev page"))),Ce=R.a.createElement("li",{title:X?be:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:b()("".concat(v,"-jump-next"),Object(G.a)({},"".concat(v,"-jump-next-custom-icon"),!!ve))},de(this.getJumpNextPage(),"jump-next",this.getItemIcon(ve,"next page")))),Ue=R.a.createElement(L,{locale:z,last:!0,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:He,page:He,active:!1,showTitle:X,itemRender:de}),Me=R.a.createElement(L,{locale:z,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:X,itemRender:de});var nt=Math.max(1,Ee-Te),Ye=Math.min(Ee+Te,He);Ee-1<=Te&&(Ye=1+Te*2),He-Ee<=Te&&(nt=He-Te*2);for(var xe=nt;xe<=Ye;xe+=1){var Re=Ee===xe;ze.push(R.a.createElement(L,{locale:z,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:xe,page:xe,active:Re,showTitle:X,itemRender:de}))}Ee-1>=Te*2&&Ee!==1+2&&(ze[0]=Object(I.cloneElement)(ze[0],{className:"".concat(v,"-item-after-jump-prev")}),ze.unshift(Ae)),He-Ee>=Te*2&&Ee!==He-2&&(ze[ze.length-1]=Object(I.cloneElement)(ze[ze.length-1],{className:"".concat(v,"-item-before-jump-next")}),ze.push(Ce)),nt!==1&&ze.unshift(Me),Ye!==He&&ze.push(Ue)}var ue=null;ne&&(ue=R.a.createElement("li",{className:"".concat(v,"-total-text")},ne(W,[W===0?0:(Ee-1)*Be+1,Ee*Be>W?W:Ee*Be])));var ie=!this.hasPrev()||!He,se=!this.hasNext()||!He;return R.a.createElement("ul",Object(q.a)({className:b()(v,p,Object(G.a)({},"".concat(v,"-disabled"),D)),style:E,unselectable:"unselectable",ref:this.savePaginationNode},Ve),ue,R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:ie?null:0,onKeyPress:this.runIfEnterPrev,className:b()("".concat(v,"-prev"),Object(G.a)({},"".concat(v,"-disabled"),ie)),"aria-disabled":ie},this.renderPrev(rt)),ze,R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:se?null:0,onKeyPress:this.runIfEnterNext,className:b()("".concat(v,"-next"),Object(G.a)({},"".concat(v,"-disabled"),se)),"aria-disabled":se},this.renderNext(Qe)),R.a.createElement(T,{disabled:D,locale:z,rootPrefixCls:v,selectComponentClass:he,selectPrefixCls:fe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ee,pageSize:Be,pageSizeOptions:oe,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:De}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var v={};if("current"in s&&(v.current=s.current,s.current!==a.current&&(v.currentInputValue=v.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var p=a.current,E=x(s.pageSize,a,s);p=p>E?E:p,"current"in s||(v.current=p,v.currentInputValue=p),v.pageSize=s.pageSize}return v}}]),f}(R.a.Component);g.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:o,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:o,locale:c.a,style:{},itemRender:u,totalBoundaryShowSizeChanger:50};var m=g},"6K3P":function(yt,it,Q){yt.exports=Q.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(yt,it,Q){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=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(G)}var H=/^(?:[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 M(L){return typeof L=="string"&&H.test(L)}for(var P=M,F=[],I=0;I<256;++I)F.push((I+256).toString(16).substr(1));function R(L){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(F[L[S+0]]+F[L[S+1]]+F[L[S+2]]+F[L[S+3]]+"-"+F[L[S+4]]+F[L[S+5]]+"-"+F[L[S+6]]+F[L[S+7]]+"-"+F[L[S+8]]+F[L[S+9]]+"-"+F[L[S+10]]+F[L[S+11]]+F[L[S+12]]+F[L[S+13]]+F[L[S+14]]+F[L[S+15]]).toLowerCase();if(!P(w))throw TypeError("Stringified UUID is invalid");return w}var O=R;function b(L,S,w){L=L||{};var T=L.random||(L.rng||A)();if(T[6]=T[6]&15|64,T[8]=T[8]&63|128,S){w=w||0;for(var c=0;c<16;++c)S[w+c]=T[c];return S}return O(T)}var C=it.a=b},"7ahc":function(yt,it,Q){"use strict";Q.d(it,"a",function(){return x});var q=Q("k1fw"),G=Q("0Owb"),A=Q("+L6B"),H=Q("2/Rp"),M=Q("y8nQ"),P=Q("Vl3Y"),F=Q("tJVT"),I=Q("OaEy"),R=Q("2fM7"),O=Q("cDcd"),b=Q.n(O),C=Q("VrN/"),L=Q.n(C),S=Q("p77/"),w=Q.n(S),T=Q("c5Ni"),c=Q.n(T),o=R.a.Option,d={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"]};it.b=function(g){var m=g.callback,l=g.onCancel,y=Object(O.useState)("python"),f=Object(F.a)(y,2),h=f[0],s=f[1];function a(p){s(u[p][1])}function v(p){m(p)}return b.a.createElement(P.a,Object(G.a)({},d,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(R.a,{onChange:a},Object.keys(u).map(function(p){return b.a.createElement(o,{key:p,value:p},u[p][0])}))),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(x,{mode:h})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:l},"\u53D6\u6D88")))};function x(g){var m=g.value,l=g.onChange,y=g.mode,f=g.options,h=f===void 0?{}:f,s=Object(O.useRef)(),a=Object(O.useState)(),v=Object(F.a)(a,2),p=v[0],E=v[1];return Object(O.useEffect)(function(){if(p){function D(N){var W=N.getValue();l&&l(W)}return p.on("change",D),function(){p.off("change",D)}}},[p,l]),Object(O.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(O.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(O.useEffect)(function(){if(s.current&&!p){var D=L.a.fromTextArea(s.current,Object(q.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));E(D)}},[s.current,p]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:s}))}},"7ixt":function(yt,it,Q){"use strict";Q.d(it,"a",function(){return A});var q={adjustX:1,adjustY:1},G=[0,0],A={left:{points:["cr","cl"],overflow:q,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:q,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:q,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:q,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:q,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:q,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:q,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:q,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:q,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:q,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:q,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:q,offset:[-4,0],targetOffset:G}},H=A},"7qnI":function(yt,it,Q){"use strict";var q=Q("5Dmo"),G=Q("3S7+"),A=Q("fWQN"),H=Q("mtLc"),M=Q("yKVA"),P=Q("879j"),F=Q("5NDa"),I=Q("5rEg"),R=Q("cDcd"),O=Q.n(R),b=Q("O2Wb"),C=Q.n(b),L=I.a.TextArea,S=function(w){Object(M.a)(c,w);var T=Object(P.a)(c);function c(){return Object(A.a)(this,c),T.apply(this,arguments)}return Object(H.a)(c,[{key:"render",value:function(){var d=this,u=this.props,x=u.index,g=u.onAnswerChange,m=u.addChildAnswer,l=u.exerciseIsPublish,y=u.answers,f=u.activeOptionErrorIndex,h=u.flex,s=h===void 0?"0 0 1000px":h;return O.a.createElement("div",{className:C.a.flex},O.a.createElement("div",{className:"".concat(C.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",x+1,"):"),O.a.createElement("div",{className:"".concat(C.a.flex," ").concat(C.a.flex1),style:{flexDirection:"column"}},y.map(function(a,v){var p="".concat(x,"-").concat(v);return O.a.createElement("div",{className:"".concat(C.a.flex," ").concat(C.a.flex1),key:v},O.a.createElement("div",{className:C.a.flex1,style:{flex:s}},O.a.createElement("div",null,O.a.createElement(L,{className:p===f?C.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(v==0?"":"(\u53EF\u9009)"),onChange:function(D){return g(x,v,D.target.value)},style:{minHeight:95}}))),!l&&O.a.createElement(O.a.Fragment,null,v!=0&&O.a.createElement(G.a,{title:"\u5220\u9664"},O.a.createElement("i",{className:"".concat(C.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswer(x,v)},style:{float:"right"}})),v===0&&O.a.createElement(G.a,{title:"\u5220\u9664"},O.a.createElement("i",{className:"".concat(C.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswermain(x,v)},style:{float:"right"}})),O.a.createElement(G.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},O.a.createElement("i",{className:"".concat(C.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(x)},style:{float:"right",visibility:v==y.length-1?"":"hidden"}}))))})))}}]),c}(R.Component);it.a=S},"8EBN":function(yt,it,Q){(function(q){q(Q("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 G=0;G<q.modeInfo.length;G++){var A=q.modeInfo[G];A.mimes&&(A.mime=A.mimes[0])}q.findModeByMIME=function(H){H=H.toLowerCase();for(var M=0;M<q.modeInfo.length;M++){var P=q.modeInfo[M];if(P.mime==H)return P;if(P.mimes){for(var F=0;F<P.mimes.length;F++)if(P.mimes[F]==H)return P}}if(/\+xml$/.test(H))return q.findModeByMIME("application/xml");if(/\+json$/.test(H))return q.findModeByMIME("application/json")},q.findModeByExtension=function(H){H=H.toLowerCase();for(var M=0;M<q.modeInfo.length;M++){var P=q.modeInfo[M];if(P.ext){for(var F=0;F<P.ext.length;F++)if(P.ext[F]==H)return P}}},q.findModeByFileName=function(H){for(var M=0;M<q.modeInfo.length;M++){var P=q.modeInfo[M];if(P.file&&P.file.test(H))return P}var F=H.lastIndexOf("."),I=F>-1&&H.substring(F+1,H.length);if(I)return q.findModeByExtension(I)},q.findModeByName=function(H){H=H.toLowerCase();for(var M=0;M<q.modeInfo.length;M++){var P=q.modeInfo[M];if(P.name.toLowerCase()==H)return P;if(P.alias){for(var F=0;F<P.alias.length;F++)if(P.alias[F].toLowerCase()==H)return P}}}})},"8hTe":function(yt,it,Q){yt.exports={button:"button___1wy9m"}},"9Bee":function(yt,it,Q){"use strict";var q=Q("DYRE"),G=Q("zeV3"),A=Q("+L6B"),H=Q("2/Rp"),M=Q("k1fw"),P=Q("tJVT"),F=Q("cDcd"),I=Q.n(F),R=Q("vg9a"),O=Q("DlQD"),b=Q.n(O),C=Q("rUJ1");function L(ve,he){var fe=ve.match(/^(\s+)(?:```)/);if(fe===null)return he;var oe=fe[1];return he.split(`
|
|
`).map(function(Z){var Ee=Z.match(/^\s+/);if(Ee===null)return Z;var Be=Object(P.a)(Ee,1),Ne=Be[0];return Ne.length>=oe.length?Z.slice(oe.length):Z}).join(`
|
|
`)}var S=[],w=["<ul>"],T=new b.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){S.length=0,w=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(ve,he,fe,oe){if(he>=ve.length||ve[he].level<=fe)return he;var Z=ve[he];oe.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),he++;var Ee=[];return he=u(ve,he,Z.level,Ee),Ee.length>0&&(oe.push("<ul>"),Ee.forEach(function(Be){oe.push(Be)}),oe.push("</ul>")),oe.push("</li>"),he=u(ve,he,fe,oe),he}function x(){return u(S,0,0,w),w.push("</ul>"),w.join("")}var g={heading:function(he){var fe=c.exec(he);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(he){var fe=this.rules.block.fences.exec(he);if(fe){var oe=fe[0],Z=L(oe,fe[3]||""),Ee=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(Ee)>=0){var Be=y(),Ne=Z;Z=Be,f[Be]={type:"block",expression:Ne}}return{type:"code",raw:oe,lang:Ee,text:Z}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,y=function(){return"__special_katext_id_".concat(l++,"__")},f={};function h(){return f}function s(){l=0,f={}}function a(ve){return ve=ve.replace(m,function(he,fe){var oe=y();return f[oe]={type:"inline",expression:fe},oe}),ve}var v=T.listitem;T.listitem=function(ve){return v(a(ve))};var p=T.paragraph;T.paragraph=function(ve){return p(a(ve))};var E=T.tablecell;T.tablecell=function(ve,he){return E(a(ve),he)},T.code=function(ve,he,fe){var oe=(he||"").match(/\S*/)[0];return oe?["latex","katex","math"].indexOf(oe)>=0?"<p class='editormd-tex'>".concat(ve,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(he,'">').concat(fe?ve:Object(C.escape)(ve,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(fe?ve:Object(C.escape)(ve,!0))+"</code></pre>"},T.heading=function(ve,he,fe){var oe=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return S.push({anchor:oe,level:he,text:ve}),"<h"+he+' id="'+oe+'">'+ve+"</h"+he+">"},b.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),b.a.use({tokenizer:g,renderer:T});var D=b.a,N=Q("SJMd"),W=Q("ulZh"),z=Q.n(W),B=Q("m3rI"),U=Q("Oy/b"),X=Q("p5ED"),ne=Q("8hTe"),le=Q.n(ne),de=/<pre[^>]*>/g;function we(ve){var he=document.createElement("div");return he.innerHTML=ve,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var ge=it.a=function(ve){var he=ve.value,fe=he===void 0?"":he,oe=ve.edit,Z=oe===void 0?!1:oe,Ee=ve.className,Be=ve.showTextOnly,Ne=ve.showLines,He=ve.replaces,ze=ve.zoomImg,Ae=ve.hasMask,Ce=ve.style,Me=Ce===void 0?{}:Ce,Ue=ve.stylesPrev,Ie=Ue===void 0?{}:Ue,De=String(fe),Te=Object(F.useRef)(),rt=Object(F.useRef)(),Qe=Object(F.useState)(""),Ve=Object(P.a)(Qe,2),Xe=Ve[0],ut=Ve[1],tt=Object(F.useState)("office"),qe=Object(P.a)(tt,2),be=qe[0],nt=qe[1],Ye=Object(F.useMemo)(function(){try{var se=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;De=De.replace(se,"("+B.a.API_SERVER+"/api/attachments/").replace(Y,'"'+B.a.API_SERVER+"/api/attachments/").replace($,'"'+B.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(ye){}var J=D(De),ee=h();if(De.match(/\[TOC\]/)&&(J=J.replace("<p>[TOC]</p>",x()),o()),J=J.replace(/(__special_katext_id_\d+__)/g,function(ye,_e){var je=ee[_e],Ke=je.type,st=je.expression;return Object(U.renderToString)(we(st)||"",{displayMode:Ke==="block",throwOnError:!1,output:"html"})}),J=J.replace(/▁/g,"\u2581\u2581\u2581"),s(),Be){var re=document.createElement("div");return re.innerHTML=J,re.innerText}return setTimeout(function(){return ue()},500),J},[De]),xe=Object(F.useRef)();d.WebkitLineClamp=Ne,Ne&&(Me=Object(M.a)(Object(M.a)({},Me),d));function Re(se){var Y=se.target;if(Y.tagName.toUpperCase()==="IMG"){if(ze){var $=Y.getAttribute("src");ut($),nt("image")}}else if(Y.tagName.toUpperCase()==="A"){var J=Y.getAttribute("href");if(J.indexOf("office")>-1)se.preventDefault(),ut(J),nt("office");else if(J.indexOf("application/pdf")>-1)se.preventDefault(),ut(J),nt("pdf");else if(J.indexOf("text/html")>-1)se.preventDefault(),ut(J),nt("html");else if(J.startsWith("#")){se.preventDefault();var ee=document.getElementById(J.replace("#",""));ee&&ee.scrollIntoView(!0)}}}var ue=function(){var Y,$=(Y=xe.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");$==null||$.forEach(function(J){if(J.oncontextmenu=function(){return!1},J.src.indexOf(".m3u8")>-1&&!J.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var ee=new z.a;ee.loadSource(J.src),ee.attachMedia(J)}}})};Object(F.useEffect)(function(){if(xe.current&&Ye&&(Ye.match(de)&&window.PR.prettyPrint()),xe.current)return xe.current.addEventListener("click",Re),function(){xe.current.removeEventListener("click",Re),s(),o()}},[Ye,xe.current,Re]);var ie=function(Y){if(!Z)return;Y.target.nodeName==="IMG"?(Te.current.style.display="flex",Te.current.style.width=Y.target.clientWidth+"px",Te.current.style.height=Y.target.clientHeight+"px",Te.current.style.top=Y.target.offsetTop+"px",Te.current.style.left=Y.target.offsetLeft+"px",rt.current.src=Y.target.getAttribute("src")):Te.current.style.display="none"};return I.a.createElement("div",{style:{position:"relative"}},I.a.createElement("div",{ref:xe,style:Object(M.a)({},Me),className:"".concat(Ee||""," markdown-body ").concat(le.a.mdBody),onMouseOver:ie,dangerouslySetInnerHTML:{__html:Ye}}),I.a.createElement("div",{ref:Te,className:le.a.button},I.a.createElement(G.a,null,I.a.createElement(H.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),I.a.createElement(H.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),I.a.createElement("img",{ref:rt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),I.a.createElement(X.a,{close:!0,data:Xe,type:Xe!=null&&Xe.length?be:"",style:Object(M.a)({},Ie),onClose:function(){return ut("")}}))}},"9VGf":function(yt,it,Q){"use strict";Q.d(it,"a",function(){return A});var q=Q("cDcd"),G=Q.n(q);function A(H,M){var P=Object(q.useRef)();Object(q.useEffect)(function(){P.current=H}),Object(q.useEffect)(function(){function F(){P.current()}if(M!==null){var I=setInterval(F,M);return function(){return clearInterval(I)}}},[M])}},Bd2K:function(yt,it,Q){(function(q){q(Q("VrN/"),Q("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(R,O,b){if(b!=q.Init&&b&&R.removeKeyMap("autoCloseTags"),!O)return;var C={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(C["'/'"]=function(L){return P(L)}),(typeof O!="object"||O.whenOpening!==!1)&&(C["'>'"]=function(L){return H(L)}),R.addKeyMap(C)});var G=["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 H(R){if(R.getOption("disableInput"))return q.Pass;for(var O=R.listSelections(),b=[],C=R.getOption("autoCloseTags"),L=0;L<O.length;L++){if(!O[L].empty())return q.Pass;var S=O[L].head,w=R.getTokenAt(S),T=q.innerMode(R.getMode(),w.state),c=T.state,o=T.mode.xmlCurrentTag&&T.mode.xmlCurrentTag(c),d=o&&o.name;if(!d)return q.Pass;var u=T.mode.configuration=="html",x=typeof C=="object"&&C.dontCloseTags||u&&G,g=typeof C=="object"&&C.indentTags||u&&A;w.end>S.ch&&(d=d.slice(0,d.length-w.end+S.ch));var m=d.toLowerCase();if(!d||w.type=="string"&&(w.end!=S.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==S.ch-w.start-1||x&&F(x,m)>-1||I(R,T.mode.xmlCurrentContext&&T.mode.xmlCurrentContext(c)||[],d,S,!0))return q.Pass;var l=typeof C=="object"&&C.emptyTags;if(l&&F(l,d)>-1){b[L]={text:"/>",newPos:q.Pos(S.line,S.ch+2)};continue}var y=g&&F(g,m)>-1;b[L]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+d+">",newPos:y?q.Pos(S.line+1,0):q.Pos(S.line,S.ch+1)}}for(var f=typeof C=="object"&&C.dontIndentOnAutoClose,L=O.length-1;L>=0;L--){var h=b[L];R.replaceRange(h.text,O[L].head,O[L].anchor,"+insert");var s=R.listSelections().slice(0);s[L]={head:h.newPos,anchor:h.newPos},R.setSelections(s),!f&&h.indent&&(R.indentLine(h.newPos.line,null,!0),R.indentLine(h.newPos.line+1,null,!0))}}function M(R,O){for(var b=R.listSelections(),C=[],L=O?"/":"</",S=R.getOption("autoCloseTags"),w=typeof S=="object"&&S.dontIndentOnSlash,T=0;T<b.length;T++){if(!b[T].empty())return q.Pass;var c=b[T].head,o=R.getTokenAt(c),d=q.innerMode(R.getMode(),o.state),u=d.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=c.ch-1))return q.Pass;var x,g=d.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(g&&d.mode.name=="javascript")x=L+"script";else if(g&&d.mode.name=="css")x=L+"style";else{var m=d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(u);if(!m||m.length&&I(R,m,m[m.length-1],c))return q.Pass;x=L+m[m.length-1]}R.getLine(c.line).charAt(o.end)!=">"&&(x+=">"),C[T]=x}if(R.replaceSelections(C),b=R.listSelections(),!w)for(var T=0;T<b.length;T++)(T==b.length-1||b[T].head.line<b[T+1].head.line)&&R.indentLine(b[T].head.line)}function P(R){return R.getOption("disableInput")?q.Pass:M(R,!0)}q.commands.closeTag=function(R){return M(R)};function F(R,O){if(R.indexOf)return R.indexOf(O);for(var b=0,C=R.length;b<C;++b)if(R[b]==O)return b;return-1}function I(R,O,b,C,L){if(!q.scanForClosingTag)return!1;var S=Math.min(R.lastLine()+1,C.line+500),w=q.scanForClosingTag(R,C,null,S);if(!w||w.tag!=b)return!1;for(var T=L?1:0,c=O.length-1;c>=0&&O[c]==b;c--)++T;C=w.to;for(var c=1;c<T;c++){var o=q.scanForClosingTag(R,C,null,S);if(!o||o.tag!=b)return!1;C=o.to}return!0}})},BjJ7:function(yt,it,Q){"use strict";Q.d(it,"d",function(){return G}),Q.d(it,"c",function(){return A}),Q.d(it,"e",function(){return H}),Q.d(it,"b",function(){return M}),Q.d(it,"a",function(){return F});var q=Q("m3rI");function G(I){var R=!0;if(I.length>0){for(var O=0;O<I.length;O++)if(I[O].compile_success==0||!I[O].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]:"",O=[],b=0;b<I.length;b++){var C=I[b],L=R?"".concat(R,"/").concat(C.name):"".concat(C.name);O.push({title:C.name,isLeaf:!(C.type==="tree"),key:L})}return O}function H(I,R,O){for(var b=0;b<I.length;b++){var C=I[b];if(C.key===R){C.children=O;break}C.children&&H(C.children,R,O)}return I}function M(I,R,O){var b;return function(){var C=this,L=arguments,S=function(){b=null,O||I.apply(C,L)},w=O&&!b;clearTimeout(b),b=setTimeout(S,R),w&&I.apply(C,L)}}var P=!0,F=q.a.API_SERVER},"C+DQ":function(yt,it,Q){},DlQD:function(yt,it,Q){(function(q,G){yt.exports=G()})(this,function(){"use strict";function q(ue,ie){for(var se=0;se<ie.length;se++){var Y=ie[se];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(ue,Y.key,Y)}}function G(ue,ie,se){return ie&&q(ue.prototype,ie),se&&q(ue,se),ue}function A(ue,ie){if(!ue)return;if(typeof ue=="string")return H(ue,ie);var se=Object.prototype.toString.call(ue).slice(8,-1);if(se==="Object"&&ue.constructor&&(se=ue.constructor.name),se==="Map"||se==="Set")return Array.from(ue);if(se==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(se))return H(ue,ie)}function H(ue,ie){(ie==null||ie>ue.length)&&(ie=ue.length);for(var se=0,Y=new Array(ie);se<ie;se++)Y[se]=ue[se];return Y}function M(ue,ie){var se;if(typeof Symbol=="undefined"||ue[Symbol.iterator]==null){if(Array.isArray(ue)||(se=A(ue))||ie&&ue&&typeof ue.length=="number"){se&&(ue=se);var Y=0;return function(){return Y>=ue.length?{done:!0}:{done:!1,value:ue[Y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return se=ue[Symbol.iterator](),se.next.bind(se)}function P(ue,ie){return ie={exports:{}},ue(ie,ie.exports),ie.exports}var F=P(function(ue){function ie(){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 se(Y){ue.exports.defaults=Y}ue.exports={defaults:ie(),getDefaults:ie,changeDefaults:se}}),I=F.defaults,R=F.getDefaults,O=F.changeDefaults,b=/[&<>"']/,C=/[&<>"']/g,L=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},T=function(ie){return w[ie]};function c(ue,ie){if(ie){if(b.test(ue))return ue.replace(C,T)}else if(L.test(ue))return ue.replace(S,T);return ue}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function d(ue){return ue.replace(o,function(ie,se){return se=se.toLowerCase(),se==="colon"?":":se.charAt(0)==="#"?se.charAt(1)==="x"?String.fromCharCode(parseInt(se.substring(2),16)):String.fromCharCode(+se.substring(1)):""})}var u=/(^|[^\[])\^/g;function x(ue,ie){ue=ue.source||ue,ie=ie||"";var se={replace:function($,J){return J=J.source||J,J=J.replace(u,"$1"),ue=ue.replace($,J),se},getRegex:function(){return new RegExp(ue,ie)}};return se}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function l(ue,ie,se){if(ue){var Y;try{Y=decodeURIComponent(d(se)).replace(g,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ie&&!m.test(se)&&(se=a(ie,se));try{se=encodeURI(se).replace(/%25/g,"%")}catch($){return null}return se}var y={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ue,ie){y[" "+ue]||(f.test(ue)?y[" "+ue]=ue+"/":y[" "+ue]=D(ue,"/",!0)),ue=y[" "+ue];var se=ue.indexOf(":")===-1;return ie.substring(0,2)==="//"?se?ie:ue.replace(h,"$1")+ie:ie.charAt(0)==="/"?se?ie:ue.replace(s,"$1")+ie:ue+ie}var v={exec:function(){}};function p(ue){for(var ie=1,se,Y;ie<arguments.length;ie++){se=arguments[ie];for(Y in se)Object.prototype.hasOwnProperty.call(se,Y)&&(ue[Y]=se[Y])}return ue}function E(ue,ie){var se=ue.replace(/\|/g,function(J,ee,re){for(var ye=!1,_e=ee;--_e>=0&&re[_e]==="\\";)ye=!ye;return ye?"|":" |"}),Y=se.split(/ \|/),$=0;if(Y.length>ie)Y.splice(ie);else for(;Y.length<ie;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function D(ue,ie,se){var Y=ue.length;if(Y===0)return"";for(var $=0;$<Y;){var J=ue.charAt(Y-$-1);if(J===ie&&!se)$++;else if(J!==ie&&se)$++;else break}return ue.substr(0,Y-$)}function N(ue,ie){if(ue.indexOf(ie[1])===-1)return-1;for(var se=ue.length,Y=0,$=0;$<se;$++)if(ue[$]==="\\")$++;else if(ue[$]===ie[0])Y++;else if(ue[$]===ie[1]&&(Y--,Y<0))return $;return-1}function W(ue){ue&&ue.sanitize&&!ue.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 z={escape:c,unescape:d,edit:x,cleanUrl:l,resolveUrl:a,noopTest:v,merge:p,splitCells:E,rtrim:D,findClosingBracket:N,checkSanitizeDeprecation:W},B=F.defaults,U=z.rtrim,X=z.splitCells,ne=z.escape,le=z.findClosingBracket;function de(ue,ie,se){var Y=ie.href,$=ie.title?ne(ie.title):null,J=ue[1].replace(/\\([\[\]])/g,"$1");return ue[0].charAt(0)!=="!"?{type:"link",raw:se,href:Y,title:$,text:J}:{type:"image",raw:se,href:Y,title:$,text:ne(J)}}function we(ue,ie){var se=ue.match(/^(\s+)(?:```)/);if(se===null)return ie;var Y=se[1];return ie.split(`
|
|
`).map(function($){var J=$.match(/^\s+/);if(J===null)return $;var ee=J[0];return ee.length>=Y.length?$.slice(Y.length):$}).join(`
|
|
`)}var ge=function(){function ue(se){this.options=se||B}var ie=ue.prototype;return ie.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},ie.code=function(Y,$){var J=this.rules.block.code.exec(Y);if(J){var ee=$[$.length-1];if(ee&&ee.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var re=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?re:U(re,`
|
|
`)}}},ie.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var J=$[0],ee=we(J,$[3]||"");return{type:"code",raw:J,lang:$[2]?$[2].trim():$[2],text:ee}}},ie.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ie.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var J={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(J.header.length===J.align.length){var ee=J.align.length,re;for(re=0;re<ee;re++)/^ *-+: *$/.test(J.align[re])?J.align[re]="right":/^ *:-+: *$/.test(J.align[re])?J.align[re]="center":/^ *:-+ *$/.test(J.align[re])?J.align[re]="left":J.align[re]=null;for(ee=J.cells.length,re=0;re<ee;re++)J.cells[re]=X(J.cells[re],J.header.length);return J}}},ie.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ie.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var J=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:J}}},ie.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var J=$[0],ee=$[2],re=ee.length>1,ye=ee[ee.length-1]===")",_e={type:"list",raw:J,ordered:re,start:re?+ee.slice(0,-1):"",loose:!1,items:[]},je=$[0].match(this.rules.block.item),Ke=!1,st,Dt,Ge,lt,Ct,ht,Lt,Gt=je.length,bt=0;bt<Gt;bt++)st=je[bt],J=st,Dt=st.length,st=st.replace(/^ *([*+-]|\d+[.)]) */,""),~st.indexOf(`
|
|
`)&&(Dt-=st.length,st=this.options.pedantic?st.replace(/^ {1,4}/gm,""):st.replace(new RegExp("^ {1,"+Dt+"}","gm"),"")),bt!==Gt-1&&(Ge=this.rules.block.bullet.exec(je[bt+1])[0],(re?Ge.length===1||!ye&&Ge[Ge.length-1]===")":Ge.length>1||this.options.smartLists&&Ge!==ee)&&(lt=je.slice(bt+1).join(`
|
|
`),_e.raw=_e.raw.substring(0,_e.raw.length-lt.length),bt=Gt-1)),Ct=Ke||/\n\n(?!\s*$)/.test(st),bt!==Gt-1&&(Ke=st.charAt(st.length-1)===`
|
|
`,Ct||(Ct=Ke)),Ct&&(_e.loose=!0),ht=/^\[[ xX]\] /.test(st),Lt=void 0,ht&&(Lt=st[1]!==" ",st=st.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:J,task:ht,checked:Lt,loose:Ct,text:st});return _e}},ie.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):ne($[0]):$[0]}},ie.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var J=$[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:$[0],href:$[2],title:$[3]}}},ie.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var J={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(J.header.length===J.align.length){J.raw=$[0];var ee=J.align.length,re;for(re=0;re<ee;re++)/^ *-+: *$/.test(J.align[re])?J.align[re]="right":/^ *:-+: *$/.test(J.align[re])?J.align[re]="center":/^ *:-+ *$/.test(J.align[re])?J.align[re]="left":J.align[re]=null;for(ee=J.cells.length,re=0;re<ee;re++)J.cells[re]=X(J.cells[re].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ie.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ie.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},ie.text=function(Y,$){var J=this.rules.block.text.exec(Y);if(J){var ee=$[$.length-1];return ee&&ee.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ie.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:ne($[1])}},ie.tag=function(Y,$,J){var ee=this.rules.inline.tag.exec(Y);if(ee)return!$&&/^<a /i.test(ee[0])?$=!0:$&&/^<\/a>/i.test(ee[0])&&($=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:$,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):ne(ee[0]):ee[0]}},ie.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var J=le($[2],"()");if(J>-1){var ee=$[0].indexOf("!")===0?5:4,re=ee+$[1].length+J;$[2]=$[2].substring(0,J),$[0]=$[0].substring(0,re).trim(),$[3]=""}var ye=$[2],_e="";if(this.options.pedantic){var je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ye);je?(ye=je[1],_e=je[3]):_e=""}else _e=$[3]?$[3].slice(1,-1):"";ye=ye.trim().replace(/^<([\s\S]*)>$/,"$1");var Ke=de($,{href:ye&&ye.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},$[0]);return Ke}},ie.reflink=function(Y,$){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var ee=(J[2]||J[1]).replace(/\s+/g," ");if(ee=$[ee.toLowerCase()],!ee||!ee.href){var re=J[0].charAt(0);return{type:"text",raw:re,text:re}}var ye=de(J,ee,J[0]);return ye}},ie.strong=function(Y,$,J){J===void 0&&(J="");var ee=this.rules.inline.strong.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var re=ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;re.lastIndex=0;for(var ye;(ee=re.exec($))!=null;)if(ye=this.rules.inline.strong.middle.exec($.slice(0,ee.index+3)),ye)return{type:"strong",raw:Y.slice(0,ye[0].length),text:Y.slice(2,ye[0].length-2)}}},ie.em=function(Y,$,J){J===void 0&&(J="");var ee=this.rules.inline.em.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var re=ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;re.lastIndex=0;for(var ye;(ee=re.exec($))!=null;)if(ye=this.rules.inline.em.middle.exec($.slice(0,ee.index+2)),ye)return{type:"em",raw:Y.slice(0,ye[0].length),text:Y.slice(1,ye[0].length-1)}}},ie.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var J=$[2].replace(/\n/g," "),ee=/[^ ]/.test(J),re=J.startsWith(" ")&&J.endsWith(" ");return ee&&re&&(J=J.substring(1,J.length-1)),J=ne(J,!0),{type:"codespan",raw:$[0],text:J}}},ie.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ie.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ie.autolink=function(Y,$){var J=this.rules.inline.autolink.exec(Y);if(J){var ee,re;return J[2]==="@"?(ee=ne(this.options.mangle?$(J[1]):J[1]),re="mailto:"+ee):(ee=ne(J[1]),re=ee),{type:"link",raw:J[0],text:ee,href:re,tokens:[{type:"text",raw:ee,text:ee}]}}},ie.url=function(Y,$){var J;if(J=this.rules.inline.url.exec(Y)){var ee,re;if(J[2]==="@")ee=ne(this.options.mangle?$(J[0]):J[0]),re="mailto:"+ee;else{var ye;do ye=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(ye!==J[0]);ee=ne(J[0]),J[1]==="www."?re="http://"+ee:re=ee}return{type:"link",raw:J[0],text:ee,href:re,tokens:[{type:"text",raw:ee,text:ee}]}}},ie.inlineText=function(Y,$,J){var ee=this.rules.inline.text.exec(Y);if(ee){var re;return $?re=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):ne(ee[0]):ee[0]:re=ne(this.options.smartypants?J(ee[0]):ee[0]),{type:"text",raw:ee[0],text:re}}},ue}(),ve=z.noopTest,he=z.edit,fe=z.merge,oe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ve,table:ve,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};oe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,oe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,oe.def=he(oe.def).replace("label",oe._label).replace("title",oe._title).getRegex(),oe.bullet=/(?:[*+-]|\d{1,9}[.)])/,oe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,oe.item=he(oe.item,"gm").replace(/bull/g,oe.bullet).getRegex(),oe.list=he(oe.list).replace(/bull/g,oe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+oe.def.source+")").getRegex(),oe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",oe._comment=/<!--(?!-?>)[\s\S]*?-->/,oe.html=he(oe.html,"i").replace("comment",oe._comment).replace("tag",oe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe.paragraph=he(oe._paragraph).replace("hr",oe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",oe._tag).getRegex(),oe.blockquote=he(oe.blockquote).replace("paragraph",oe.paragraph).getRegex(),oe.normal=fe({},oe),oe.gfm=fe({},oe.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),oe.gfm.nptable=he(oe.gfm.nptable).replace("hr",oe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",oe._tag).getRegex(),oe.gfm.table=he(oe.gfm.table).replace("hr",oe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",oe._tag).getRegex(),oe.pedantic=fe({},oe.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",oe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ve,paragraph:he(oe.normal._paragraph).replace("hr",oe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",oe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ve,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:ve,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Z.punctuation=he(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Z.em.start=he(Z.em.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.middle=he(Z.em.middle).replace(/punctuation/g,Z._punctuation).replace(/overlapSkip/g,Z._overlapSkip).getRegex(),Z.em.endAst=he(Z.em.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.endUnd=he(Z.em.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.start=he(Z.strong.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.middle=he(Z.strong.middle).replace(/punctuation/g,Z._punctuation).replace(/blockSkip/g,Z._blockSkip).getRegex(),Z.strong.endAst=he(Z.strong.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.endUnd=he(Z.strong.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=he(Z._blockSkip,"g").getRegex(),Z.overlapSkip=he(Z._overlapSkip,"g").getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._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])?)+(?![-_])/,Z.autolink=he(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=he(Z.tag).replace("comment",oe._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=he(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=he(Z.reflink).replace("label",Z._label).getRegex(),Z.reflinkSearch=he(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal=fe({},Z),Z.pedantic=fe({},Z.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()}),Z.gfm=fe({},Z.normal,{escape:he(Z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),Z.gfm.url=he(Z.gfm.url,"i").replace("email",Z.gfm._extended_email).getRegex(),Z.breaks=fe({},Z.gfm,{br:he(Z.br).replace("{2,}","*").getRegex(),text:he(Z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:oe,inline:Z},Be=F.defaults,Ne=Ee.block,He=Ee.inline;function ze(ue){return ue.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 Ae(ue){var ie="",se,Y,$=ue.length;for(se=0;se<$;se++)Y=ue.charCodeAt(se),Math.random()>.5&&(Y="x"+Y.toString(16)),ie+="&#"+Y+";";return ie}var Ce=function(){function ue(se){this.tokens=[],this.tokens.links=Object.create(null),this.options=se||Be,this.options.tokenizer=this.options.tokenizer||new ge,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Ne.normal,inline:He.normal};this.options.pedantic?(Y.block=Ne.pedantic,Y.inline=He.pedantic):this.options.gfm&&(Y.block=Ne.gfm,this.options.breaks?Y.inline=He.breaks:Y.inline=He.gfm),this.tokenizer.rules=Y}ue.lex=function(Y,$){var J=new ue($);return J.lex(Y)};var ie=ue.prototype;return ie.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ie.blockTokens=function(Y,$,J){$===void 0&&($=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var ee,re,ye,_e;Y;){if(ee=this.tokenizer.space(Y)){Y=Y.substring(ee.raw.length),ee.type&&$.push(ee);continue}if(ee=this.tokenizer.code(Y,$)){Y=Y.substring(ee.raw.length),ee.type?$.push(ee):(_e=$[$.length-1],_e.raw+=`
|
|
`+ee.raw,_e.text+=`
|
|
`+ee.text);continue}if(ee=this.tokenizer.fences(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.heading(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.nptable(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.hr(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.blockquote(Y)){Y=Y.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],J),$.push(ee);continue}if(ee=this.tokenizer.list(Y)){for(Y=Y.substring(ee.raw.length),ye=ee.items.length,re=0;re<ye;re++)ee.items[re].tokens=this.blockTokens(ee.items[re].text,[],!1);$.push(ee);continue}if(ee=this.tokenizer.html(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(J&&(ee=this.tokenizer.def(Y))){Y=Y.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.lheading(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(J&&(ee=this.tokenizer.paragraph(Y))){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.text(Y,$)){Y=Y.substring(ee.raw.length),ee.type?$.push(ee):(_e=$[$.length-1],_e.raw+=`
|
|
`+ee.raw,_e.text+=`
|
|
`+ee.text);continue}if(Y){var je="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(je);break}else throw new Error(je)}}return $},ie.inline=function(Y){var $,J,ee,re,ye,_e,je=Y.length;for($=0;$<je;$++){_e=Y[$];switch(_e.type){case"paragraph":case"text":case"heading":{_e.tokens=[],this.inlineTokens(_e.text,_e.tokens);break}case"table":{for(_e.tokens={header:[],cells:[]},re=_e.header.length,J=0;J<re;J++)_e.tokens.header[J]=[],this.inlineTokens(_e.header[J],_e.tokens.header[J]);for(re=_e.cells.length,J=0;J<re;J++)for(ye=_e.cells[J],_e.tokens.cells[J]=[],ee=0;ee<ye.length;ee++)_e.tokens.cells[J][ee]=[],this.inlineTokens(ye[ee],_e.tokens.cells[J][ee]);break}case"blockquote":{this.inline(_e.tokens);break}case"list":{for(re=_e.items.length,J=0;J<re;J++)this.inline(_e.items[J].tokens);break}}}return Y},ie.inlineTokens=function(Y,$,J,ee,re){$===void 0&&($=[]),J===void 0&&(J=!1),ee===void 0&&(ee=!1),re===void 0&&(re="");var ye,_e=Y,je;if(this.tokens.links){var Ke=Object.keys(this.tokens.links);if(Ke.length>0)for(;(je=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)Ke.includes(je[0].slice(je[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(je=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(ye=this.tokenizer.escape(Y)){Y=Y.substring(ye.raw.length),$.push(ye);continue}if(ye=this.tokenizer.tag(Y,J,ee)){Y=Y.substring(ye.raw.length),J=ye.inLink,ee=ye.inRawBlock,$.push(ye);continue}if(ye=this.tokenizer.link(Y)){Y=Y.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ee)),$.push(ye);continue}if(ye=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ee)),$.push(ye);continue}if(ye=this.tokenizer.strong(Y,_e,re)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],J,ee),$.push(ye);continue}if(ye=this.tokenizer.em(Y,_e,re)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],J,ee),$.push(ye);continue}if(ye=this.tokenizer.codespan(Y)){Y=Y.substring(ye.raw.length),$.push(ye);continue}if(ye=this.tokenizer.br(Y)){Y=Y.substring(ye.raw.length),$.push(ye);continue}if(ye=this.tokenizer.del(Y)){Y=Y.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],J,ee),$.push(ye);continue}if(ye=this.tokenizer.autolink(Y,Ae)){Y=Y.substring(ye.raw.length),$.push(ye);continue}if(!J&&(ye=this.tokenizer.url(Y,Ae))){Y=Y.substring(ye.raw.length),$.push(ye);continue}if(ye=this.tokenizer.inlineText(Y,ee,ze)){Y=Y.substring(ye.raw.length),re=ye.raw.slice(-1),$.push(ye);continue}if(Y){var st="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return $},G(ue,null,[{key:"rules",get:function(){return{block:Ne,inline:He}}}]),ue}(),Me=F.defaults,Ue=z.cleanUrl,Ie=z.escape,De=function(){function ue(se){this.options=se||Me}var ie=ue.prototype;return ie.code=function(Y,$,J){var ee=($||"").match(/\S*/)[0];if(this.options.highlight){var re=this.options.highlight(Y,ee);re!=null&&re!==Y&&(J=!0,Y=re)}return ee?'<pre><code class="'+this.options.langPrefix+Ie(ee,!0)+'">'+(J?Y:Ie(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(J?Y:Ie(Y,!0))+`</code></pre>
|
|
`},ie.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},ie.html=function(Y){return Y},ie.heading=function(Y,$,J,ee){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+ee.slug(J)+'">'+Y+"</h"+$+`>
|
|
`:"<h"+$+">"+Y+"</h"+$+`>
|
|
`},ie.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ie.list=function(Y,$,J){var ee=$?"ol":"ul",re=$&&J!==1?' start="'+J+'"':"";return"<"+ee+re+`>
|
|
`+Y+"</"+ee+`>
|
|
`},ie.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},ie.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ie.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},ie.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+$+`</table>
|
|
`},ie.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},ie.tablecell=function(Y,$){var J=$.header?"th":"td",ee=$.align?"<"+J+' align="'+$.align+'">':"<"+J+">";return ee+Y+"</"+J+`>
|
|
`},ie.strong=function(Y){return"<strong>"+Y+"</strong>"},ie.em=function(Y){return"<em>"+Y+"</em>"},ie.codespan=function(Y){return"<code>"+Y+"</code>"},ie.br=function(){return this.options.xhtml?"<br/>":"<br>"},ie.del=function(Y){return"<del>"+Y+"</del>"},ie.link=function(Y,$,J){if(Y=Ue(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<a href="'+Ie(Y)+'"';return $&&(ee+=' title="'+$+'"'),ee+=">"+J+"</a>",ee},ie.image=function(Y,$,J){if(Y=Ue(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<img src="'+Y+'" alt="'+J+'"';return $&&(ee+=' title="'+$+'"'),ee+=this.options.xhtml?"/>":">",ee},ie.text=function(Y){return Y},ue}(),Te=function(){function ue(){}var ie=ue.prototype;return ie.strong=function(Y){return Y},ie.em=function(Y){return Y},ie.codespan=function(Y){return Y},ie.del=function(Y){return Y},ie.html=function(Y){return Y},ie.text=function(Y){return Y},ie.link=function(Y,$,J){return""+J},ie.image=function(Y,$,J){return""+J},ie.br=function(){return""},ue}(),rt=function(){function ue(){this.seen={}}var ie=ue.prototype;return ie.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var J=$;do this.seen[J]++,$=J+"-"+this.seen[J];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},ue}(),Qe=F.defaults,Ve=z.unescape,Xe=function(){function ue(se){this.options=se||Qe,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Te,this.slugger=new rt}ue.parse=function(Y,$){var J=new ue($);return J.parse(Y)};var ie=ue.prototype;return ie.parse=function(Y,$){$===void 0&&($=!0);var J="",ee,re,ye,_e,je,Ke,st,Dt,Ge,lt,Ct,ht,Lt,Gt,bt,zt,Wt,Bt,kt=Y.length;for(ee=0;ee<kt;ee++){lt=Y[ee];switch(lt.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(lt.tokens),lt.depth,Ve(this.parseInline(lt.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(lt.text,lt.lang,lt.escaped);continue}case"table":{for(Dt="",st="",_e=lt.header.length,re=0;re<_e;re++)st+=this.renderer.tablecell(this.parseInline(lt.tokens.header[re]),{header:!0,align:lt.align[re]});for(Dt+=this.renderer.tablerow(st),Ge="",_e=lt.cells.length,re=0;re<_e;re++){for(Ke=lt.tokens.cells[re],st="",je=Ke.length,ye=0;ye<je;ye++)st+=this.renderer.tablecell(this.parseInline(Ke[ye]),{header:!1,align:lt.align[ye]});Ge+=this.renderer.tablerow(st)}J+=this.renderer.table(Dt,Ge);continue}case"blockquote":{Ge=this.parse(lt.tokens),J+=this.renderer.blockquote(Ge);continue}case"list":{for(Ct=lt.ordered,ht=lt.start,Lt=lt.loose,_e=lt.items.length,Ge="",re=0;re<_e;re++)bt=lt.items[re],zt=bt.checked,Wt=bt.task,Gt="",bt.task&&(Bt=this.renderer.checkbox(zt),Lt?bt.tokens.length>0&&bt.tokens[0].type==="text"?(bt.tokens[0].text=Bt+" "+bt.tokens[0].text,bt.tokens[0].tokens&&bt.tokens[0].tokens.length>0&&bt.tokens[0].tokens[0].type==="text"&&(bt.tokens[0].tokens[0].text=Bt+" "+bt.tokens[0].tokens[0].text)):bt.tokens.unshift({type:"text",text:Bt}):Gt+=Bt),Gt+=this.parse(bt.tokens,Lt),Ge+=this.renderer.listitem(Gt,Wt,zt);J+=this.renderer.list(Ge,Ct,ht);continue}case"html":{J+=this.renderer.html(lt.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(lt.tokens));continue}case"text":{for(Ge=lt.tokens?this.parseInline(lt.tokens):lt.text;ee+1<kt&&Y[ee+1].type==="text";)lt=Y[++ee],Ge+=`
|
|
`+(lt.tokens?this.parseInline(lt.tokens):lt.text);J+=$?this.renderer.paragraph(Ge):Ge;continue}default:{var Pt='Token with "'+lt.type+'" type was not found.';if(this.options.silent){console.error(Pt);return}else throw new Error(Pt)}}}return J},ie.parseInline=function(Y,$){$=$||this.renderer;var J="",ee,re,ye=Y.length;for(ee=0;ee<ye;ee++){re=Y[ee];switch(re.type){case"escape":{J+=$.text(re.text);break}case"html":{J+=$.html(re.text);break}case"link":{J+=$.link(re.href,re.title,this.parseInline(re.tokens,$));break}case"image":{J+=$.image(re.href,re.title,re.text);break}case"strong":{J+=$.strong(this.parseInline(re.tokens,$));break}case"em":{J+=$.em(this.parseInline(re.tokens,$));break}case"codespan":{J+=$.codespan(re.text);break}case"br":{J+=$.br();break}case"del":{J+=$.del(this.parseInline(re.tokens,$));break}case"text":{J+=$.text(re.text);break}default:{var _e='Token with "'+re.type+'" type was not found.';if(this.options.silent){console.error(_e);return}else throw new Error(_e)}}}return J},ue}(),ut=z.merge,tt=z.checkSanitizeDeprecation,qe=z.escape,be=F.getDefaults,nt=F.changeDefaults,Ye=F.defaults;function xe(ue,ie,se){if(typeof ue=="undefined"||ue===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ue!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ue)+", string expected");if(typeof ie=="function"&&(se=ie,ie=null),ie=ut({},xe.defaults,ie||{}),tt(ie),se){var Y=ie.highlight,$;try{$=Ce.lex(ue,ie)}catch(ye){return se(ye)}var J=function(_e){var je;if(!_e)try{je=Xe.parse($,ie)}catch(Ke){_e=Ke}return ie.highlight=Y,_e?se(_e):se(null,je)};if(!Y||Y.length<3)return J();if(delete ie.highlight,!$.length)return J();var ee=0;xe.walkTokens($,function(ye){ye.type==="code"&&(ee++,setTimeout(function(){Y(ye.text,ye.lang,function(_e,je){if(_e)return J(_e);je!=null&&je!==ye.text&&(ye.text=je,ye.escaped=!0),ee--,ee===0&&J()})},0))}),ee===0&&J();return}try{var re=Ce.lex(ue,ie);return ie.walkTokens&&xe.walkTokens(re,ie.walkTokens),Xe.parse(re,ie)}catch(ye){if(ye.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ie.silent)return"<p>An error occurred:</p><pre>"+qe(ye.message+"",!0)+"</pre>";throw ye}}xe.options=xe.setOptions=function(ue){return ut(xe.defaults,ue),nt(xe.defaults),xe},xe.getDefaults=be,xe.defaults=Ye,xe.use=function(ue){var ie=ut({},ue);if(ue.renderer&&function(){var Y=xe.defaults.renderer||new De,$=function(re){var ye=Y[re];Y[re]=function(){for(var _e=arguments.length,je=new Array(_e),Ke=0;Ke<_e;Ke++)je[Ke]=arguments[Ke];var st=ue.renderer[re].apply(Y,je);return st===!1&&(st=ye.apply(Y,je)),st}};for(var J in ue.renderer)$(J);ie.renderer=Y}(),ue.tokenizer&&function(){var Y=xe.defaults.tokenizer||new ge,$=function(re){var ye=Y[re];Y[re]=function(){for(var _e=arguments.length,je=new Array(_e),Ke=0;Ke<_e;Ke++)je[Ke]=arguments[Ke];var st=ue.tokenizer[re].apply(Y,je);return st===!1&&(st=ye.apply(Y,je)),st}};for(var J in ue.tokenizer)$(J);ie.tokenizer=Y}(),ue.walkTokens){var se=xe.defaults.walkTokens;ie.walkTokens=function(Y){ue.walkTokens(Y),se&&se(Y)}}xe.setOptions(ie)},xe.walkTokens=function(ue,ie){for(var se=M(ue),Y;!(Y=se()).done;){var $=Y.value;ie($);switch($.type){case"table":{for(var J=M($.tokens.header),ee;!(ee=J()).done;){var re=ee.value;xe.walkTokens(re,ie)}for(var ye=M($.tokens.cells),_e;!(_e=ye()).done;)for(var je=_e.value,Ke=M(je),st;!(st=Ke()).done;){var Dt=st.value;xe.walkTokens(Dt,ie)}break}case"list":{xe.walkTokens($.items,ie);break}default:$.tokens&&xe.walkTokens($.tokens,ie)}}},xe.Parser=Xe,xe.parser=Xe.parse,xe.Renderer=De,xe.TextRenderer=Te,xe.Lexer=Ce,xe.lexer=Ce.lex,xe.Tokenizer=ge,xe.Slugger=rt,xe.parse=xe;var Re=xe;return Re})},ELLl:function(yt,it,Q){(function(q){q(Q("VrN/"))})(function(q){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=q.Pos;q.defineOption("autoCloseBrackets",!1,function(w,T,c){c&&c!=q.Init&&(w.removeKeyMap(M),w.state.closeBrackets=null),T&&(P(H(T,"pairs")),w.state.closeBrackets=T,w.addKeyMap(M))});function H(w,T){return T=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[T]!=null?w[T]:G[T]}var M={Backspace:R,Enter:O};function P(w){for(var T=0;T<w.length;T++){var c=w.charAt(T),o="'"+c+"'";M[o]||(M[o]=F(c))}}P(G.pairs+"`");function F(w){return function(T){return C(T,w)}}function I(w){var T=w.state.closeBrackets;if(!T||T.override)return T;var c=w.getModeAt(w.getCursor());return c.closeBrackets||T}function R(w){var T=I(w);if(!T||w.getOption("disableInput"))return q.Pass;for(var c=H(T,"pairs"),o=w.listSelections(),d=0;d<o.length;d++){if(!o[d].empty())return q.Pass;var u=L(w,o[d].head);if(!u||c.indexOf(u)%2!=0)return q.Pass}for(var d=o.length-1;d>=0;d--){var x=o[d].head;w.replaceRange("",A(x.line,x.ch-1),A(x.line,x.ch+1),"+delete")}}function O(w){var T=I(w),c=T&&H(T,"explode");if(!c||w.getOption("disableInput"))return q.Pass;for(var o=w.listSelections(),d=0;d<o.length;d++){if(!o[d].empty())return q.Pass;var u=L(w,o[d].head);if(!u||c.indexOf(u)%2!=0)return q.Pass}w.operation(function(){var x=w.lineSeparator()||`
|
|
`;w.replaceSelection(x+x,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var g=0;g<o.length;g++){var m=o[g].head.line;w.indentLine(m,null,!0),w.indentLine(m+1,null,!0)}})}function b(w){var T=q.cmpPos(w.anchor,w.head)>0;return{anchor:new A(w.anchor.line,w.anchor.ch+(T?-1:1)),head:new A(w.head.line,w.head.ch+(T?1:-1))}}function C(w,T){var c=I(w);if(!c||w.getOption("disableInput"))return q.Pass;var o=H(c,"pairs"),d=o.indexOf(T);if(d==-1)return q.Pass;for(var u=H(c,"closeBefore"),x=H(c,"triples"),g=o.charAt(d+1)==T,m=w.listSelections(),l=d%2==0,y,f=0;f<m.length;f++){var h=m[f],s=h.head,a,v=w.getRange(s,A(s.line,s.ch+1));if(l&&!h.empty())a="surround";else if((g||!l)&&v==T)g&&S(w,s)?a="both":x.indexOf(T)>=0&&w.getRange(s,A(s.line,s.ch+3))==T+T+T?a="skipThree":a="skip";else if(g&&s.ch>1&&x.indexOf(T)>=0&&w.getRange(A(s.line,s.ch-2),s)==T+T){if(s.ch>2&&/\bstring/.test(w.getTokenTypeAt(A(s.line,s.ch-2))))return q.Pass;a="addFour"}else if(g){var p=s.ch==0?" ":w.getRange(A(s.line,s.ch-1),s);if(!q.isWordChar(v)&&p!=T&&!q.isWordChar(p))a="both";else return q.Pass}else if(l&&(v.length===0||/\s/.test(v)||u.indexOf(v)>-1))a="both";else return q.Pass;if(!y)y=a;else if(y!=a)return q.Pass}var E=d%2?o.charAt(d-1):T,D=d%2?T:o.charAt(d+1);w.operation(function(){if(y=="skip")w.execCommand("goCharRight");else if(y=="skipThree")for(var N=0;N<3;N++)w.execCommand("goCharRight");else if(y=="surround"){for(var W=w.getSelections(),N=0;N<W.length;N++)W[N]=E+W[N]+D;w.replaceSelections(W,"around"),W=w.listSelections().slice();for(var N=0;N<W.length;N++)W[N]=b(W[N]);w.setSelections(W)}else y=="both"?(w.replaceSelection(E+D,null),w.triggerElectric(E+D),w.execCommand("goCharLeft")):y=="addFour"&&(w.replaceSelection(E+E+E+E,"before"),w.execCommand("goCharRight"))})}function L(w,T){var c=w.getRange(A(T.line,T.ch-1),A(T.line,T.ch+1));return c.length==2?c:null}function S(w,T){var c=w.getTokenAt(A(T.line,T.ch+1));return/\bstring/.test(c.type)&&c.start==T.ch&&(T.ch==0||!/\bstring/.test(w.getTokenTypeAt(T)))}})},FIWC:function(yt,it,Q){yt.exports={flex_box_center:"flex_box_center___gdHkq",flex_space_between:"flex_space_between___lk_Gv",flex_box_vertical_center:"flex_box_vertical_center___2WNVo",flex_box_center_end:"flex_box_center_end___13O11",flex_box_column:"flex_box_column___kMb8L",wrap:"wrap___1y6rg",crumbs:"crumbs___1vKDo"}},Gytx:function(yt,it){yt.exports=function(q,G,A,H){var M=A?A.call(H,q,G):void 0;if(M!==void 0)return!!M;if(q===G)return!0;if(typeof q!="object"||!q||typeof G!="object"||!G)return!1;var P=Object.keys(q),F=Object.keys(G);if(P.length!==F.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind(G),R=0;R<P.length;R++){var O=P[R];if(!I(O))return!1;var b=q[O],C=G[O];if(M=A?A.call(H,b,C,O):void 0,M===!1||M===void 0&&b!==C)return!1}return!0}},HmJG:function(yt,it,Q){},LdHM:function(yt,it,Q){"use strict";Q.d(it,"b",function(){return u}),Q.d(it,"a",function(){return g});var q=Q("1OyB"),G=Q("vuIU"),A=Q("Ji7U"),H=Q("LK+K"),M=Q("cDcd"),P=Q("rePB"),F=Q("Ff2n"),I=Q("ODXe"),R=Q("4IlW"),O=Q("bX4T"),b=Q("YrtM"),C=Q("TSYQ"),L=Q.n(C),S=Q("+nKL"),w=Q("8OUc"),T=function(X,ne){var le=X.prefixCls,de=X.id,we=X.flattenOptions,ge=X.childrenAsData,ve=X.values,he=X.searchValue,fe=X.multiple,oe=X.defaultActiveFirstOption,Z=X.height,Ee=X.itemHeight,Be=X.notFoundContent,Ne=X.open,He=X.menuItemSelectedIcon,ze=X.virtual,Ae=X.onSelect,Ce=X.onToggleOpen,Me=X.onActiveValue,Ue=X.onScroll,Ie=X.onMouseEnter,De="".concat(le,"-item"),Te=Object(b.a)(function(){return we},[Ne,we],function(Re,ue){return ue[0]&&Re[1]!==ue[1]}),rt=M.useRef(null),Qe=function(ue){ue.preventDefault()},Ve=function(ue){rt.current&&rt.current.scrollTo({index:ue})},Xe=function(ue){for(var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,se=Te.length,Y=0;Y<se;Y+=1){var $=(ue+Y*ie+se)%se,J=Te[$],ee=J.group,re=J.data;if(!ee&&!re.disabled)return $}return-1},ut=M.useState(function(){return Xe(0)}),tt=Object(I.a)(ut,2),qe=tt[0],be=tt[1],nt=function(ue){be(ue);var ie=Te[ue];if(!ie){Me(null,-1);return}Me(ie.data.value,ue)};M.useEffect(function(){nt(oe!==!1?Xe(0):-1)},[Te.length,he]),M.useEffect(function(){var Re=setTimeout(function(){if(!fe&&Ne&&ve.size===1){var ue=Array.from(ve)[0],ie=Te.findIndex(function(se){var Y=se.data;return Y.value===ue});nt(ie),Ve(ie)}});return function(){return clearTimeout(Re)}},[Ne]);var Ye=function(ue){ue!==void 0&&Ae(ue,{selected:!ve.has(ue)}),fe||Ce(!1)};if(M.useImperativeHandle(ne,function(){return{onKeyDown:function(ue){var ie=ue.which;switch(ie){case R.a.UP:case R.a.DOWN:{var se=0;if(ie===R.a.UP?se=-1:ie===R.a.DOWN&&(se=1),se!==0){var Y=Xe(qe+se,se);Ve(Y),nt(Y)}break}case R.a.ENTER:{var $=Te[qe];$&&!$.data.disabled?Ye($.data.value):Ye(void 0),Ne&&ue.preventDefault();break}case R.a.ESC:Ce(!1)}},onKeyUp:function(){},scrollTo:function(ue){Ve(ue)}}}),Te.length===0)return M.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(De,"-empty"),onMouseDown:Qe},Be);function xe(Re){var ue=Te[Re];if(!ue)return null;var ie=ue.data||{},se=ie.value,Y=ie.label,$=ie.children,J=Object(O.a)(ie,!0),ee=ge?$:Y;return ue?M.createElement("div",Object.assign({"aria-label":typeof ee=="string"?ee:null},J,{key:Re,role:"option",id:"".concat(de,"_list_").concat(Re),"aria-selected":ve.has(se)}),se):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},xe(qe-1),xe(qe),xe(qe+1)),M.createElement(S.a,{itemKey:"key",ref:rt,data:Te,height:Z,itemHeight:Ee,fullHeight:!1,onMouseDown:Qe,onScroll:Ue,virtual:ze,onMouseEnter:Ie},function(Re,ue){var ie,se=Re.group,Y=Re.groupOption,$=Re.data,J=$.label,ee=$.key;if(se)return M.createElement("div",{className:L()(De,"".concat(De,"-group"))},J!==void 0?J:ee);var re=$.disabled,ye=$.value,_e=$.title,je=$.children,Ke=$.style,st=$.className,Dt=Object(F.a)($,["disabled","value","title","children","style","className"]),Ge=ve.has(ye),lt="".concat(De,"-option"),Ct=L()(De,lt,st,(ie={},Object(P.a)(ie,"".concat(lt,"-grouped"),Y),Object(P.a)(ie,"".concat(lt,"-active"),qe===ue&&!re),Object(P.a)(ie,"".concat(lt,"-disabled"),re),Object(P.a)(ie,"".concat(lt,"-selected"),Ge),ie)),ht=ge?je:J,Lt=!He||typeof He=="function"||Ge;return M.createElement("div",Object.assign({},Dt,{"aria-selected":Ge,className:Ct,title:_e,onMouseMove:function(){if(qe===ue||re)return;nt(ue)},onClick:function(){re||Ye(ye)},style:Ke}),M.createElement("div",{className:"".concat(lt,"-content")},ht||ye),M.isValidElement(He)||Ge,Lt&&M.createElement(w.a,{className:"".concat(De,"-option-state"),customizeIcon:He,customizeIconProps:{isSelected:Ge}},Ge?"\u2713":null))}))},c=M.forwardRef(T);c.displayName="OptionList";var o=c,d=function(){return null};d.isSelectOption=!0;var u=d,x=function(){return null};x.isSelectOptGroup=!0;var g=x,m=Q("VTBJ"),l=Q("Zm9Q");function y(U){var X=U.key,ne=U.props,le=ne.children,de=ne.value,we=Object(F.a)(ne,["children","value"]);return Object(m.a)({key:X,value:de!==void 0?de:X,children:le},we)}function f(U){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(l.a)(U).map(function(ne,le){if(!M.isValidElement(ne)||!ne.type)return null;var de=ne.type.isSelectOptGroup,we=ne.key,ge=ne.props,ve=ge.children,he=Object(F.a)(ge,["children"]);return X||!de?y(ne):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(we===null?le:we,"__"),label:we},he),{},{options:f(ve)})}).filter(function(ne){return ne})}var h=Q("2Qr1"),s=Q("qNPg"),a=Q("U8pU"),v=Q("Kwbf"),p=Q("WKfj");function E(U){var X=U.mode,ne=U.options,le=U.children,de=U.backfill,we=U.allowClear,ge=U.placeholder,ve=U.getInputElement,he=U.showSearch,fe=U.onSearch,oe=U.defaultOpen,Z=U.autoFocus,Ee=U.labelInValue,Be=U.value,Ne=U.inputValue,He=U.optionLabelProp,ze=X==="multiple"||X==="tags",Ae=he!==void 0?he:ze||X==="combobox",Ce=ne||f(le);if(Object(v.a)(X!=="tags"||Ce.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Me=Ce.some(function(De){return De.options?De.options.some(function(Te){return typeof("value"in Te?Te.value:Te.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(v.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(X!=="combobox"||!He,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(X==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(v.a)(X==="combobox"||!ve,"`getInputElement` only work with `combobox` mode."),Object(v.b)(X!=="combobox"||!ve||!we||!ge,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!Ae&&X!=="combobox"&&X!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!oe||Z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Be!=null){var Ue=Object(p.d)(Be);Object(v.a)(!Ee||Ue.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!ze||Array.isArray(Be),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var Ie=null;Object(l.a)(le).some(function(De){if(!M.isValidElement(De)||!De.type)return!1;var Te=De.type;if(Te.isSelectOption)return!1;if(Te.isSelectOptGroup){var rt=Object(l.a)(De.props.children).every(function(Qe){return!M.isValidElement(Qe)||!De.type||Qe.type.isSelectOption?!0:(Ie=Qe.type,!1)});return!rt}return Ie=Te,!0}),Ie&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(v.a)(Ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=E,N=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:D,fillOptionsWithMissingValue:h.a}),W=function(U){Object(A.a)(ne,U);var X=Object(H.a)(ne);function ne(){var le;return Object(q.a)(this,ne),le=X.apply(this,arguments),le.selectRef=M.createRef(),le.focus=function(){le.selectRef.current.focus()},le.blur=function(){le.selectRef.current.blur()},le}return Object(G.a)(ne,[{key:"render",value:function(){return M.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),ne}(M.Component);W.Option=u,W.OptGroup=g;var z=W,B=it.c=z},M8RZ:function(yt,it,Q){"use strict";Q.d(it,"a",function(){return R});var q=Q("fWQN"),G=Q("mtLc"),A=Q("yKVA"),H=Q("879j"),M=Q("cDcd"),P=Q.n(M),F=Q("faye"),I=Q.n(F),R=function(O){Object(A.a)(C,O);var b=Object(H.a)(C);function C(L){var S;Object(q.a)(this,C),S=b.call(this,L);var w=window.document;return S.node=w.createElement("div"),w.body.appendChild(S.node),S}return Object(G.a)(C,[{key:"render",value:function(){var S=this.props.children;return Object(F.createPortal)(S,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),C}(P.a.Component)},O2Wb:function(yt,it,Q){yt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(yt,it,Q){"use strict";var q=Q("U8pU"),G=Q("VTBJ"),A=Q("Ff2n"),H=Q("cDcd"),M=Q("uciX"),P=Q("7ixt"),F=function(L){var S=L.overlay,w=L.prefixCls,T=L.id,c=L.overlayInnerStyle;return H.createElement("div",{className:"".concat(w,"-inner"),id:T,role:"tooltip",style:c},typeof S=="function"?S():S)},I=F,R=function(L,S){var w=L.overlayClassName,T=L.trigger,c=T===void 0?["hover"]:T,o=L.mouseEnterDelay,d=o===void 0?0:o,u=L.mouseLeaveDelay,x=u===void 0?.1:u,g=L.overlayStyle,m=L.prefixCls,l=m===void 0?"rc-tooltip":m,y=L.children,f=L.onVisibleChange,h=L.afterVisibleChange,s=L.transitionName,a=L.animation,v=L.placement,p=v===void 0?"right":v,E=L.align,D=E===void 0?{}:E,N=L.destroyTooltipOnHide,W=N===void 0?!1:N,z=L.defaultVisible,B=L.getTooltipContainer,U=L.overlayInnerStyle,X=Object(A.a)(L,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ne=Object(H.useRef)(null);Object(H.useImperativeHandle)(S,function(){return ne.current});var le=Object(G.a)({},X);"visible"in L&&(le.popupVisible=L.visible);var de=function(){var fe=L.arrowContent,oe=fe===void 0?null:fe,Z=L.overlay,Ee=L.id;return[H.createElement("div",{className:"".concat(l,"-arrow"),key:"arrow"},oe),H.createElement(I,{key:"content",prefixCls:l,id:Ee,overlay:Z,overlayInnerStyle:U})]},we=!1,ge=!1;if(typeof W=="boolean")we=W;else if(W&&Object(q.a)(W)==="object"){var ve=W.keepParent;we=ve===!0,ge=ve===!1}return H.createElement(M.a,Object.assign({popupClassName:w,prefixCls:l,popup:de,action:c,builtinPlacements:P.a,popupPlacement:p,ref:ne,popupAlign:D,getPopupContainer:B,onPopupVisibleChange:f,afterPopupVisibleChange:h,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:z,destroyPopupOnHide:we,autoDestroy:ge,mouseLeaveDelay:x,popupStyle:g,mouseEnterDelay:d},le),y)},O=Object(H.forwardRef)(R),b=it.a=O},Ot1p:function(yt,it,Q){"use strict";var q=Q("2qtc"),G=Q("kLXV"),A=Q("rAM+"),H=Q("miYZ"),M=Q("tsqr"),P=Q("9og8"),F=Q("tJVT"),I=Q("jrin"),R=Q("WmNS"),O=Q.n(R),b=Q("cDcd"),C=Q.n(b),L=Q("VrN/"),S=Q.n(L),w=Q("bdgK"),T=Q("p77/"),c=Q("Bd2K"),o=Q("ELLl"),d=Q("19Vz"),u=Q("lZu9"),x=Q("+NIl"),g=Q("kSUc"),m=Q("9Bee"),l=function(re){var ye=re.value,_e=ye===void 0?"":ye,je=re.className,Ke=re.showTextOnly,st=re.showLines,Dt=re.style,Ge=Dt===void 0?{}:Dt,lt=Object(b.useMemo)(function(){return""},[_e]);return C.a.createElement(C.a.Fragment,null,C.a.createElement("div",{dangerouslySetInnerHTML:{__html:lt}}))},y=Q("0Owb"),f=Q("dejd"),h=Q("C+DQ"),s=Q("1vsH"),a=Q("m3rI"),v=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function p(re){var ye=re.onActionCallback,_e=re.title,je=re.icon,Ke=re.actionName,st=re.className,Dt=st===void 0?"":st,Ge=re.children;function lt(){ye(Ke)}return C.a.createElement("a",{title:_e,className:Dt,onClick:lt},C.a.createElement("i",{className:"md-iconfont ".concat(je)}),Ge)}var E=function(re){var ye=re.watch,_e=re.showNullButton,je=re.onActionCallback,Ke=re.fullScreen,st=re.insertTemp,Dt=re.hidetoolBar,Ge=re.uuid,lt=re.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.G)("_educoder_session"),"&key=").concat(Ge,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(v,[{title:"".concat(ye?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ye?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return C.a.createElement("ul",{className:"markdown-toolbar-container"},!Dt&&Ct.map(function(ht,Lt){return C.a.createElement("li",{key:Lt},ht.actionName?C.a.createElement(p,Object(y.a)({},ht,{onActionCallback:je})):C.a.createElement("span",{className:"v-line"}))}),_e?C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:je},C.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,st&&C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(st),onActionCallback:je},C.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),C.a.createElement("li",{className:"btn-full-screen"},C.a.createElement(p,{icon:"".concat(Ke?"icon-shrink":"icon-enlarge"),title:Ke?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:je})))},D=Q("M8RZ"),N=Q("+L6B"),W=Q("2/Rp"),z=Q("y8nQ"),B=Q("Vl3Y"),U=Q("5NDa"),X=Q("5rEg"),ne={labelCol:{span:4},wrapperCol:{span:20}},le=function(re){var ye=re.callback,_e=re.onCancel;function je(Ke){ye(Ke)}return C.a.createElement(B.a,Object(y.a)({},ne,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:je}),C.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},C.a.createElement(X.a,null)),C.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},C.a.createElement(X.a,null)),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(W.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},de=Q("7ahc"),we=Q("HmJG"),ge=Q("BjJ7"),ve=B.a.useForm,he={width:280,marginRight:10},fe={labelCol:{span:5},wrapperCol:{span:19}},oe=function(re){var ye=re.callback,_e=re.onCancel,je=ve(),Ke=Object(F.a)(je,1),st=Ke[0];function Dt(Ct){ye(Ct)}function Ge(Ct,ht){if(Ct.status===-1){M.b.error(Ct.message);return}st.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:ht.type})}function lt(Ct){var ht=Ct.target.files[0];Ee(ht,Ge)}return C.a.createElement(B.a,Object(y.a)({form:st},fe,{className:"upload-image-panel",onFinish:Dt}),C.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},C.a.createElement("div",{className:"flex-container"},C.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},C.a.createElement(X.a,{style:he})),C.a.createElement(Z,{onFileChange:lt}))),C.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},C.a.createElement(X.a,{style:{width:264}})),C.a.createElement(B.a.Item,{style:{textAlign:"right"}},C.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(W.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))};function Z(re){var ye=re.onFileChange;return C.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",C.a.createElement("input",{type:"file",onChange:ye}))}function Ee(re,ye){if(!re)throw new String("\u6CA1\u6709\u6587\u4EF6");var _e=new FormData;_e.append("editormd-image-file",re),_e.append("file_param_name","editormd-image-file"),_e.append("byxhr","true");var je=new window.XMLHttpRequest;je.withCredentials=!0,je.addEventListener("load",function(Ke){ye(JSON.parse(Ke.target.responseText),re)},!1),je.addEventListener("error",function(Ke){console.error(Ke)},!1),je.open("POST","".concat(ge.a,"/api/attachments.json")),je.send(_e)}var Be=Q("giR+"),Ne=Q("fyUT"),He=Q("7Kak"),ze=Q("9yH6"),Ae=ze.a.Group,Ce={margin:"0 8px"},Me=function(re){var ye=re.callback,_e=re.onCancel;function je(Ke){ye(Ke)}return C.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:je},C.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},C.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),C.a.createElement("span",{style:Ce},"\u884C\u6570"),C.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},C.a.createElement(Ne.a,null)),C.a.createElement("span",{style:Ce},"\u5217\u6570"),C.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},C.a.createElement(Ne.a,null))),C.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},C.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),C.a.createElement(B.a.Item,{name:"align"},C.a.createElement(Ae,null,C.a.createElement(ze.a,{value:"default"},C.a.createElement("i",{className:"fa fa-align-justify"})),C.a.createElement(ze.a,{value:"left"},C.a.createElement("i",{className:"fa fa-align-left"})),C.a.createElement(ze.a,{value:"center"},C.a.createElement("i",{className:"fa fa-align-center"})),C.a.createElement(ze.a,{value:"right"},C.a.createElement("i",{className:"fa fa-align-right"}))))),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(W.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},Ue=Q("ErOA"),Ie=Q("7Cbv"),De="link",Te="upload-image",rt="code-block",Qe="add-table",Ve="------------",Xe={default:Ve,left:":".concat(Ve),center:":".concat(Ve,":"),right:"".concat(Ve,":")},ut=Q("9VGf"),tt,qe;function be(){}var nt=0,Ye=1e4,xe="\u2581",Re=`
|
|
**\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 ue(re){return/^\d+$/.test(re)?"".concat(re,"px"):re}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0,se=ie?"Cmd":"Ctrl",Y=["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"],$=(tt={},Object(I.a)(tt,se+"-B","bold"),Object(I.a)(tt,se+"-I","italic"),tt),J=(qe={},Object(I.a)(qe,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(qe,rt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(qe,Te,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(qe,Qe,"\u6DFB\u52A0\u8868\u683C"),qe),ee=it.a=function(re){var ye=re.defaultValue,_e=ye===void 0?"":ye,je=re.onChange,Ke=re.width,st=Ke===void 0?"100%":Ke,Dt=re.height,Ge=Dt===void 0?400:Dt,lt=re.miniToolbar,Ct=lt===void 0?!1:lt,ht=re.isFocus,Lt=ht===void 0?!1:ht,Gt=re.watch,bt=re.insertTemp,zt=re.mode,Wt=zt===void 0?"markdown":zt,Bt=re.id,kt=Bt===void 0?"markdown-editor-id":Bt,Pt=re.showResizeBar,jt=Pt===void 0?!1:Pt,At=re.noStorage,Tt=At===void 0?!1:At,mt=re.showNullButton,et=mt===void 0?!1:mt,Oe=re.hidetoolBar,Xt=Oe===void 0?!1:Oe,Ut=re.fullScreen,Ht=Ut===void 0?!1:Ut,Ot=re.onBlur,pr=re.onCMBeforeChange,Vt=re.onFullScreen,Et=re.className,Le=Et===void 0?"":Et,dt=re.disablePaste,Ar=dt===void 0?!1:dt,an=re.placeholder,on=an===void 0?"":an,ar=re.values,Mt=ar===void 0?"":ar,pt=Object(b.useState)(null),nr=Object(F.a)(pt,2),ke=nr[0],ur=nr[1],Tr=Object(b.useState)(_e),sn=Object(F.a)(Tr,2),hn=sn[0],Gr=sn[1],Ln=Object(b.useState)(Gt),Dn=Object(F.a)(Ln,2),zr=Dn[0],ln=Dn[1],Rn=Object(b.useState)(Ht),yn=Object(F.a)(Rn,2),Vr=yn[0],Kn=yn[1],Ni=Object(b.useState)(""),On=Object(F.a)(Ni,2),yr=On[0],Ze=On[1],me=Object(b.useState)(0),Fe=Object(F.a)(me,2),gt=Fe[0],at=Fe[1],ct=Object(b.useState)(Ge),St=Object(F.a)(ct,2),er=St[0],tr=St[1],or=Object(b.useState)(!1),Lr=Object(F.a)(or,2),dr=Lr[0],Pr=Lr[1],fr=Object(b.useRef)(Object(Ie.a)()),Zr=Object(b.useRef)(!1),Sr=Object(b.useRef)(),sr=Object(b.useRef)(),Xr=Object(b.useRef)(),Yr=Object(b.useRef)(),Gn=Object(b.useRef)(),Fi=function(){var vt=Object(P.a)(O.a.mark(function Rt(){var _t,Nt;return O.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:fr.current}});case 2:Nt=Zt.sent,Nt!=null&&(_t=Nt.attachments)!==null&&_t!==void 0&&_t.length&&(console.log("cm:",ke,sr),Nt.attachments.map(function(Kt){Kt.content_type.indexOf("image")>-1?ke.replaceSelection(".concat(Kt.content_type,")")):Kt.content_type.indexOf("video")>-1?ke.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Kt.content_type.indexOf("pdf")>-1?ke.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,'&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):ke.replaceSelection("[".concat(Kt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}));case 4:case"end":return Zt.stop()}},Rt)}));return function(){return vt.apply(this,arguments)}}();Object(b.useEffect)(function(){Gr(Mt),ke==null||ke.setValue(Mt)},[Mt]),Object(b.useEffect)(function(){Vt==null||Vt(Vr)},[Vr]),Object(b.useEffect)(function(){if(sr.current){var vt=S.a.fromTextArea(sr.current,{mode:Wt,lineNumbers:!Ct,lineWrapping:!0,value:_e,autoCloseTags:!0,autoCloseBrackets:!0});Lt&&vt.focus();function Rt(_t,Nt){if(Ar){Nt.preventDefault();return}var Yt=Nt.clipboardData;if(Yt){var Zt=Yt.types.toString(),Kt=Yt.items;if(Zt==="Files"||Yt.types.indexOf("Files")>-1){if(Nt.preventDefault(),Wt=="stex")return;try{var gr,Ir=Kt[1];((gr=Kt[0])===null||gr===void 0?void 0:gr.kind)==="file"&&(Ir=Kt[0]);var Ft=Ir.getAsFile(),mn=Ft.name.split(".").pop();Ee(Ft,function($t){if($t.id){var Ur,Dr,qr;(Ft==null||((Ur=Ft.type)===null||Ur===void 0)?void 0:Ur.indexOf("image"))>-1?vt.replaceSelection(".concat($t.content_type,")")):(Ft==null||((Dr=Ft.type)===null||Dr===void 0)?void 0:Dr.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,'"></video>')):(Ft==null||((qr=Ft.type)===null||qr===void 0)?void 0:qr.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):Y.includes(mn)?vt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):vt.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat($t.content_type,")"))}else($t==null?void 0:$t.status)===401&&(document.location.href="/user/login")})}catch($t){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return vt.on("paste",Rt),vt.on("dragleave",function(_t,Nt){Xr.current.classList.remove("mouse-hover-md")}),vt.on("dragover",function(_t,Nt){Xr.current.classList.add("mouse-hover-md")}),vt.on("drop",function(_t,Nt){Xr.current.classList.add("mouse-hover-md");var Yt;if(Yt=Nt.dataTransfer.files,Yt.length>0){Nt.preventDefault(),Nt.stopPropagation();for(var Zt=function(Ir){var Ft=Yt[Ir],mn=Ft.name.split(".").pop();Ee(Ft,function($t){if($t.id){var Ur,Dr,qr;(Ft==null||((Ur=Ft.type)===null||Ur===void 0)?void 0:Ur.indexOf("image"))>-1?vt.replaceSelection(".concat($t.content_type,")")):(Ft==null||((Dr=Ft.type)===null||Dr===void 0)?void 0:Dr.indexOf("video"))>-1?vt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,'"></video>')):(Ft==null||((qr=Ft.type)===null||qr===void 0)?void 0:qr.indexOf("pdf"))>-1?vt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):Y.includes(mn)?vt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):vt.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat($t.id,"?type=").concat($t.content_type,")"))}else($t==null?void 0:$t.status)===401&&(document.location.href="/user/login")})},Kt=0;Kt<Yt.length;Kt++)Zt(Kt)}}),ur(vt),function(){vt.off("paste",Rt)}}},[]);var $r=Object(b.useCallback)(function(){if(Xr.current)try{}catch(vt){console.log(vt,"---- to set md editor body height")}},[er,Xr,Vr]);Object(b.useEffect)(function(){function vt(){var _t=new w.default(function(Nt){var Yt=Object(A.a)(Nt),Zt;try{for(Yt.s();!(Zt=Yt.n()).done;){var Kt=Zt.value;(Kt.target.offsetHeight>0||Kt.target.offsetWidth>0)&&($r(),ke.setSize("100%","100%"),ke.refresh())}}catch(gr){Yt.e(gr)}finally{Yt.f()}});return _t.observe(sr.current.parentElement),_t}if(ke){var Rt=vt();return function(){Rt.unobserve(sr.current.parentElement)}}},[ke,$r]),Object(b.useEffect)(function(){if(ke){for(var vt=[],Rt=function(){var Kt=Nt[_t];Yt=Object(F.a)(Kt,2);var gr=Yt[0],Ir=Yt[1],Ft=Object(I.a)({},gr,function(){Bi(Ir)});vt.push(Ft),ke.addKeyMap(Ft)},_t=0,Nt=Object.entries($);_t<Nt.length;_t++){var Yt;Rt()}return Sr.current=setInterval(function(){Zr.current&&Fi()},4e3),function(){clearInterval(Sr.current);var Zt=Object(A.a)(vt),Kt;try{for(Zt.s();!(Kt=Zt.n()).done;){var gr=Kt.value;ke.removeKeyMap(gr)}}catch(Ir){Zt.e(Ir)}finally{Zt.f()}}}},[ke]),Object(b.useEffect)(function(){Ht!==Vr&&Kn(Ht)},[Ht]),Object(ut.a)(function(){if(!Tt&>>0){var vt=new Date().getTime(),Rt=window.sessionStorage.getItem(kt);vt>=gt+Ye&&(!Rt||Rt!==hn)&&(window.sessionStorage.setItem(kt,hn),Pr(!0))}},Ye),Object(b.useEffect)(function(){ln(Gt)},[ke,Gt]),Object(b.useEffect)(function(){ke&&(Lt&&ke.focus())},[ke,Lt]),Object(b.useEffect)(function(){if(zr&&ke){var vt=ke.getScrollerElement();function Rt(_t){var Nt=_t.target;if(Gn.current){var Yt=Nt.scrollTop/Nt.scrollHeight;Gn.current.scrollTop=Gn.current.scrollHeight*Yt}}return vt.addEventListener("scroll",Rt),function(){vt.removeEventListener("scroll",Rt)}}},[ke,zr]),Object(b.useEffect)(function(){if(ke&&pr){function vt(Rt,_t){pr(Rt,_t)}return ke.on("beforeChange",vt),function(){ke.off("beforeChange",vt)}}},[ke,pr]),Object(b.useEffect)(function(){if(ke&&Ot){function vt(){Ot(ke.getValue())}return ke.on("blur",vt),function(){ke.off("blur",vt)}}},[ke,Ot]),Object(b.useEffect)(function(){if(ke){function vt(Rt){var _t=Rt.getValue();Gr(_t),at(new Date().getTime()),Rt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),je&&je(_t)}return ke.on("change",vt),function(){ke.off("change",vt)}}},[ke,je]),Object(b.useEffect)(function(){ke&&(_e==null?(ke.setValue(""),Gr("")):_e!==ke.getValue()&&(ke.setValue(_e),Gr(_e),ke.setCursor(ke.lineCount(),0)))},[ke,_e]);var Bi=Object(b.useCallback)(function(vt){var Rt=ke.getCursor(),_t=ke.getSelection(),Nt=_t.split(`
|
|
`);switch(vt){case"bold":return ke.replaceSelection("**"+_t+"**"),_t===""&&ke.setCursor(Rt.line,Rt.ch+2),ke.focus();case"italic":return ke.replaceSelection("*"+_t+"*"),_t===""&&ke.setCursor(Rt.line,Rt.ch+1),ke.focus();case"code":return ke.replaceSelection("`"+_t+"`"),_t===""&&ke.setCursor(Rt.line,Rt.ch+1),ke.focus();case"inline-latex":return ke.replaceSelection("`$$"+_t+"$$`"),_t===""&&ke.setCursor(Rt.line,Rt.ch+3),ke.focus();case"latex":return ke.replaceSelection("```latex\n"+_t+"\n```"),ke.setCursor(Rt.line+1,_t.length+1),ke.focus();case"line-break":return ke.replaceSelection(`<br/>
|
|
`),ke.focus();case"list-ul":return _t===""?ke.replaceSelection("- "+_t):ke.replaceSelection(Nt.map(function(Yt){return Yt===""?"":"- ".concat(Yt)}).join(`
|
|
`)),ke.focus();case"list-ol":return _t===""?ke.replaceSelection("1. "+_t):ke.replaceSelection(Nt.map(function(Yt,Zt){return Yt===""?"":"".concat(Zt+1,". ").concat(Yt)}).join(`
|
|
`)),ke.focus();case"add-null-ch":return _t===""&&ke.setCursor(Rt.line,Rt.ch+1),ke.replaceSelection(xe),ke.focus();case"inster-template-1":return _t===""&&ke.setCursor(Rt.line,Rt.ch),ke.replaceSelection(Re),ke.focus();case"eraser":return ke.setValue(""),ke.focus();case"trigger-watch":return ln(!zr),ke.focus();case"trigger-full-screen":return Kn(!Vr),ke.focus();case De:Ze(De);return;case rt:Ze(rt);return;case Te:Ze(Te);return;case Qe:Ze(Qe);return;default:throw new Error}},[ke,zr,Vr]),zn=Object(b.useCallback)(function(vt){Ze("");switch(yr){case De:var Rt=vt.title,_t=vt.link;return ke.replaceSelection("[".concat(Rt,"](").concat(_t,")")),ke.focus();case rt:var Nt=vt.language,Yt=vt.content;return ke.replaceSelection(["```"+Nt,Yt,"```"].join(`
|
|
`)),ke.focus();case Te:var Zt=vt.src,Kt=vt.alt;return Kt?ke.replaceSelection(".concat(Zt,' "').concat(Kt,'" )')):ke.replaceSelection("")),ke.focus();case Qe:for(var gr=vt.row,Ir=vt.col,Ft=vt.align,mn=`
|
|
`,$t=0;$t<gr;$t++){for(var Ur=[],Dr=[],qr=0;qr<Ir;qr++)$t===1&&Dr.push(Xe[Ft]),Ur.push(" ");$t===1&&(mn+="| ".concat(Dr.join(" | "),` |
|
|
`)),mn+="| ".concat(Ur.join(Ir===1?"":" | "),` |
|
|
`)}return ke.replaceSelection(mn+`
|
|
`),ke.focus();default:throw new Error}},[ke,yr]),ui=Object(b.useMemo)(function(){switch(yr){case De:return C.a.createElement(le,{callback:zn,onCancel:En});case rt:return C.a.createElement(de.b,{callback:zn,onCancel:En});case Te:return C.a.createElement(oe,{callback:zn,onCancel:En});case Qe:return C.a.createElement(Me,{callback:zn,onCancel:En});default:return null}},[yr]);function En(){Ze("")}Object(b.useEffect)(function(){if(Yr.current){var vt=Yr.current,Rt=!1,_t=0;function Nt(Kt){Rt=!0,_t=Kt.pageY}function Yt(){Rt=!1}function Zt(Kt){if(Rt){var gr=Kt.pageY-_t;gr<0&&(gr=0),gr>300&&(gr=300);var Ir=Ge+gr+"px";tr(Ir)}}return vt.addEventListener("mousedown",Nt),document.addEventListener("mousemove",Zt),document.addEventListener("mouseup",Yt),function(){vt.removeEventListener("mousedown",Nt),document.removeEventListener("mousemove",Zt),document.removeEventListener("mouseup",Yt)}}},[ke,Yr]),Object(b.useEffect)(function(){tr(Ge)},[Ge]);var un=ue(st),di=ue(er),en={width:un,height:di},ci=Object(b.useMemo)(function(){if(gt){var vt=new Date(gt),Rt=vt.getHours(),_t=vt.getMinutes(),Nt=vt.getSeconds();return Rt=Rt<10?"0"+Rt:Rt,_t=_t<10?"0"+_t:_t,Nt=Nt<10?"0"+Nt:Nt,"".concat(Rt,":").concat(_t,":").concat(Nt)}return 0},[gt]);function ji(){window.sessionStorage.removeItem(kt),Pr(!1),at(0)}function Pn(){Pr(!1),at(0),ke.setValue(window.sessionStorage.getItem(kt))}function ua(vt,Rt){var _t=ke.getValue();_t=_t.replace(vt,Rt),Gr(_t),ke==null||ke.setValue(_t)}return C.a.createElement(b.Fragment,null,C.a.createElement("div",{className:"markdown-editor-wrapper",ref:Xr},C.a.createElement("div",{className:"markdown-editor-container ".concat(Le," ").concat(zr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(Vr?"full-screen":""),style:en},C.a.createElement(E,{insertTemp:bt,watch:zr,fullScreen:Vr,showNullButton:et,onActionCallback:Bi,hidetoolBar:Xt,uuid:fr.current,setOpenPhones:function(){Zr.current=!0}}),C.a.createElement("div",{className:"markdown-editor-body"},C.a.createElement("div",{className:"codemirror-container"},C.a.createElement("textarea",{ref:sr,placeholder:on})),zr?C.a.createElement("div",{ref:Gn,className:"preview-container"},Wt==="stex"&&C.a.createElement(l,{value:hn}),Wt!=="stex"&&C.a.createElement(m.a,{edit:!0,value:hn,replaces:ua})):null))),jt?C.a.createElement("a",{ref:Yr,className:"editor-resize"}):null,C.a.createElement(D.a,null,J[yr]?C.a.createElement(G.a,{centered:!0,title:J[yr],visible:!0,onCancel:En,footer:null,className:"markdown-popup-form"},ui):null))}},PGNT:function(yt,it,Q){yt.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(yt,it,Q){yt.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},"RZ/O":function(yt,it,Q){yt.exports=Q.p+"static/bi.9c9b0364.svg"},SJMd:function(yt,it){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Q,q,G,A=!1,H,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,F;(function(){var I=window,R=["break,continue,do,else,for,if,return,while"],O=[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"],b=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],C=[b,"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=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],S=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",T=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],d=[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"],x=[C,S,L,T,c,o,d,u],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",l="kwd",y="com",f="typ",h="lit",s="pun",a="pln",v="tag",p="dec",E="src",D="atn",N="atv",W="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Ae){for(var Ce=0,Me=!1,Ue=!1,Ie=0,De=Ae.length;Ie<De;++Ie){var Te=Ae[Ie];if(Te.ignoreCase)Ue=!0;else if(/[a-z]/i.test(Te.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,Ue=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(qe){var be=qe.charCodeAt(0);if(be!==92)return be;var nt=qe.charAt(1);return be=rt[nt],be||("0"<=nt&&nt<="7"?parseInt(qe.substring(1),8):nt==="u"||nt==="x"?parseInt(qe.substring(2),16):qe.charCodeAt(1))}function Ve(qe){if(qe<32)return(qe<16?"\\x0":"\\x")+qe.toString(16);var be=String.fromCharCode(qe);return be==="\\"||be==="-"||be==="]"||be==="^"?"\\"+be:be}function Xe(qe){var be=qe.substring(1,qe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),nt=[],Ye=be[0]==="^",xe=["["];Ye&&xe.push("^");for(var Re=Ye?1:0,ue=be.length;Re<ue;++Re){var ie=be[Re];if(/\\[bdsw]/i.test(ie))xe.push(ie);else{var se=Qe(ie),Y;Re+2<ue&&be[Re+1]==="-"?(Y=Qe(be[Re+2]),Re+=2):Y=se,nt.push([se,Y]),Y<65||se>122||(Y<65||se>90||nt.push([Math.max(65,se)|32,Math.min(Y,90)|32]),Y<97||se>122||nt.push([Math.max(97,se)&~32,Math.min(Y,122)&~32]))}}nt.sort(function(re,ye){return re[0]-ye[0]||ye[1]-re[1]});for(var $=[],J=[],Re=0;Re<nt.length;++Re){var ee=nt[Re];ee[0]<=J[1]+1?J[1]=Math.max(J[1],ee[1]):$.push(J=ee)}for(var Re=0;Re<$.length;++Re){var ee=$[Re];xe.push(Ve(ee[0])),ee[1]>ee[0]&&(ee[1]+1>ee[0]&&xe.push("-"),xe.push(Ve(ee[1])))}return xe.push("]"),xe.join("")}function ut(qe){for(var be=qe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),nt=be.length,Ye=[],xe=0,Re=0;xe<nt;++xe){var ue=be[xe];if(ue==="(")++Re;else if(ue.charAt(0)==="\\"){var ie=+ue.substring(1);ie&&(ie<=Re?Ye[ie]=-1:be[xe]=Ve(ie))}}for(var xe=1;xe<Ye.length;++xe)Ye[xe]===-1&&(Ye[xe]=++Ce);for(var xe=0,Re=0;xe<nt;++xe){var ue=be[xe];if(ue==="(")++Re,Ye[Re]||(be[xe]="(?:");else if(ue.charAt(0)==="\\"){var ie=+ue.substring(1);ie&&ie<=Re&&(be[xe]="\\"+Ye[ie])}}for(var xe=0;xe<nt;++xe)be[xe]==="^"&&be[xe+1]!=="^"&&(be[xe]="");if(qe.ignoreCase&&Me)for(var xe=0;xe<nt;++xe){var ue=be[xe],se=ue.charAt(0);ue.length>=2&&se==="["?be[xe]=Xe(ue):se!=="\\"&&(be[xe]=ue.replace(/[a-zA-Z]/g,function(J){var ee=J.charCodeAt(0);return"["+String.fromCharCode(ee&~32,ee|32)+"]"}))}return be.join("")}for(var tt=[],Ie=0,De=Ae.length;Ie<De;++Ie){var Te=Ae[Ie];if(Te.global||Te.multiline)throw new Error(""+Te);tt.push("(?:"+ut(Te)+")")}return new RegExp(tt.join("|"),Ue?"gi":"g")}function U(Ae,Ce){var Me=/(?:^|\s)nocode(?:\s|$)/,Ue=[],Ie=0,De=[],Te=0;function rt(Qe){var Ve=Qe.nodeType;if(Ve==1){if(Me.test(Qe.className))return;for(var Xe=Qe.firstChild;Xe;Xe=Xe.nextSibling)rt(Xe);var ut=Qe.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(Ue[Te]=`
|
|
`,De[Te<<1]=Ie++,De[Te++<<1|1]=Qe)}else if(Ve==3||Ve==4){var tt=Qe.nodeValue;tt.length&&(Ce?tt=tt.replace(/\r\n?/g,`
|
|
`):tt=tt.replace(/[ \t\r\n]+/g," "),Ue[Te]=tt,De[Te<<1]=Ie,Ie+=tt.length,De[Te++<<1|1]=Qe)}}return rt(Ae),{sourceCode:Ue.join("").replace(/\n$/,""),spans:De}}function X(Ae,Ce,Me,Ue,Ie){if(!Me)return;var De={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:Ce,decorations:null};Ue(De),Ie.push.apply(Ie,De.decorations)}var ne=/\S/;function le(Ae){for(var Ce=void 0,Me=Ae.firstChild;Me;Me=Me.nextSibling){var Ue=Me.nodeType;Ce=Ue===1?Ce?Ae:Me:Ue===3&&ne.test(Me.nodeValue)?Ae:Ce}return Ce===Ae?void 0:Ce}function de(Ae,Ce){var Me={},Ue;(function(){for(var Te=Ae.concat(Ce),rt=[],Qe={},Ve=0,Xe=Te.length;Ve<Xe;++Ve){var ut=Te[Ve],tt=ut[3];if(tt)for(var qe=tt.length;--qe>=0;)Me[tt.charAt(qe)]=ut;var be=ut[1],nt=""+be;Qe.hasOwnProperty(nt)||(rt.push(be),Qe[nt]=null)}rt.push(/[\0-\uffff]/),Ue=B(rt)})();var Ie=Ce.length,De=function(Te){for(var rt=Te.sourceCode,Qe=Te.basePos,Ve=Te.sourceNode,Xe=[Qe,a],ut=0,tt=rt.match(Ue)||[],qe={},be=0,nt=tt.length;be<nt;++be){var Ye=tt[be],xe=qe[Ye],Re=void 0,ue;if(typeof xe=="string")ue=!1;else{var ie=Me[Ye.charAt(0)];if(ie)Re=Ye.match(ie[1]),xe=ie[0];else{for(var se=0;se<Ie;++se)if(ie=Ce[se],Re=Ye.match(ie[1]),Re){xe=ie[0];break}Re||(xe=a)}ue=xe.length>=5&&xe.substring(0,5)==="lang-",ue&&!(Re&&typeof Re[1]=="string")&&(ue=!1,xe=E),ue||(qe[Ye]=xe)}var Y=ut;if(ut+=Ye.length,!ue)Xe.push(Qe+Y,xe);else{var $=Re[1],J=Ye.indexOf($),ee=J+$.length;Re[2]&&(ee=Ye.length-Re[2].length,J=ee-$.length);var re=xe.substring(5);X(Ve,Qe+Y,Ye.substring(0,J),De,Xe),X(Ve,Qe+Y+J,$,Z(re,$),Xe),X(Ve,Qe+Y+ee,Ye.substring(ee),De,Xe)}}Te.decorations=Xe};return De}function we(Ae){var Ce=[],Me=[];Ae.tripleQuotedStrings?Ce.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Ce.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&Me.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ue=Ae.hashComments;Ue&&(Ae.cStyleComments?(Ue>1?Ce.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([y,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(Me.push([y,/^\/\/[^\r\n]*/,null]),Me.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=Ae.regexLiterals;if(Ie){var De=Ie>1?"":`
|
|
\r`,Te=De?".":"[\\S\\s]",rt="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Te+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Te+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+z+"("+rt+")")])}var Qe=Ae.types;Qe&&Me.push([f,Qe]);var Ve=(""+Ae.keywords).replace(/^ | $/g,"");Ve.length&&Me.push([l,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(Xe+="(?!s*/)"),Me.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(Xe),null]),de(Ce,Me)}var ge=we({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ve(Ae,Ce,Me){for(var Ue=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,De=Ae.ownerDocument,Te=De.createElement("li");Ae.firstChild;)Te.appendChild(Ae.firstChild);var rt=[Te];function Qe(be){var nt=be.nodeType;if(nt==1&&!Ue.test(be.className))if(be.nodeName==="br")Ve(be),be.parentNode&&be.parentNode.removeChild(be);else for(var Ye=be.firstChild;Ye;Ye=Ye.nextSibling)Qe(Ye);else if((nt==3||nt==4)&&Me){var xe=be.nodeValue,Re=xe.match(Ie);if(Re){var ue=xe.substring(0,Re.index);be.nodeValue=ue;var ie=xe.substring(Re.index+Re[0].length);if(ie){var se=be.parentNode;se.insertBefore(De.createTextNode(ie),be.nextSibling)}Ve(be),ue||be.parentNode.removeChild(be)}}}function Ve(be){for(;!be.nextSibling;)if(be=be.parentNode,!be)return;function nt(Re,ue){var ie=ue?Re.cloneNode(!1):Re,se=Re.parentNode;if(se){var Y=nt(se,1),$=Re.nextSibling;Y.appendChild(ie);for(var J=$;J;J=$)$=J.nextSibling,Y.appendChild(J)}return ie}for(var Ye=nt(be.nextSibling,0),xe;(xe=Ye.parentNode)&&xe.nodeType===1;)Ye=xe;rt.push(Ye)}for(var Xe=0;Xe<rt.length;++Xe)Qe(rt[Xe]);Ce===(Ce|0)&&rt[0].setAttribute("value",Ce);var ut=De.createElement("ol");ut.className="linenums";for(var tt=Math.max(0,Ce-1|0)||0,Xe=0,qe=rt.length;Xe<qe;++Xe)Te=rt[Xe],Te.className="L"+(Xe+tt)%10,Te.firstChild||Te.appendChild(De.createTextNode("\xA0")),ut.appendChild(Te);Ae.appendChild(ut)}function he(Ae){var Ce=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ce=Ce&&+Ce[1]<=8;var Me=/\n/g,Ue=Ae.sourceCode,Ie=Ue.length,De=0,Te=Ae.spans,rt=Te.length,Qe=0,Ve=Ae.decorations,Xe=Ve.length,ut=0;Ve[Xe]=Ie;var tt,qe;for(qe=tt=0;qe<Xe;)Ve[qe]!==Ve[qe+2]?(Ve[tt++]=Ve[qe++],Ve[tt++]=Ve[qe++]):qe+=2;for(Xe=tt,qe=tt=0;qe<Xe;){for(var be=Ve[qe],nt=Ve[qe+1],Ye=qe+2;Ye+2<=Xe&&Ve[Ye+1]===nt;)Ye+=2;Ve[tt++]=be,Ve[tt++]=nt,qe=Ye}Xe=Ve.length=tt;var xe=Ae.sourceNode,Re="";xe&&(Re=xe.style.display,xe.style.display="none");try{for(var ue=null;Qe<rt;){var ie=Te[Qe],se=Te[Qe+2]||Ie,Y=Ve[ut+2]||Ie,Ye=Math.min(se,Y),$=Te[Qe+1],J;if($.nodeType!==1&&(J=Ue.substring(De,Ye))){Ce&&(J=J.replace(Me,"\r")),$.nodeValue=J;var ee=$.ownerDocument,re=ee.createElement("span");re.className=Ve[ut+1];var ye=$.parentNode;ye.replaceChild(re,$),re.appendChild($),De<se&&(Te[Qe+1]=$=ee.createTextNode(Ue.substring(Ye,se)),ye.insertBefore($,re.nextSibling))}De=Ye,De>=se&&(Qe+=2),De>=Y&&(ut+=2)}}finally{xe&&(xe.style.display=Re)}}var fe={};function oe(Ae,Ce){for(var Me=Ce.length;--Me>=0;){var Ue=Ce[Me];fe.hasOwnProperty(Ue)?I.console&&console.warn("cannot override language handler %s",Ue):fe[Ue]=Ae}}function Z(Ae,Ce){return Ae&&fe.hasOwnProperty(Ae)||(Ae=/^\s*</.test(Ce)?"default-markup":"default-code"),fe[Ae]}oe(ge,["default-code"]),oe(de([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),oe(de([[a,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),oe(de([],[[N,/^[\s\S]+/]]),["uq.val"]),oe(we({keywords:C,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),oe(we({keywords:"null,true,false"}),["json"]),oe(we({keywords:S,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),oe(we({keywords:L,cStyleComments:!0}),["java"]),oe(we({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),oe(we({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),oe(we({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),oe(we({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),oe(we({keywords:T,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),oe(we({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),oe(de([],[[m,/^[\s\S]+/]]),["regex"]);function Ee(Ae){var Ce=Ae.langExtension;try{var Me=U(Ae.sourceNode,Ae.pre),Ue=Me.sourceCode;Ae.sourceCode=Ue,Ae.spans=Me.spans,Ae.basePos=0,Z(Ce,Ue)(Ae),he(Ae)}catch(Ie){I.console&&console.log(Ie&&Ie.stack||Ie)}}function Be(Ae,Ce,Me){var Ue=Me||!1,Ie=Ce||null,De=document.createElement("div");De.innerHTML="<pre>"+Ae+"</pre>",De=De.firstChild,Ue&&ve(De,Ue,!0);var Te={langExtension:Ie,numberLines:Ue,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(Te),De.innerHTML}function Ne(Ae,Ce){var Me=Ce||document.body,Ue=Me.ownerDocument||document;function Ie(ie){return Me.getElementsByTagName(ie)}for(var De=[Ie("pre"),Ie("code"),Ie("xmp")],Te=[],rt=0;rt<De.length;++rt)for(var Qe=0,Ve=De[rt].length;Qe<Ve;++Qe)Te.push(De[rt][Qe]);De=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var ut=0,tt=/\blang(?:uage)?-([\w.]+)(?!\S)/,qe=/\bprettyprint\b/,be=/\bprettyprinted\b/,nt=/pre|xmp/i,Ye=/^code$/i,xe=/^(?:pre|code|xmp)$/i,Re={};function ue(){for(var ie=I.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;ut<Te.length&&Xe.now()<ie;ut++){for(var se=Te[ut],Y=Re,$=se;$=$.previousSibling;){var J=$.nodeType,ee=(J===7||J===8)&&$.nodeValue;if(ee?!/^\??prettify\b/.test(ee):J!==3||/\S/.test($.nodeValue))break;if(ee){Y={},ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Gt,bt,zt){Y[bt]=zt});break}}var re=se.className;if((Y!==Re||qe.test(re))&&!be.test(re)){for(var ye=!1,_e=se.parentNode;_e;_e=_e.parentNode){var je=_e.tagName;if(xe.test(je)&&_e.className&&qe.test(_e.className)){ye=!0;break}}if(!ye){se.className+=" prettyprinted";var Ke=Y.lang;if(!Ke){Ke=re.match(tt);var st;!Ke&&(st=le(se))&&Ye.test(st.tagName)&&(Ke=st.className.match(tt)),Ke&&(Ke=Ke[1])}var Dt;if(nt.test(se.tagName))Dt=1;else{var Ge=se.currentStyle,lt=Ue.defaultView,Ct=Ge?Ge.whiteSpace:lt&<.getComputedStyle?lt.getComputedStyle(se,null).getPropertyValue("white-space"):0;Dt=Ct&&Ct.substring(0,3)==="pre"}var ht=Y.linenums;(ht=ht==="true"||+ht)||(ht=re.match(/\blinenums\b(?::(\d+))?/),ht=ht?ht[1]&&ht[1].length?+ht[1]:!0:!1),ht&&ve(se,ht,Dt);var Lt={langExtension:Ke,sourceNode:se,numberLines:ht,pre:Dt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(Lt)}}}ut<Te.length?I.setTimeout(ue,250):typeof Ae=="function"&&Ae()}ue()}var He=I.PR={createSimpleLexer:de,registerLangHandler:oe,sourceDecorator:we,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:N,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:l,PR_LITERAL:h,PR_NOCODE:W,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:E,PR_STRING:m,PR_TAG:v,PR_TYPE:f,prettyPrintOne:A?I.prettyPrintOne=Be:P=Be,prettyPrint:F=A?I.prettyPrint=Ne:F=Ne},ze=I.define;typeof ze=="function"&&ze.amd&&ze("google-code-prettify",[],function(){return He})})()},"VrN/":function(yt,it,Q){(function(q,G){yt.exports=G()})(this,function(){"use strict";var q=navigator.userAgent,G=navigator.platform,A=/gecko\/\d/i.test(q),H=/MSIE \d/.test(q),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),P=/Edge\/(\d+)/.exec(q),F=H||M||P,I=F&&(H?document.documentMode||6:+(P||M)[1]),R=!P&&/WebKit\//.test(q),O=R&&/Qt\/\d+\.\d+/.test(q),b=!P&&/Chrome\//.test(q),C=/Opera\//.test(q),L=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),w=/PhantomJS/.test(q),T=!P&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),c=/Android/.test(q),o=T||c||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),d=T||/Mac/.test(G),u=/\bCrOS\b/.test(q),x=/win/i.test(G),g=C&&q.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(C=!1,R=!0);var m=d&&(O||C&&(g==null||g<12.11)),l=A||F&&I>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=y(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return h(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var _=0;_<t.length;++_)i.appendChild(t[_]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function N(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function W(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var z=function(e){e.select()};T?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(z=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function U(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 X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,k=i||0;;){var j=e.indexOf(" ",_);if(j<0||j>=t)return k+(t-_);k+=j-_,k+=n-k%n,_=j+1}}var ne=function(){this.id=null,this.f=null,this.time=0,this.handler=B(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 le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var de=50,we={toString:function(){return"CodeMirror.Pass"}},ge={scroll:!1},ve={origin:"*mouse"},he={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var k=_-r;if(_==e.length||i+k>=t)return r+Math.min(k,t-i);if(i+=_-r,i+=n-i%n,r=_+1,i>=t)return r}}var oe=[""];function Z(e){for(;oe.length<=e;)oe.push(Ee(oe)+" ");return oe[e]}function Ee(e){return e[e.length-1]}function Be(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ne(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function He(){}function ze(e,t){var n;return Object.create?n=Object.create(e):(He.prototype=e,n=new He),t&&U(t,n),n}var Ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ce(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Ce(e)?!0:t.test(e):Ce(e)}function Ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\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 De(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Te(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function rt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,_=r<0?Math.ceil(i):Math.floor(i);if(_==t)return e(_)?t:n;e(_)?n=_:t=_+r}}function Qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,_=0;_<e.length;++_){var k=e[_];(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",_),i=!0)}i||r(t,n,"ltr")}var Ve=null;function Xe(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var _=e[i];if(_.from<t&&_.to>t)return i;_.to==t&&(_.from!=_.to&&n=="before"?r=i:Ve=i),_.from==t&&(_.from!=_.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var ut=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]/,_=/[LRr]/,k=/[Lb1n]/,j=/[1n]/;function K(V,te,ae){this.level=V,this.from=te,this.to=ae}return function(V,te){var ae=te=="ltr"?"L":"R";if(V.length==0||te=="ltr"&&!r.test(V))return!1;for(var pe=V.length,ce=[],Se=0;Se<pe;++Se)ce.push(n(V.charCodeAt(Se)));for(var Pe=0,We=ae;Pe<pe;++Pe){var $e=ce[Pe];$e=="m"?ce[Pe]=We:We=$e}for(var ot=0,Je=ae;ot<pe;++ot){var ft=ce[ot];ft=="1"&&Je=="r"?ce[ot]="n":_.test(ft)&&(Je=ft,ft=="r"&&(ce[ot]="R"))}for(var wt=1,xt=ce[0];wt<pe-1;++wt){var It=ce[wt];It=="+"&&xt=="1"&&ce[wt+1]=="1"?ce[wt]="1":It==","&&xt==ce[wt+1]&&(xt=="1"||xt=="n")&&(ce[wt]=xt),xt=It}for(var qt=0;qt<pe;++qt){var xr=ce[qt];if(xr==",")ce[qt]="N";else if(xr=="%"){var ir=void 0;for(ir=qt+1;ir<pe&&ce[ir]=="%";++ir);for(var Kr=qt&&ce[qt-1]=="!"||ir<pe&&ce[ir]=="1"?"1":"N",Br=qt;Br<ir;++Br)ce[Br]=Kr;qt=ir-1}}for(var hr=0,jr=ae;hr<pe;++hr){var Cr=ce[hr];jr=="L"&&Cr=="1"?ce[hr]="L":_.test(Cr)&&(jr=Cr)}for(var vr=0;vr<pe;++vr)if(i.test(ce[vr])){var mr=void 0;for(mr=vr+1;mr<pe&&i.test(ce[mr]);++mr);for(var lr=(vr?ce[vr-1]:ae)=="L",Wr=(mr<pe?ce[mr]:ae)=="L",si=lr==Wr?lr?"L":"R":ae,An=vr;An<mr;++An)ce[An]=si;vr=mr-1}for(var Or=[],fn,_r=0;_r<pe;)if(k.test(ce[_r])){var Va=_r;for(++_r;_r<pe&&k.test(ce[_r]);++_r);Or.push(new K(0,Va,_r))}else{var vn=_r,Wn=Or.length,Hn=te=="rtl"?1:0;for(++_r;_r<pe&&ce[_r]!="L";++_r);for(var kr=vn;kr<_r;)if(j.test(ce[kr])){vn<kr&&(Or.splice(Wn,0,new K(1,vn,kr)),Wn+=Hn);var li=kr;for(++kr;kr<_r&&j.test(ce[kr]);++kr);Or.splice(Wn,0,new K(2,li,kr)),Wn+=Hn,vn=kr}else++kr;vn<_r&&Or.splice(Wn,0,new K(1,vn,_r))}return te=="ltr"&&(Or[0].level==1&&(fn=V.match(/^\s+/))&&(Or[0].from=fn[0].length,Or.unshift(new K(0,0,fn[0].length))),Ee(Or).level==1&&(fn=V.match(/\s+$/))&&(Ee(Or).to-=fn[0].length,Or.push(new K(0,pe-fn[0].length,pe)))),te=="rtl"?Or.reverse():Or}}();function tt(e,t){var n=e.order;return n==null&&(n=e.order=ut(e.text,t)),n}var qe=[],be=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||qe).concat(n)}};function nt(e,t){return e._handlers&&e._handlers[t]||qe}function Ye(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var _=le(i,n);_>-1&&(r[t]=i.slice(0,_).concat(i.slice(_+1)))}}}function xe(e,t){var n=nt(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 Re(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function ue(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)le(n,t[r])==-1&&n.push(t[r])}function ie(e,t){return nt(e,t).length>0}function se(e){e.prototype.on=function(t,n){be(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ee(e){Y(e),$(e)}function re(e){return e.target||e.srcElement}function ye(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),d&&e.ctrlKey&&t==1&&(t=3),t}var _e=function(){if(F&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),je;function Ke(e){if(je==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(je=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&I<8))}var n=je?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var st;function Dt(e){if(st!=null)return st;var t=s(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:st=r.right-n.right<3}var Ge=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var _=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),k=_.indexOf("\r");k!=-1?(n.push(_.slice(0,k)),t+=k+1):(n.push(_),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},lt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ht=null;function Lt(e){if(ht!=null)return ht;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return ht=Math.abs(n.left-r.left)>1}var Gt={},bt={};function zt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Gt[e]=t}function Wt(e,t){bt[e]=t}function Bt(e){if(typeof e=="string"&&bt.hasOwnProperty(e))e=bt[e];else if(e&&typeof e.name=="string"&&bt.hasOwnProperty(e.name)){var t=bt[e.name];typeof t=="string"&&(t={name:t}),e=ze(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function kt(e,t){t=Bt(t);var n=Gt[t.name];if(!n)return kt(e,"text/plain");var r=n(e,t);if(Pt.hasOwnProperty(t.name)){var i=Pt[t.name];for(var _ in i){if(!i.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=i[_]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var k in t.modeProps)r[k]=t.modeProps[k];return r}var Pt={};function jt(e,t){var n=Pt.hasOwnProperty(e)?Pt[e]:Pt[e]={};U(t,n)}function At(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 Tt(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 mt(e,t,n){return e.startState?e.startState(t,n):!0}var et=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};et.prototype.eol=function(){return this.pos>=this.string.length},et.prototype.sol=function(){return this.pos==this.lineStart},et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},et.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},et.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},et.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},et.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},et.prototype.skipToEnd=function(){this.pos=this.string.length},et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},et.prototype.backUp=function(e){this.pos-=e},et.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},et.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},et.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 _=this.string.slice(this.pos).match(e);return _&&_.index>0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},et.prototype.current=function(){return this.string.slice(this.start,this.pos)},et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Oe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],_=i.chunkSize();if(t<_){n=i;break}t-=_}return n.lines[t]}function Xt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(_){var k=_.text;i==n.line&&(k=k.slice(0,n.ch)),i==t.line&&(k=k.slice(t.ch)),r.push(k),++i}),r}function Ut(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Ht(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,n=le(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 pr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],_=i.height;if(t<_){e=i;continue e}t-=_,n+=i.chunkSize()}return n}while(!e.lines);for(var k=0;k<e.lines.length;++k){var j=e.lines[k],K=j.height;if(t<K)break;t-=K}return n+k}function Vt(e,t){return t>=e.first&&t<e.first+e.size}function Et(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Le(e,t,n){if(n===void 0&&(n=null),!(this instanceof Le))return new Le(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function Ar(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function an(e){return Le(e.line,e.ch)}function on(e,t){return dt(e,t)<0?t:e}function ar(e,t){return dt(e,t)<0?e:t}function Mt(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 Le(e.first,0);var n=e.first+e.size-1;return t.line>n?Le(n,Oe(e,n).text.length):nr(t,Oe(e,t.line).text.length)}function nr(e,t){var n=e.ch;return n==null||n>t?Le(e.line,t):n<0?Le(e.line,0):e}function ke(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=pt(e,t[r]);return n}var ur=function(e,t){this.state=e,this.lookAhead=t},Tr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Tr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Tr.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}},Tr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Tr.fromSaved=function(e,t,n){return t instanceof ur?new Tr(e,At(e.mode,t.state),n,t.lookAhead):new Tr(e,At(e.mode,t),n)},Tr.prototype.save=function(e){var t=e!==!1?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ur(t,this.maxLookAhead):t};function sn(e,t,n,r){var i=[e.state.modeGen],_={};Vr(e,t.text,e.doc.mode,n,function(V,te){return i.push(V,te)},_,r);for(var k=n.state,j=function(V){n.baseTokens=i;var te=e.state.overlays[V],ae=1,pe=0;n.state=!0,Vr(e,t.text,te.mode,n,function(ce,Se){for(var Pe=ae;pe<ce;){var We=i[ae];We>ce&&i.splice(ae,1,ce,i[ae+1],We),ae+=2,pe=Math.min(ce,We)}if(!Se)return;if(te.opaque)i.splice(Pe,ae-Pe,ce,"overlay "+Se),ae=Pe+2;else for(;Pe<ae;Pe+=2){var $e=i[Pe+1];i[Pe+1]=($e?$e+" ":"")+"overlay "+Se}},_),n.state=k,n.baseTokens=null,n.baseTokenPos=1},K=0;K<e.state.overlays.length;++K)j(K);return{styles:i,classes:_.bgClass||_.textClass?_:null}}function hn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Gr(e,Ot(t)),i=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,r.state),_=sn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=_.styles,_.classes?t.styleClasses=_.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Gr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Tr(r,!0,t);var _=Kn(e,t,n),k=_>r.first&&Oe(r,_-1).stateAfter,j=k?Tr.fromSaved(r,k,_):new Tr(r,mt(r.mode),_);return r.iter(_,t,function(K){Ln(e,K.text,j);var V=j.line;K.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?j.save():null,j.nextLine()}),n&&(r.modeFrontier=j.line),j}function Ln(e,t,n,r){var i=e.doc.mode,_=new et(t,e.options.tabSize,n);for(_.start=_.pos=r||0,t==""&&Dn(i,n.state);!_.eol();)zr(i,_,n.state),_.start=_.pos}function Dn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Tt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function zr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Tt(e,n).mode);var _=e.token(t,n);if(t.pos>t.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var ln=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Rn(e,t,n,r){var i=e.doc,_=i.mode,k;t=pt(i,t);var j=Oe(i,t.line),K=Gr(e,t.line,n),V=new et(j.text,e.options.tabSize,K),te;for(r&&(te=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,k=zr(_,V,K.state),r&&te.push(new ln(V,k,At(i.mode,K.state)));return r?te:new ln(V,k,K.state)}function yn(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 Vr(e,t,n,r,i,_,k){var j=n.flattenSpans;j==null&&(j=e.options.flattenSpans);var K=0,V=null,te=new et(t,e.options.tabSize,r),ae,pe=e.options.addModeClass&&[null];for(t==""&&yn(Dn(n,r.state),_);!te.eol();){if(te.pos>e.options.maxHighlightLength?(j=!1,k&&Ln(e,t,r,te.pos),te.pos=t.length,ae=null):ae=yn(zr(n,te,r.state,pe),_),pe){var ce=pe[0].name;ce&&(ae="m-"+(ae?ce+" "+ae:ce))}if(!j||V!=ae){for(;K<te.start;)K=Math.min(te.start,K+5e3),i(K,V);V=ae}te.start=te.pos}for(;K<te.pos;){var Se=Math.min(te.pos,K+5e3);i(Se,V),K=Se}}function Kn(e,t,n){for(var r,i,_=e.doc,k=n?-1:t-(e.doc.mode.innerMode?1e3:100),j=t;j>k;--j){if(j<=_.first)return _.first;var K=Oe(_,j-1),V=K.stateAfter;if(V&&(!n||j+(V instanceof ur?V.lookAhead:0)<=_.modeFrontier))return j;var te=X(K.text,null,e.options.tabSize);(i==null||r>te)&&(i=j-1,r=te)}return i}function Ni(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=Oe(e,r).stateAfter;if(i&&(!(i instanceof ur)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var On=!1,yr=!1;function Ze(){On=!0}function me(){yr=!0}function Fe(e,t,n){this.marker=e,this.from=t,this.to=n}function gt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function at(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ct(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function St(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],k=_.marker,j=_.from==null||(k.inclusiveLeft?_.from<=t:_.from<t);if(j||_.from==t&&k.type=="bookmark"&&(!n||!_.marker.insertLeft)){var K=_.to==null||(k.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new Fe(k,_.from,K?null:_.to))}}return r}function er(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],k=_.marker,j=_.to==null||(k.inclusiveRight?_.to>=t:_.to>t);if(j||_.from==t&&k.type=="bookmark"&&(!n||_.marker.insertLeft)){var K=_.from==null||(k.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new Fe(k,K?null:_.from-t,_.to==null?null:_.to-t))}}return r}function tr(e,t){if(t.full)return null;var n=Vt(e,t.from.line)&&Oe(e,t.from.line).markedSpans,r=Vt(e,t.to.line)&&Oe(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,_=t.to.ch,k=dt(t.from,t.to)==0,j=St(n,i,k),K=er(r,_,k),V=t.text.length==1,te=Ee(t.text).length+(V?i:0);if(j)for(var ae=0;ae<j.length;++ae){var pe=j[ae];if(pe.to==null){var ce=gt(K,pe.marker);ce?V&&(pe.to=ce.to==null?null:ce.to+te):pe.to=i}}if(K)for(var Se=0;Se<K.length;++Se){var Pe=K[Se];if(Pe.to!=null&&(Pe.to+=te),Pe.from==null){var We=gt(j,Pe.marker);We||(Pe.from=te,V&&(j||(j=[])).push(Pe))}else Pe.from+=te,V&&(j||(j=[])).push(Pe)}j&&(j=or(j)),K&&K!=j&&(K=or(K));var $e=[j];if(!V){var ot=t.text.length-2,Je;if(ot>0&&j)for(var ft=0;ft<j.length;++ft)j[ft].to==null&&(Je||(Je=[])).push(new Fe(j[ft].marker,null,null));for(var wt=0;wt<ot;++wt)$e.push(Je);$e.push(K)}return $e}function or(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 Lr(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var Se=0;Se<ce.markedSpans.length;++Se){var Pe=ce.markedSpans[Se].marker;Pe.readOnly&&(!r||le(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!r)return null;for(var i=[{from:t,to:n}],_=0;_<r.length;++_)for(var k=r[_],j=k.find(0),K=0;K<i.length;++K){var V=i[K];if(dt(V.to,j.from)<0||dt(V.from,j.to)>0)continue;var te=[K,1],ae=dt(V.from,j.from),pe=dt(V.to,j.to);(ae<0||!k.inclusiveLeft&&!ae)&&te.push({from:V.from,to:j.from}),(pe>0||!k.inclusiveRight&&!pe)&&te.push({from:j.to,to:V.to}),i.splice.apply(i,te),K+=te.length-3}return i}function dr(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 Pr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function fr(e){return e.inclusiveLeft?-1:0}function Zr(e){return e.inclusiveRight?1:0}function Sr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),_=dt(r.from,i.from)||fr(e)-fr(t);if(_)return-_;var k=dt(r.to,i.to)||Zr(e)-Zr(t);return k||t.id-e.id}function sr(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=void 0,_=0;_<n.length;++_)i=n[_],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Sr(r,i.marker)<0)&&(r=i.marker);return r}function Xr(e){return sr(e,!0)}function Yr(e){return sr(e,!1)}function Gn(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var _=n[i];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||Sr(r,_.marker)<0)&&(r=_.marker)}return r}function Fi(e,t,n,r,i){var _=Oe(e,t),k=yr&&_.markedSpans;if(k)for(var j=0;j<k.length;++j){var K=k[j];if(!K.marker.collapsed)continue;var V=K.marker.find(0),te=dt(V.from,n)||fr(K.marker)-fr(i),ae=dt(V.to,r)||Zr(K.marker)-Zr(i);if(te>=0&&ae<=0||te<=0&&ae>=0)continue;if(te<=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(V.to,n)>=0:dt(V.to,n)>0)||te>=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?dt(V.from,r)<=0:dt(V.from,r)<0))return!0}}function $r(e){for(var t;t=Xr(e);)e=t.find(-1,!0).line;return e}function Bi(e){for(var t;t=Yr(e);)e=t.find(1,!0).line;return e}function zn(e){for(var t,n;t=Yr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ui(e,t){var n=Oe(e,t),r=$r(n);return n==r?t:Ot(r)}function En(e,t){if(t>e.lastLine())return t;var n=Oe(e,t),r;if(!un(e,n))return t;for(;r=Yr(n);)n=r.find(1,!0).line;return Ot(n)+1}function un(e,t){var n=yr&&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&&di(e,t,r))return!0}}function di(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return di(e,r.line,gt(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,_=0;_<t.markedSpans.length;++_)if(i=t.markedSpans[_],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&di(e,t,i))return!0}function en(e){e=$r(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var _=n.parent;_;n=_,_=n.parent)for(var k=0;k<_.children.length;++k){var j=_.children[k];if(j==n)break;t+=j.height}return t}function ci(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Xr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Yr(r);){var _=n.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=Oe(n,n.first),t.maxLineLength=ci(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ci(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Pn=function(e,t,n){this.text=e,Pr(this,t),this.height=n?n(this):1};Pn.prototype.lineNo=function(){return Ot(this)},se(Pn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dr(e),Pr(e,n);var i=r?r(e):1;i!=e.height&&Ht(e,i)}function vt(e){e.parent=null,dr(e)}var Rt={},_t={};function Nt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?_t:Rt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Yt(e,t){var n=v("span",null,null,R?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var _=i?t.rest[i-1]:t.line,k=void 0;r.pos=0,r.addToken=Kt,Dt(e.display.measure)&&(k=tt(_,e.doc.direction))&&(r.addToken=Ir(r.addToken,k)),r.map=[];var j=t!=e.display.externalMeasured&&Ot(_);mn(_,r,hn(e,_,j)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=W(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=W(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ke(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 K=r.content.lastChild;(/\bcm-tab\b/.test(K.className)||K.querySelector&&K.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return xe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function Zt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Kt(e,t,n,r,i,_,k){if(!t)return;var j=e.splitSpaces?gr(t,e.trailingSpace):t,K=e.cm.state.specialChars,V=!1,te;if(!K.test(t))e.col+=t.length,te=document.createTextNode(j),e.map.push(e.pos,e.pos+t.length,te),F&&I<9&&(V=!0),e.pos+=t.length;else{te=document.createDocumentFragment();for(var ae=0;;){K.lastIndex=ae;var pe=K.exec(t),ce=pe?pe.index-ae:t.length-ae;if(ce){var Se=document.createTextNode(j.slice(ae,ae+ce));F&&I<9?te.appendChild(a("span",[Se])):te.appendChild(Se),e.map.push(e.pos,e.pos+ce,Se),e.col+=ce,e.pos+=ce}if(!pe)break;ae+=ce+1;var Pe=void 0;if(pe[0]==" "){var We=e.cm.options.tabSize,$e=We-e.col%We;Pe=te.appendChild(a("span",Z($e),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=$e}else pe[0]=="\r"||pe[0]==`
|
|
`?(Pe=te.appendChild(a("span",pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",pe[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(pe[0]),Pe.setAttribute("cm-text",pe[0]),F&&I<9?te.appendChild(a("span",[Pe])):te.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=j.charCodeAt(t.length-1)==32,n||r||i||V||_||k){var ot=n||"";r&&(ot+=r),i&&(ot+=i);var Je=a("span",[te],ot,_);if(k)for(var ft in k)k.hasOwnProperty(ft)&&ft!="style"&&ft!="class"&&Je.setAttribute(ft,k[ft]);return e.content.appendChild(Je)}e.content.appendChild(te)}function gr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var _=e.charAt(i);_==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(_="\xA0"),r+=_,n=_==" "}return r}function Ir(e,t){return function(n,r,i,_,k,j,K){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,te=V+r.length;;){for(var ae=void 0,pe=0;pe<t.length&&!(ae=t[pe],ae.to>V&&ae.from<=V);pe++);if(ae.to>=te)return e(n,r,i,_,k,j,K);e(n,r.slice(0,ae.to-V),i,_,null,j,K),_=null,r=r.slice(ae.to-V),V=ae.to}}}function Ft(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 mn(e,t,n){var r=e.markedSpans,i=e.text,_=0;if(!r){for(var k=1;k<n.length;k+=2)t.addToken(t,i.slice(_,_=n[k]),Nt(n[k+1],t.cm.options));return}for(var j=i.length,K=0,V=1,te="",ae,pe,ce=0,Se,Pe,We,$e,ot;;){if(ce==K){Se=Pe=We=pe="",ot=null,$e=null,ce=Infinity;for(var Je=[],ft=void 0,wt=0;wt<r.length;++wt){var xt=r[wt],It=xt.marker;if(It.type=="bookmark"&&xt.from==K&&It.widgetNode)Je.push(It);else if(xt.from<=K&&(xt.to==null||xt.to>K||It.collapsed&&xt.to==K&&xt.from==K)){if(xt.to!=null&&xt.to!=K&&ce>xt.to&&(ce=xt.to,Pe=""),It.className&&(Se+=" "+It.className),It.css&&(pe=(pe?pe+";":"")+It.css),It.startStyle&&xt.from==K&&(We+=" "+It.startStyle),It.endStyle&&xt.to==ce&&(ft||(ft=[])).push(It.endStyle,xt.to),It.title&&((ot||(ot={})).title=It.title),It.attributes)for(var qt in It.attributes)(ot||(ot={}))[qt]=It.attributes[qt];It.collapsed&&(!$e||Sr($e.marker,It)<0)&&($e=xt)}else xt.from>K&&ce>xt.from&&(ce=xt.from)}if(ft)for(var xr=0;xr<ft.length;xr+=2)ft[xr+1]==ce&&(Pe+=" "+ft[xr]);if(!$e||$e.from==K)for(var ir=0;ir<Je.length;++ir)Ft(t,0,Je[ir]);if($e&&($e.from||0)==K){if(Ft(t,($e.to==null?j+1:$e.to)-K,$e.marker,$e.from==null),$e.to==null)return;$e.to==K&&($e=!1)}}if(K>=j)break;for(var Kr=Math.min(j,ce);;){if(te){var Br=K+te.length;if(!$e){var hr=Br>Kr?te.slice(0,Kr-K):te;t.addToken(t,hr,ae?ae+Se:Se,We,K+hr.length==ce?Pe:"",pe,ot)}if(Br>=Kr){te=te.slice(Kr-K),K=Kr;break}K=Br,We=""}te=i.slice(_,_=n[V++]),ae=Nt(n[V++],t.cm.options)}}}function $t(e,t,n){this.line=t,this.rest=zn(t),this.size=this.rest?Ot(Ee(this.rest))-n+1:1,this.node=this.text=null,this.hidden=un(e,t)}function Ur(e,t,n){for(var r=[],i,_=t;_<n;_=i){var k=new $t(e.doc,Oe(e.doc,_),_);i=_+k.size,r.push(k)}return r}var Dr=null;function qr(e){Dr?Dr.ops.push(e):e.ownsGroup=Dr={ops:[e],delayedCallbacks:[]}}function Rs(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 Os(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{Dr=null,t(n)}}var fi=null;function wr(e,t){var n=nt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Dr?i=Dr.delayedCallbacks:fi?i=fi:(i=fi=[],setTimeout(Ps,0));for(var _=function(j){i.push(function(){return n[j].apply(null,r)})},k=0;k<n.length;++k)_(k)}function Ps(){var e=fi;fi=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var _=t.changes[i];_=="text"?ks(e,t):_=="gutter"?Ja(e,t,n,r):_=="class"?da(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function hi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),F&&I<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=hi(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Yt(e,t)}function ks(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(e,t),t.line.wrapClass?hi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ja(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=hi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var _=t.line.gutterMarkers;if(e.options.lineNumbers||_){var k=hi(t),j=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(j),k.insertBefore(j,t.text),t.line.gutterClass&&(j.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=j.appendChild(a("div",Et(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var K=0;K<e.display.gutterSpecs.length;++K){var V=e.display.gutterSpecs[K].className,te=_.hasOwnProperty(V)&&_[V];te&&j.appendChild(a("div",[te],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,_=void 0;i;i=_)_=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Qa(e,t,r),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var _=hi(n),k=0,j=t.widgets;k<j.length;++k){var K=j[k],V=a("div",[K.node],"CodeMirror-linewidget"+(K.className?" "+K.className:""));K.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(K,V,n,r),e.display.input.setUneditable(V),i&&K.above?_.insertBefore(V,n.gutter||n.text):_.appendChild(V),wr(K,"redraw")}}function Ns(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function pn(e,t){for(var n=re(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 Wi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function dn(e){return de-e.display.nativeBarWidth}function Mn(e){return e.display.scroller.clientWidth-dn(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-dn(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&Mn(e);if(!t.measure.heights||r&&t.measure.width!=i){var _=t.measure.heights=[];if(r){t.measure.width=i;for(var k=t.text.firstChild.getClientRects(),j=0;j<k.length-1;j++){var K=k[j],V=k[j+1];Math.abs(K.bottom-V.bottom)>2&&_.push((K.bottom+V.top)/2-n.top)}}_.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Ot(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$r(t);var n=Ot(t),r=e.display.externalMeasured=new $t(e.doc,t,n);r.lineN=n;var i=r.built=Yt(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return cn(e,Vn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Un(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Vn(e,t){var n=Ot(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function cn(e,t,n,r,i){t.before&&(n=-1);var _=n+(r||""),k;return t.cache.hasOwnProperty(_)?k=t.cache[_]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),k=Ws(e,t,n,r),k.bogus||(t.cache[_]=k)),{left:k.left,right:k.right,top:i?k.rtop:k.top,bottom:i?k.rbottom:k.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,_,k,j,K,V=0;V<e.length;V+=3)if(j=e[V],K=e[V+1],t<j?(i=0,_=1,k="left"):t<K?(i=t-j,_=i+1):(V==e.length-3||t==K&&e[V+3]>t)&&(_=K-j,i=_-1,t>=K&&(k="right")),i!=null){if(r=e[V+2],j==K&&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==K-j)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:_,collapse:k,coverStart:j,coverEnd:K}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),_=i.node,k=i.start,j=i.end,K=i.collapse,V;if(_.nodeType==3){for(var te=0;te<4;te++){for(;k&&De(t.line.text.charAt(i.coverStart+k));)--k;for(;i.coverStart+j<i.coverEnd&&De(t.line.text.charAt(i.coverStart+j));)++j;if(F&&I<9&&k==0&&j==i.coverEnd-i.coverStart?V=_.parentNode.getBoundingClientRect():V=js(p(_,k,j).getClientRects(),r),V.left||V.right||k==0)break;j=k,k=k-1,K="right"}F&&I<11&&(V=Hs(e.display.measure,V))}else{k>0&&(K=r="right");var ae;e.options.lineWrapping&&(ae=_.getClientRects()).length>1?V=ae[r=="right"?ae.length-1:0]:V=_.getBoundingClientRect()}if(F&&I<9&&!k&&(!V||!V.left&&!V.right)){var pe=_.parentNode.getClientRects()[0];pe?V={left:pe.left,right:pe.left+Yn(e.display),top:pe.top,bottom:pe.bottom}:V=ro}for(var ce=V.top-t.rect.top,Se=V.bottom-t.rect.top,Pe=(ce+Se)/2,We=t.view.measure.heights,$e=0;$e<We.length-1&&!(Pe<We[$e]);$e++);var ot=$e?We[$e-1]:0,Je=We[$e],ft={left:(K=="right"?V.right:V.left)-t.rect.left,right:(K=="left"?V.left:V.right)-t.rect.left,top:ot,bottom:Je};return!V.left&&!V.right&&(ft.bogus=!0),e.options.singleCursorHeightPerLine||(ft.rtop=ce,ft.rbottom=Se),ft}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Lt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function pi(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return b&&c?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&c?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=mi(e.widgets[n]));return t}function Hi(e,t,n,r,i){if(!i){var _=ma(t);n.top+=_,n.bottom+=_}if(r=="line")return n;r||(r="local");var k=en(t);if(r=="local"?k+=Wi(e.display):k-=e.display.viewOffset,r=="page"||r=="window"){var j=e.display.lineSpace.getBoundingClientRect();k+=j.top+(r=="window"?0:so());var K=j.left+(r=="window"?0:oo());n.left+=K,n.right+=K}return n.top+=k,n.bottom+=k,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var _=e.display.sizer.getBoundingClientRect();r+=_.left,i+=_.top}var k=e.display.lineSpace.getBoundingClientRect();return{left:r-k.left,top:i-k.top}}function pa(e,t,n,r,i){return r||(r=Oe(e.doc,t.line)),Hi(e,r,to(e,r,t.ch,i),n)}function tn(e,t,n,r,i,_){r=r||Oe(e.doc,t.line),i||(i=Vn(e,r));function k(Se,Pe){var We=cn(e,i,Se,Pe?"right":"left",_);return Pe?We.left=We.right:We.right=We.left,Hi(e,r,We,n)}var j=tt(r,e.doc.direction),K=t.ch,V=t.sticky;if(K>=r.text.length?(K=r.text.length,V="before"):K<=0&&(K=0,V="after"),!j)return k(V=="before"?K-1:K,V=="before");function te(Se,Pe,We){var $e=j[Pe],ot=$e.level==1;return k(We?Se-1:Se,ot!=We)}var ae=Xe(j,K,V),pe=Ve,ce=te(K,ae,V=="before");return pe!=null&&(ce.other=te(K,pe,V!="before")),ce}function uo(e,t){var n=0;t=pt(e.doc,t),e.options.lineWrapping||(n=Yn(e.display)*t.ch);var r=Oe(e.doc,t.line),i=en(r)+Wi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var _=Le(e,t,n);return _.xRel=i,r&&(_.outside=r),_}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=pr(r,n),_=r.first+r.size-1;if(i>_)return ga(r.first+r.size-1,Oe(r,_).text.length,null,1,1);t<0&&(t=0);for(var k=Oe(r,i);;){var j=Ks(e,k,i,t,n),K=Gn(k,j.ch+(j.xRel>0||j.outside>0?1:0));if(!K)return j;var V=K.find(1);if(V.line==i)return V;k=Oe(r,i=V.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,_=rt(function(k){return cn(e,n,k-1).bottom<=r},i,0);return i=rt(function(k){return cn(e,n,k).top>r},_,i),{begin:_,end:i}}function fo(e,t,n,r){n||(n=Vn(e,t));var i=Hi(e,t,cn(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=en(t);var _=Vn(e,t),k=ma(t),j=0,K=t.text.length,V=!0,te=tt(t,e.doc.direction);if(te){var ae=(e.options.lineWrapping?zs:Gs)(e,t,n,_,te,r,i);V=ae.level!=1,j=V?ae.from:ae.to-1,K=V?ae.to:ae.from-1}var pe=null,ce=null,Se=rt(function(wt){var xt=cn(e,_,wt);return xt.top+=k,xt.bottom+=k,ya(xt,r,i,!1)?(xt.top<=i&&xt.left<=r&&(pe=wt,ce=xt),!0):!1},j,K),Pe,We,$e=!1;if(ce){var ot=r-ce.left<ce.right-r,Je=ot==V;Se=pe+(Je?0:1),We=Je?"after":"before",Pe=ot?ce.left:ce.right}else{!V&&(Se==K||Se==j)&&Se++,We=Se==0?"after":Se==t.text.length?"before":cn(e,_,Se-(V?1:0)).bottom+k<=i==V?"after":"before";var ft=tn(e,Le(n,Se,We),"line",t,_);Pe=ft.left,$e=i<ft.top?-1:i>=ft.bottom?1:0}return Se=Te(t.text,Se,1),ga(n,Se,We,$e,r-Pe)}function Gs(e,t,n,r,i,_,k){var j=rt(function(ae){var pe=i[ae],ce=pe.level!=1;return ya(tn(e,Le(n,ce?pe.to:pe.from,ce?"before":"after"),"line",t,r),_,k,!0)},0,i.length-1),K=i[j];if(j>0){var V=K.level!=1,te=tn(e,Le(n,V?K.from:K.to,V?"after":"before"),"line",t,r);ya(te,_,k,!0)&&te.top>k&&(K=i[j-1])}return K}function zs(e,t,n,r,i,_,k){var j=co(e,t,r,k),K=j.begin,V=j.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var te=null,ae=null,pe=0;pe<i.length;pe++){var ce=i[pe];if(ce.from>=V||ce.to<=K)continue;var Se=ce.level!=1,Pe=cn(e,r,Se?Math.min(V,ce.to)-1:Math.max(K,ce.from)).right,We=Pe<_?_-Pe+1e9:Pe-_;(!te||ae>We)&&(te=ce,ae=We)}return te||(te=i[i.length-1]),te.from<K&&(te={from:K,to:te.to,level:te.level}),te.to>V&&(te={from:te.from,to:V,level:te.level}),te}var kn;function Xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(kn==null){kn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)kn.appendChild(document.createTextNode("x")),kn.appendChild(a("br"));kn.appendChild(document.createTextNode("x"))}s(e.measure,kn);var n=kn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function Yn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,_=t.gutters.firstChild,k=0;_;_=_.nextSibling,++k){var j=e.display.gutterSpecs[k].className;n[j]=_.offsetLeft+_.clientLeft+i,r[j]=_.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=Xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Yn(e.display)-3);return function(i){if(un(e.doc,i))return 0;var _=0;if(i.widgets)for(var k=0;k<i.widgets.length;k++)i.widgets[k].height&&(_+=i.widgets[k].height);return n?_+(Math.ceil(i.text.length/r)||1)*t:_+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Ht(r,i)})}function In(e,t,n,r){var i=e.display;if(!n&&re(t).getAttribute("cm-not-content")=="true")return null;var _,k,j=i.lineSpace.getBoundingClientRect();try{_=t.clientX-j.left,k=t.clientY-j.top}catch(ae){return null}var K=va(e,_,k),V;if(r&&K.xRel>0&&(V=Oe(e.doc,K.line).text).length==K.ch){var te=X(V,V.length,e.options.tabSize)-V.length;K=Le(K.line,Math.max(0,Math.round((_-qa(e.display).left)/Yn(e.display))-te))}return K}function Un(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 Nr(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)yr&&ui(e.doc,t)<i.viewTo&&xn(e);else if(n<=i.viewFrom)yr&&En(e.doc,n+r)>i.viewFrom?xn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)xn(e);else if(t<=i.viewFrom){var _=Ki(e,n,n+r,1);_?(i.view=i.view.slice(_.index),i.viewFrom=_.lineN,i.viewTo+=r):xn(e)}else if(n>=i.viewTo){var k=Ki(e,t,t,-1);k?(i.view=i.view.slice(0,k.index),i.viewTo=k.lineN):xn(e)}else{var j=Ki(e,t,t,-1),K=Ki(e,n,n+r,1);j&&K?(i.view=i.view.slice(0,j.index).concat(Ur(e,j.lineN,K.lineN)).concat(i.view.slice(K.index)),i.viewTo+=r):xn(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function bn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var _=r.view[Un(e,t)];if(_.node==null)return;var k=_.changes||(_.changes=[]);le(k,n)==-1&&k.push(n)}function xn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,n,r){var i=Un(e,t),_,k=e.display.view;if(!yr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var j=e.display.viewFrom,K=0;K<i;K++)j+=k[K].size;if(j!=t){if(r>0){if(i==k.length-1)return null;_=j+k[i].size-t,i++}else _=j-t;t+=_,n+=_}for(;ui(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 Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Ur(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ur(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Un(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Ur(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Un(e,n)))),r.viewTo=n}function mo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function gi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),_=r.selection=document.createDocumentFragment(),k=0;k<n.sel.ranges.length;k++){if(!t&&k==n.sel.primIndex)continue;var j=n.sel.ranges[k];if(j.from().line>=e.display.viewTo||j.to().line<e.display.viewFrom)continue;var K=j.empty();(K||e.options.showCursorWhenSelecting)&&go(e,j.head,i),K||Xs(e,j,_)}return r}function go(e,t,n){var r=tn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var _=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=r.other.left+"px",_.style.top=r.other.top+"px",_.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,_=document.createDocumentFragment(),k=qa(e.display),j=k.left,K=Math.max(r.sizerWidth,Mn(e)-r.sizer.offsetLeft)-k.right,V=i.direction=="ltr";function te(Je,ft,wt,xt){ft<0&&(ft=0),ft=Math.round(ft),xt=Math.round(xt),_.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
|
|
top: `+ft+"px; width: "+(wt==null?K-Je:wt)+`px;
|
|
height: `+(xt-ft)+"px"))}function ae(Je,ft,wt){var xt=Oe(i,Je),It=xt.text.length,qt,xr;function ir(hr,jr){return pa(e,Le(Je,hr),"div",xt,jr)}function Kr(hr,jr,Cr){var vr=fo(e,xt,null,hr),mr=jr=="ltr"==(Cr=="after")?"left":"right",lr=Cr=="after"?vr.begin:vr.end-(/\s/.test(xt.text.charAt(vr.end-1))?2:1);return ir(lr,mr)[mr]}var Br=tt(xt,i.direction);return Qe(Br,ft||0,wt==null?It:wt,function(hr,jr,Cr,vr){var mr=Cr=="ltr",lr=ir(hr,mr?"left":"right"),Wr=ir(jr-1,mr?"right":"left"),si=ft==null&&hr==0,An=wt==null&&jr==It,Or=vr==0,fn=!Br||vr==Br.length-1;if(Wr.top-lr.top<=3){var _r=(V?si:An)&&Or,Va=(V?An:si)&&fn,vn=_r?j:(mr?lr:Wr).left,Wn=Va?K:(mr?Wr:lr).right;te(vn,lr.top,Wn-vn,lr.bottom)}else{var Hn,kr,li,Xa;mr?(Hn=V&&si&&Or?j:lr.left,kr=V?K:Kr(hr,Cr,"before"),li=V?j:Kr(jr,Cr,"after"),Xa=V&&An&&fn?K:Wr.right):(Hn=V?Kr(hr,Cr,"before"):j,kr=!V&&si&&Or?K:lr.right,li=!V&&An&&fn?j:Wr.left,Xa=V?Kr(jr,Cr,"after"):K),te(Hn,lr.top,kr-Hn,lr.bottom),lr.bottom<Wr.top&&te(j,lr.bottom,null,Wr.top),te(li,Wr.top,Xa-li,Wr.bottom)}(!qt||Gi(lr,qt)<0)&&(qt=lr),Gi(Wr,qt)<0&&(qt=Wr),(!xr||Gi(lr,xr)<0)&&(xr=lr),Gi(Wr,xr)<0&&(xr=Wr)}),{start:qt,end:xr}}var pe=t.from(),ce=t.to();if(pe.line==ce.line)ae(pe.line,pe.ch,ce.ch);else{var Se=Oe(i,pe.line),Pe=Oe(i,ce.line),We=$r(Se)==$r(Pe),$e=ae(pe.line,pe.ch,We?Se.text.length+1:null).end,ot=ae(ce.line,We?0:null,ce.ch).start;We&&($e.top<ot.top-2?(te($e.right,$e.top,null,$e.bottom),te(j,ot.top,ot.left,ot.bottom)):te($e.right,$e.top,ot.left-$e.right,$e.bottom)),$e.bottom<ot.top&&te(j,$e.bottom,null,ot.top)}n.appendChild(_)}function _a(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()||$n(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,$n(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(xe(e,"focus",e,t),e.state.focused=!0,N(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()),_a(e)}function $n(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(xe(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function zi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],_=e.options.lineWrapping,k=void 0,j=0;if(i.hidden)continue;if(F&&I<8){var K=i.node.offsetTop+i.node.offsetHeight;k=K-n,n=K}else{var V=i.node.getBoundingClientRect();k=V.bottom-V.top,!_&&i.text.firstChild&&(j=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var te=i.line.height-k;if((te>.005||te<-.005)&&(Ht(i.line,k),Eo(i.line),i.rest))for(var ae=0;ae<i.rest.length;ae++)Eo(i.rest[ae]);if(j>e.display.sizerWidth){var pe=Math.ceil(j/Yn(e.display));pe>e.display.maxLineLength&&(e.display.maxLineLength=pe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Eo(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 Vi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Wi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,_=pr(t,r),k=pr(t,i);if(n&&n.ensure){var j=n.ensure.from.line,K=n.ensure.to.line;j<_?(_=j,k=pr(t,en(Oe(t,j))+e.wrapper.clientHeight)):Math.min(K,t.lastLine())>=k&&(_=pr(t,en(Oe(t,K))-e.wrapper.clientHeight),k=K)}return{from:_,to:Math.max(k,_+1)}}function Ys(e,t){if(Re(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!w){var _=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Wi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+dn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(i),e.display.lineSpace.removeChild(_)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Le(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Le(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var k=!1,j=tn(e,t),K=!n||n==t?j:tn(e,n);i={left:Math.min(j.left,K.left),top:Math.min(j.top,K.top)-r,right:Math.max(j.left,K.left),bottom:Math.max(j.bottom,K.bottom)+r};var V=Sa(e,i),te=e.doc.scrollTop,ae=e.doc.scrollLeft;if(V.scrollTop!=null&&(yi(e,V.scrollTop),Math.abs(e.doc.scrollTop-te)>1&&(k=!0)),V.scrollLeft!=null&&(Nn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ae)>1&&(k=!0)),!k)break}return i}function Js(e,t){var n=Sa(e,t);n.scrollTop!=null&&yi(e,n.scrollTop),n.scrollLeft!=null&&Nn(e,n.scrollLeft)}function Sa(e,t){var n=e.display,r=Xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,_=fa(e),k={};t.bottom-t.top>_&&(t.bottom=t.top+_);var j=e.doc.height+ca(n),K=t.top<r,V=t.bottom>j-r;if(t.top<i)k.scrollTop=K?0:t.top;else if(t.bottom>i+_){var te=Math.min(t.top,(V?j:t.bottom)-_);te!=i&&(k.scrollTop=te)}var ae=e.options.fixedGutter?0:n.gutters.offsetWidth,pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ae,ce=Mn(e)-n.gutters.offsetWidth,Se=t.right-t.left>ce;return Se&&(t.right=t.left+ce),t.left<10?k.scrollLeft=0:t.left<pe?k.scrollLeft=Math.max(0,t.left+ae-(Se?0:10)):t.right>ce+pe-3&&(k.scrollLeft=t.right+(Se?0:10)-ce),k}function wa(e,t){if(t==null)return;Xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Jn(e){Xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function vi(e,t,n){(t!=null||n!=null)&&Xi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Xi(e),e.curOp.scrollToPos=t}function Xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);bo(e,n,r,t.margin)}}function bo(e,t,n,r){var i=Sa(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});vi(e,i.scrollLeft,i.scrollTop)}function yi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||Aa(e,{top:t}),xo(e,t,!0),A&&Aa(e),xi(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Nn(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,Co(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+dn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Fn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),be(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var _=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fn.prototype.zeroWidthHack=function(){var e=d&&!S?"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},Fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),_=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var bi=function(){};bi.prototype.update=function(){return{bottom:0,right:0}},bi.prototype.setScrollLeft=function(){},bi.prototype.setScrollTop=function(){},bi.prototype.clear=function(){};function Qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;_o(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&zi(e),_o(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function _o(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 To={native:Fn,null:bi};function So(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new To[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(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"?Nn(e,t):yi(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Bn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},qr(e.curOp)}function jn(e){var t=e.curOp;t&&Os(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var _=0;_<t.length;_++)nl(t[_]);for(var k=0;k<t.length;k++)il(t[k])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(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 Yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&zi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+dn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Mn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Nn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qn(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&_a(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Nn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,pt(r,e.scrollToPos.from),pt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var _=e.maybeHiddenMarkers,k=e.maybeUnhiddenMarkers;if(_)for(var j=0;j<_.length;++j)_[j].lines.length||xe(_[j],"hide");if(k)for(var K=0;K<k.length;++K)k[K].lines.length&&xe(k[K],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hr(e,t){if(e.curOp)return t();Bn(e);try{return t()}finally{jn(e)}}function Er(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Bn(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function Mr(e){return function(){if(this.curOp)return e.apply(this,arguments);Bn(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function br(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Bn(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function xi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Gr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var k=_.styles,j=_.text.length>e.options.maxHighlightLength?At(t.mode,r.state):null,K=sn(e,_,r,!0);j&&(r.state=j),_.styles=K.styles;var V=_.styleClasses,te=K.classes;te?_.styleClasses=te:V&&(_.styleClasses=null);for(var ae=!k||k.length!=_.styles.length||V!=te&&(!V||!te||V.bgClass!=te.bgClass||V.textClass!=te.textClass),pe=0;!ae&&pe<k.length;++pe)ae=k[pe]!=_.styles[pe];ae&&i.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&Ln(e,_.text,r),_.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Hr(e,function(){for(var _=0;_<i.length;_++)bn(e,i[_],"text")})}var Yi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Vi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mn(e),this.force=n,this.dims=Ea(e),this.events=[]};Yi.prototype.signal=function(e,t){ie(e,t)&&this.events.push(arguments)},Yi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)xe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=dn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=dn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return xn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&mo(e)==0)return!1;Ao(e)&&(xn(e),t.dims=Ea(e));var i=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),k=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<_&&_-n.viewFrom<20&&(_=Math.max(r.first,n.viewFrom)),n.viewTo>k&&n.viewTo-k<20&&(k=Math.min(i,n.viewTo)),yr&&(_=ui(e.doc,_),k=En(e.doc,k));var j=_!=n.viewFrom||k!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,_,k),n.viewOffset=en(Oe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var K=mo(e);if(!j&&K==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return K>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),K>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,j&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,xi(e,400)),n.updateLineNumbers=null,!0}function wo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Mn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Vi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vi(e.display,e.doc,n));if(!Ca(e,t))break;zi(e);var i=Ei(e);gi(e),Qn(e,i),Da(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Yi(e,t);if(Ca(e,n)){zi(e),wo(e,n);var r=Ei(e);gi(e),Qn(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,_=r.lineDiv,k=_.firstChild;function j(Se){var Pe=Se.nextSibling;return R&&d&&e.display.currentWheelTarget==Se?Se.style.display="none":Se.parentNode.removeChild(Se),Pe}for(var K=r.view,V=r.viewFrom,te=0;te<K.length;te++){var ae=K[te];if(!ae.hidden)if(!ae.node||ae.node.parentNode!=_){var pe=Us(e,ae,V,n);_.insertBefore(pe,k)}else{for(;k!=ae.node;)k=j(k);var ce=i&&t!=null&&t<=V&&ae.lineNumber;ae.changes&&(le(ae.changes,"gutter")>-1&&(ce=!1),Ya(e,ae,V,n)),ce&&(h(ae.lineNumber),ae.lineNumber.appendChild(document.createTextNode(Et(e.options,V)))),k=ae.node.nextSibling}V+=ae.size}for(;k;)k=j(k)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+dn(e)+"px"}function Co(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,_=r+"px",k=0;k<n.length;k++)if(!n[k].hidden){e.options.fixedGutter&&(n[k].gutter&&(n[k].gutter.style.left=_),n[k].gutterBackground&&(n[k].gutterBackground.style.left=_));var j=n[k].alignable;if(j)for(var K=0;K<j.length;K++)j[K].style.left=_}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Et(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=i.firstChild.offsetWidth,k=i.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-k)+1,r.lineNumWidth=r.lineNumInnerWidth+k,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var _=e[i],k=null;if(typeof _!="string"&&(k=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:_,style:k})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Lo(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],_=i.className,k=i.style,j=t.appendChild(a("div",null,"CodeMirror-gutter "+_));k&&(j.style.cssText=k),_=="CodeMirror-linenumbers"&&(e.lineGutter=j,j.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",La(e)}function _i(e){Lo(e.display),Nr(e),Co(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var _=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[_],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+de+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),F&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Lo(i),n.init(i)}var $i=0,Jr=null;F?Jr=-.53:A?Jr=15:b?Jr=-.7:L&&(Jr=-1/3);function Do(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Do(e);return t.x*=Jr,t.y*=Jr,t}function Ro(e,t){var n=Do(t),r=n.x,i=n.y,_=e.display,k=_.scroller,j=k.scrollWidth>k.clientWidth,K=k.scrollHeight>k.clientHeight;if(!(r&&j||i&&K))return;if(i&&d&&R){e:for(var V=t.target,te=_.view;V!=k;V=V.parentNode)for(var ae=0;ae<te.length;ae++)if(te[ae].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!C&&Jr!=null){i&&K&&yi(e,Math.max(0,k.scrollTop+i*Jr)),Nn(e,Math.max(0,k.scrollLeft+r*Jr)),(!i||i&&K)&&Y(t),_.wheelStartX=null;return}if(i&&Jr!=null){var pe=i*Jr,ce=e.doc.scrollTop,Se=ce+_.wrapper.clientHeight;pe<0?ce=Math.max(0,ce+pe-50):Se=Math.min(e.doc.height,Se+pe+50),Aa(e,{top:ce,bottom:Se})}$i<20&&(_.wheelStartX==null?(_.wheelStartX=k.scrollLeft,_.wheelStartY=k.scrollTop,_.wheelDX=r,_.wheelDY=i,setTimeout(function(){if(_.wheelStartX==null)return;var Pe=k.scrollLeft-_.wheelStartX,We=k.scrollTop-_.wheelStartY,$e=We&&_.wheelDY&&We/_.wheelDY||Pe&&_.wheelDX&&Pe/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!$e)return;Jr=(Jr*$i+$e)/($i+1),++$i},200)):(_.wheelDX+=r,_.wheelDY+=i))}var Qr=function(e,t){this.ranges=e,this.primIndex=t};Qr.prototype.primary=function(){return this.ranges[this.primIndex]},Qr.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(!Ar(n.anchor,r.anchor)||!Ar(n.head,r.head))return!1}return!0},Qr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Jt(an(this.ranges[t].anchor),an(this.ranges[t].head));return new Qr(e,this.primIndex)},Qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Qr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var Jt=function(e,t){this.anchor=e,this.head=t};Jt.prototype.from=function(){return ar(this.anchor,this.head)},Jt.prototype.to=function(){return on(this.anchor,this.head)},Jt.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(pe,ce){return dt(pe.from(),ce.from())}),n=le(t,i);for(var _=1;_<t.length;_++){var k=t[_],j=t[_-1],K=dt(j.to(),k.from());if(r&&!k.empty()?K>0:K>=0){var V=ar(j.from(),k.from()),te=on(j.to(),k.to()),ae=j.empty()?k.from()==k.head:j.from()==j.head;_<=n&&--n,t.splice(--_,2,new Jt(ae?te:V,ae?V:te))}}return new Qr(t,n)}function _n(e,t){return new Qr([new Jt(e,t||e)],0)}function Tn(e){return e.text?Le(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Oo(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Tn(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+=Tn(t).ch-t.to.ch),Le(n,r)}function Oa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Jt(Oo(i.anchor,t),Oo(i.head,t)))}return rn(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Le(n.line,e.ch-t.ch+n.ch):Le(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Le(e.first,0),_=i,k=0;k<t.length;k++){var j=t[k],K=Po(j.from,i,_),V=Po(Tn(j),i,_);if(i=j.to,_=V,n=="around"){var te=e.sel.ranges[k],ae=dt(te.head,te.anchor)<0;r[k]=new Jt(ae?V:K,ae?K:V)}else r[k]=new Jt(K,K)}return new Qr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=kt(e.options,e.doc.modeOption),Ti(e)}function Ti(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,xi(e,100),e.state.modeGen++,e.curOp&&Nr(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(ot){return n?n[ot]:null}function _(ot,Je,ft){ua(ot,Je,ft,r),wr(ot,"change",ot,t)}function k(ot,Je){for(var ft=[],wt=ot;wt<Je;++wt)ft.push(new Pn(V[wt],i(wt),r));return ft}var j=t.from,K=t.to,V=t.text,te=Oe(e,j.line),ae=Oe(e,K.line),pe=Ee(V),ce=i(V.length-1),Se=K.line-j.line;if(t.full)e.insert(0,k(0,V.length)),e.remove(V.length,e.size-V.length);else if(Mo(e,t)){var Pe=k(0,V.length-1);_(ae,ae.text,ce),Se&&e.remove(j.line,Se),Pe.length&&e.insert(j.line,Pe)}else if(te==ae)if(V.length==1)_(te,te.text.slice(0,j.ch)+pe+te.text.slice(K.ch),ce);else{var We=k(1,V.length-1);We.push(new Pn(pe+te.text.slice(K.ch),ce,r)),_(te,te.text.slice(0,j.ch)+V[0],i(0)),e.insert(j.line+1,We)}else if(V.length==1)_(te,te.text.slice(0,j.ch)+V[0]+ae.text.slice(K.ch),i(0)),e.remove(j.line+1,Se);else{_(te,te.text.slice(0,j.ch)+V[0],i(0)),_(ae,pe+ae.text.slice(K.ch),ce);var $e=k(1,V.length-1);Se>1&&e.remove(j.line+1,Se-1),e.insert(j.line+1,$e)}wr(e,"change",e,t)}function Sn(e,t,n){function r(i,_,k){if(i.linked)for(var j=0;j<i.linked.length;++j){var K=i.linked[j];if(K.doc==_)continue;var V=k&&K.sharedHist;if(n&&!V)continue;t(K.doc,V),r(K.doc,i,V)}}r(e,null,!0)}function ko(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Nr(e)}function Io(e){(e.doc.direction=="rtl"?N:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){Hr(e,function(){Io(e),Nr(e)})}function Ji(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 ka(e,t){var n={from:an(t.from),to:Tn(t),text:Xt(e,t.from,t.to)};return Fo(e,n,t.from.line,t.to.line+1),Sn(e,function(r){return Fo(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function No(e,t,n,r){var i=e.history;i.undone.length=0;var _=+new Date,k,j;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(k=ml(i,i.lastOp==r)))j=Ee(k.changes),dt(t.from,t.to)==0&&dt(t.from,j.to)==0?j.to=Tn(t):k.changes.push(ka(e,t));else{var K=Ee(i.done);for((!K||!K.ranges)&&Qi(e.sel,i.done),k={changes:[ka(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=_,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,j||xe(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,_=r&&r.origin;n==i.lastSelOp||_&&i.lastSelOrigin==_&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==_||pl(e,_,Ee(i.done),t))?i.done[i.done.length-1]=t:Qi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=_,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Qi(e,t){var n=Ee(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fo(e,t,n,r){var i=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(k){k.markedSpans&&((i||(i=t["spans_"+e.id]={}))[_]=k.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=tr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var _=n[i],k=r[i];if(_&&k){e:for(var j=0;j<k.length;++j){for(var K=k[j],V=0;V<_.length;++V)if(_[V].marker==K.marker)continue e;_.push(K)}}else k&&(n[i]=k)}return n}function Zn(e,t,n){for(var r=[],i=0;i<e.length;++i){var _=e[i];if(_.ranges){r.push(n?Qr.prototype.deepCopy.call(_):_);continue}var k=_.changes,j=[];r.push({changes:j});for(var K=0;K<k.length;++K){var V=k[K],te=void 0;if(j.push({from:V.from,to:V.to,text:V.text}),t)for(var ae in V)(te=ae.match(/^spans_(\d+)$/))&&(le(t,Number(te[1]))>-1&&(Ee(j)[ae]=V[ae],delete V[ae]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var _=dt(t,i)<0;_!=dt(n,i)<0?(i=t,t=n):_!=dt(t,n)<0&&(t=n)}return new Jt(i,t)}else return new Jt(n||t,t)}function Zi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Rr(e,new Qr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),_=0;_<e.sel.ranges.length;_++)r[_]=Ia(e.sel.ranges[_],t[_],null,i);var k=rn(e.cm,r,e.sel.primIndex);Rr(e,k,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Rr(e,rn(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Rr(e,_n(t,n),r)}function El(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var _=0;_<i.length;_++)this.ranges[_]=new Jt(pt(e,i[_].anchor),pt(e,i[_].head))},origin:n&&n.origin};return xe(e,"beforeSelectionChange",e,r),e.cm&&xe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?rn(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=Ee(r);i&&i.ranges?(r[r.length-1]=t,qi(e,t,n)):Rr(e,t,n)}function Rr(e,t,n){qi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qi(e,t,n){(ie(e,"beforeSelectionChange")||e.cm&&ie(e.cm,"beforeSelectionChange"))&&(t=El(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Jn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ue(e.cm)),wr(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,_=0;_<t.ranges.length;_++){var k=t.ranges[_],j=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],K=ea(e,k.anchor,j&&j.anchor,n,r),V=ea(e,k.head,j&&j.head,n,r);(i||K!=k.anchor||V!=k.head)&&(i||(i=t.ranges.slice(0,_)),i[_]=new Jt(K,V))}return i?rn(e.cm,i,t.primIndex):t}function qn(e,t,n,r,i){var _=Oe(e,t.line);if(_.markedSpans)for(var k=0;k<_.markedSpans.length;++k){var j=_.markedSpans[k],K=j.marker,V="selectLeft"in K?!K.selectLeft:K.inclusiveLeft,te="selectRight"in K?!K.selectRight:K.inclusiveRight;if((j.from==null||(V?j.from<=t.ch:j.from<t.ch))&&(j.to==null||(te?j.to>=t.ch:j.to>t.ch))){if(i&&(xe(K,"beforeCursorEnter"),K.explicitlyCleared))if(_.markedSpans){--k;continue}else break;if(!K.atomic)continue;if(n){var ae=K.find(r<0?1:-1),pe=void 0;if((r<0?te:V)&&(ae=Vo(e,ae,-r,ae&&ae.line==t.line?_:null)),ae&&ae.line==t.line&&(pe=dt(ae,n))&&(r<0?pe<0:pe>0))return qn(e,ae,t,r,i)}var ce=K.find(r<0?-1:1);return(r<0?V:te)&&(ce=Vo(e,ce,r,ce.line==t.line?_:null)),ce?qn(e,ce,t,r,i):null}}return t}function ea(e,t,n,r,i){var _=r||1,k=qn(e,t,n,_,i)||!i&&qn(e,t,n,_,!0)||qn(e,t,n,-_,i)||!i&&qn(e,t,n,-_,!0);return k||(e.cantEdit=!0,Le(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?pt(e,Le(t.line-1)):null:n>0&&t.ch==(r||Oe(e,t.line)).text.length?t.line<e.first+e.size-1?Le(t.line+1,0):null:new Le(t.line,t.ch+n)}function Xo(e){e.setSelection(Le(e.firstLine(),0),Le(e.lastLine()),ge)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,_,k,j){i&&(r.from=pt(e,i)),_&&(r.to=pt(e,_)),k&&(r.text=k),j!==void 0&&(r.origin=j)}),xe(e,"beforeChange",e,r),e.cm&&xe(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 ei(e,t,n){if(e.cm){if(!e.cm.curOp)return Er(e.cm,ei)(e,t,n);if(e.cm.state.suppressEdits)return}if((ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=On&&!n&&Lr(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=Oa(e,t);No(e,t,n,e.cm?e.cm.curOp.id:NaN),Si(e,t,n,tr(e,t));var r=[];Sn(e,function(i,_){!_&&le(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),Si(i,t,null,tr(i,t))})}function ta(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,_,k=e.sel,j=t=="undo"?i.done:i.undone,K=t=="undo"?i.undone:i.done,V=0;V<j.length&&!(_=j[V],n?_.ranges&&!_.equals(e.sel):!_.ranges);V++);if(V==j.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(_=j.pop(),_.ranges){if(Qi(_,K),n&&!_.equals(e.sel)){Rr(e,_,{clearRedo:!1});return}k=_}else if(r){j.push(_);return}else break;var te=[];Qi(k,K),K.push({changes:te,generation:i.generation}),i.generation=_.generation||++i.maxGeneration;for(var ae=ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"),pe=function(Pe){var We=_.changes[Pe];if(We.origin=t,ae&&!Yo(e,We,!1))return j.length=0,{};te.push(ka(e,We));var $e=Pe?Oa(e,We):Ee(j);Si(e,We,$e,Bo(e,We)),!Pe&&e.cm&&e.cm.scrollIntoView({from:We.from,to:Tn(We)});var ot=[];Sn(e,function(Je,ft){!ft&&le(ot,Je.history)==-1&&(qo(Je.history,We),ot.push(Je.history)),Si(Je,We,null,Bo(Je,We))})},ce=_.changes.length-1;ce>=0;--ce){var Se=pe(ce);if(Se)return Se.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Qr(Be(e.sel.ranges,function(i){return new Jt(Le(i.anchor.line+t,i.anchor.ch),Le(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Nr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)bn(e.cm,r,"gutter")}}function Si(e,t,n,r){if(e.cm&&!e.cm.curOp)return Er(e.cm,Si)(e,t,n,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Jo(e,i),t={from:Le(e.first,0),to:Le(t.to.line+i,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:Le(_,Oe(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Xt(e,t.from,t.to),n||(n=Oa(e,t)),e.cm?bl(e.cm,t,r):Ma(e,t,r),qi(e,n,ge),e.cantEdit&&ea(e,Le(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var r=e.doc,i=e.display,_=t.from,k=t.to,j=!1,K=_.line;e.options.lineWrapping||(K=Ot($r(Oe(r,_.line))),r.iter(K,k.line+1,function(ce){if(ce==i.maxLine)return j=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ue(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(K,_.line+t.text.length,function(ce){var Se=ci(ce);Se>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=Se,i.maxLineChanged=!0,j=!1)}),j&&(e.curOp.updateMaxLine=!0)),Ni(r,_.line),xi(e,400);var V=t.text.length-(k.line-_.line)-1;t.full?Nr(e):_.line==k.line&&t.text.length==1&&!Mo(e.doc,t)?bn(e,_.line,"text"):Nr(e,_.line,k.line+1,V);var te=ie(e,"changes"),ae=ie(e,"change");if(ae||te){var pe={from:_,to:k,text:t.text,removed:t.removed,origin:t.origin};ae&&wr(e,"change",e,pe),te&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(pe)}e.display.selForContextMenu=null}function ti(e,t,n,r,i){var _;r||(r=n),dt(r,n)<0&&(_=[r,n],n=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),ei(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var _=e[i],k=!0;if(_.ranges){_.copied||(_=e[i]=_.deepCopy(),_.copied=!0);for(var j=0;j<_.ranges.length;j++)Qo(_.ranges[j].anchor,t,n,r),Qo(_.ranges[j].head,t,n,r);continue}for(var K=0;K<_.changes.length;++K){var V=_.changes[K];if(n<V.from.line)V.from=Le(V.from.line+r,V.from.ch),V.to=Le(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 qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function wi(e,t,n,r){var i=t,_=t;return typeof t=="number"?_=Oe(e,Mt(e,t)):i=Ot(t),i==null?null:(r(_,i)&&e.cm&&bn(e.cm,i,n),_)}function Ci(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}Ci.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,vt(i),wr(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 Ai(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}Ai.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var _=Math.min(t,i-e),k=r.height;if(r.removeInner(e,_),this.height-=k-r.height,i==_&&(this.children.splice(n--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ci))){var j=[];this.collapse(j),this.children=[new Ci(j)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<=_){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var k=i.lines.length%25+25,j=k;j<i.lines.length;){var K=new Ci(i.lines.slice(j,j+=25));i.height-=K.height,this.children.splice(++r,0,K),K.parent=this}i.lines=i.lines.slice(0,k),this.maybeSpill()}break}e-=_}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ai(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=le(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Ai(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<_){var k=Math.min(t,_-e);if(i.iterN(e,k,n))return!0;if((t-=k)==0)break;e=0}else e-=_}}};var Li=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Li.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ot(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 _=mi(this);Ht(n,Math.max(0,n.height-_)),e&&(Hr(e,function(){es(e,n,-_),bn(e,r,"widget")}),wr(e,"lineWidgetCleared",e,this,r))},Li.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;un(this.doc,r)||Ht(r,r.height+i),n&&Hr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),wr(n,"lineWidgetChanged",n,e,Ot(r))})},se(Li);function es(e,t,n){en(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,n)}function xl(e,t,n,r){var i=new Li(e,n,r),_=e.cm;return _&&i.noHScroll&&(_.display.alignWidgets=!0),wi(e,t,"widget",function(k){var j=k.widgets||(k.widgets=[]);if(i.insertAt==null?j.push(i):j.splice(Math.min(j.length-1,Math.max(0,i.insertAt)),0,i),i.line=k,_&&!un(e,k)){var K=en(k)<e.scrollTop;Ht(k,k.height+mi(i)),K&&wa(_,i.height),_.curOp.forceUpdate=!0}return!0}),_&&wr(_,"lineWidgetAdded",_,i,typeof t=="number"?t:Ot(t)),i}var ts=0,wn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};wn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Bn(e),ie(this,"clear")){var n=this.find();n&&wr(this,"clear",n.from,n.to)}for(var r=null,i=null,_=0;_<this.lines.length;++_){var k=this.lines[_],j=gt(k.markedSpans,this);e&&!this.collapsed?bn(e,Ot(k),"text"):e&&(j.to!=null&&(i=Ot(k)),j.from!=null&&(r=Ot(k))),k.markedSpans=at(k.markedSpans,j),j.from==null&&this.collapsed&&!un(this.doc,k)&&e&&Ht(k,Xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var V=$r(this.lines[K]),te=ci(V);te>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=te,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Nr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&wr(e,"markerCleared",e,this,r,i),t&&jn(e),this.parent&&this.parent.clear()},wn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var _=this.lines[i],k=gt(_.markedSpans,this);if(k.from!=null&&(n=Le(t?_:Ot(_),k.from),e==-1))return n;if(k.to!=null&&(r=Le(t?_:Ot(_),k.to),e==1))return r}return n&&{from:n,to:r}},wn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Hr(r,function(){var i=t.line,_=Ot(t.line),k=ha(r,_);if(k&&(io(k),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!un(n.doc,i)&&n.height!=null){var j=n.height;n.height=null;var K=mi(n)-j;K&&Ht(i,i.height+K)}wr(r,"markerChanged",r,e)})},wn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||le(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},wn.prototype.detachLine=function(e){if(this.lines.splice(le(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},se(wn);function ri(e,t,n,r,i){if(r&&r.shared)return _l(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Er(e.cm,ri)(e,t,n,r,i);var _=new wn(e,i),k=dt(t,n);if(r&&U(r,_,!1),k>0||k==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=v("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(Fi(e,t.line,t,n,_)||t.line!=n.line&&Fi(e,n.line,t,n,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");me()}_.addToHistory&&No(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var j=t.line,K=e.cm,V;if(e.iter(j,n.line+1,function(ae){K&&_.collapsed&&!K.options.lineWrapping&&$r(ae)==K.display.maxLine&&(V=!0),_.collapsed&&j!=t.line&&Ht(ae,0),ct(ae,new Fe(_,j==t.line?t.ch:null,j==n.line?n.ch:null)),++j}),_.collapsed&&e.iter(t.line,n.line+1,function(ae){un(e,ae)&&Ht(ae,0)}),_.clearOnEnter&&be(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(Ze(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++ts,_.atomic=!0),K){if(V&&(K.curOp.updateMaxLine=!0),_.collapsed)Nr(K,t.line,n.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var te=t.line;te<=n.line;te++)bn(K,te,"text");_.atomic&&Go(K.doc),wr(K,"markerAdded",K,_)}return _}var Di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();wr(this,"clear")},Di.prototype.find=function(e,t){return this.primary.find(e,t)},se(Di);function _l(e,t,n,r,i){r=U(r),r.shared=!1;var _=[ri(e,t,n,r,i)],k=_[0],j=r.widgetNode;return Sn(e,function(K){j&&(r.widgetNode=j.cloneNode(!0)),_.push(ri(K,pt(K,t),pt(K,n),r,i));for(var V=0;V<K.linked.length;++V)if(K.linked[V].isParent)return;k=Ee(_)}),new Di(_,k)}function rs(e){return e.findMarks(Le(e.first,0),e.clipPos(Le(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),_=e.clipPos(i.from),k=e.clipPos(i.to);if(dt(_,k)){var j=ri(e,_,k,r.primary,r.primary.type);r.markers.push(j),j.parent=r}}}function Sl(e){for(var t=function(r){var i=e[r],_=[i.primary.doc];Sn(i.primary.doc,function(K){return _.push(K)});for(var k=0;k<i.markers.length;k++){var j=i.markers[k];le(_,j.doc)==-1&&(j.parent=null,i.markers.splice(k--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Fr=function(e,t,n,r,i){if(!(this instanceof Fr))return new Fr(e,t,n,r,i);n==null&&(n=0),Ai.call(this,[new Ci([new Pn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var _=Le(n,0);this.sel=_n(_),this.history=new Ji(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:_,to:_,text:e}),Rr(this,_n(_),ge)};Fr.prototype=ze(Ai.prototype,{constructor:Fr,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=Ut(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:br(function(e){var t=Le(this.first,0),n=this.first+this.size-1;ei(this,{from:t,to:Le(n,Oe(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&vi(this.cm,0,0),Rr(this,_n(t),ge)}),replaceRange:function(e,t,n,r){t=pt(this,t),n=n?pt(this,n):t,ti(this,e,t,n,r)},getRange:function(e,t,n){var r=Xt(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(Vt(this,e))return Oe(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Oe(this,e)),$r(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:br(function(e,t,n){Wo(this,pt(this,typeof e=="number"?Le(e,t||0):e),null,n)}),setSelection:br(function(e,t,n){Wo(this,pt(this,e),pt(this,t||e),n)}),extendSelection:br(function(e,t,n){Zi(this,pt(this,e),t&&pt(this,t),n)}),extendSelections:br(function(e,t){jo(this,ke(this,e),t)}),extendSelectionsBy:br(function(e,t){var n=Be(this.sel.ranges,e);jo(this,ke(this,n),t)}),setSelections:br(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Jt(pt(this,e[i].anchor),pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Rr(this,rn(this.cm,r,t),n)}),addSelection:br(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Jt(pt(this,e),pt(this,t||e))),Rr(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=Xt(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=Xt(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:br(function(e,t,n){for(var r=[],i=this.sel,_=0;_<i.ranges.length;_++){var k=i.ranges[_];r[_]={from:k.from(),to:k.to(),text:this.splitLines(e[_]),origin:n}}for(var j=t&&t!="end"&&fl(this,r,t),K=r.length-1;K>=0;K--)ei(this,r[K]);j?Ho(this,j):this.cm&&Jn(this.cm)}),undo:br(function(){ta(this,"undo")}),redo:br(function(){ta(this,"redo")}),undoSelection:br(function(){ta(this,"undo",!0)}),redoSelection:br(function(){ta(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 Ji(this.history.maxGeneration),Sn(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:Zn(this.history.done),undone:Zn(this.history.undone)}},setHistory:function(e){var t=this.history=new Ji(this.history.maxGeneration);t.done=Zn(e.done.slice(0),null,!0),t.undone=Zn(e.undone.slice(0),null,!0)},setGutterMarker:br(function(e,t,n){return wi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ue(i)&&(r.gutterMarkers=null),!0})}),clearGutter:br(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&wi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ue(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Vt(this,e))return null;if(t=e,e=Oe(this,e),!e)return null}else if(t=Ot(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:br(function(e,t,n){return wi(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(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:br(function(e,t,n){return wi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[i];if(_)if(n==null)r[i]=null;else{var k=_.match(y(n));if(!k)return!1;var j=k.index+k[0].length;r[i]=_.slice(0,k.index)+(!k.index||j==_.length?"":" ")+_.slice(j)||null}else return!1;return!0})}),addLineWidget:br(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ri(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),ri(this,e,e,n,"bookmark")},findMarksAt:function(e){e=pt(this,e);var t=[],n=Oe(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(_){var k=_.markedSpans;if(k)for(var j=0;j<k.length;j++){var K=k[j];!(K.to!=null&&i==e.line&&e.ch>=K.to||K.from==null&&i!=e.line||K.from!=null&&i==t.line&&K.from>=t.ch)&&(!n||n(K.marker))&&r.push(K.marker.parent||K.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var _=i.text.length+r;if(_>e)return t=e,!0;e-=_,++n}),pt(this,Le(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 Fr(Ut(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 Fr(Ut(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}],Tl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof rr&&(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),Sl(rs(this));break}if(e.history==this.history){var r=[e.id];Sn(e,function(i){return r.push(i.id)},!0),e.history=new Ji(null),e.history.done=Zn(this.history.done,r),e.history.undone=Zn(this.history.undone,r)}},iterLinkedDocs:function(e){Sn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ge(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:br(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)})}),Fr.prototype.eachLine=Fr.prototype.iter;var ns=0;function Cl(e){var t=this;if(is(t),Re(t,e)||pn(t.display,e))return;Y(e),F&&(ns=+new Date);var n=In(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,_=Array(i),k=0,j=function(){++k==i&&Er(t,function(){n=pt(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(_.filter(function(Se){return Se!=null}).join(t.doc.lineSeparator())),origin:"paste"};ei(t.doc,ce),Ho(t.doc,_n(pt(t.doc,n),pt(t.doc,Tn(ce))))})()},K=function(ce,Se){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,ce.type)==-1){j();return}var Pe=new FileReader;Pe.onerror=function(){return j()},Pe.onload=function(){var We=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(We)){j();return}_[Se]=We,j()},Pe.readAsText(ce)},V=0;V<r.length;V++)K(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 te=e.dataTransfer.getData("Text");if(te){var ae;if(t.state.draggingText&&!t.state.draggingText.copy&&(ae=t.listSelections()),qi(t.doc,_n(n,n)),ae)for(var pe=0;pe<ae.length;++pe)ti(t.doc,"",ae[pe].anchor,ae[pe].head,"drag");t.replaceSelection(te,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Al(e,t){if(F&&(!e.state.draggingText||+new Date-ns<100)){ee(t);return}if(Re(e,t)||pn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!L){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",C&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),C&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=In(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var _=0;_<n.length;_++)e(n[_])})}var os=!1;function Dl(){if(os)return;Rl(),os=!0}function Rl(){var e;be(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Ol)},100))}),be(window,"blur",function(){return as($n)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Cn={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"},Ri=0;Ri<10;Ri++)Cn[Ri+48]=Cn[Ri+96]=String(Ri);for(var ra=65;ra<=90;ra++)Cn[ra]=String.fromCharCode(ra);for(var Oi=1;Oi<=12;Oi++)Cn[Oi+111]=Cn[Oi+63235]="F"+Oi;var gn={};gn.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"},gn.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"},gn.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"},gn.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"]},gn.default=d?gn.macDefault:gn.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,_,k=0;k<t.length-1;k++){var j=t[k];if(/^(cmd|meta|m)$/i.test(j))_=!0;else if(/^a(lt)?$/i.test(j))n=!0;else if(/^(c|ctrl|control)$/i.test(j))r=!0;else if(/^s(hift)?$/i.test(j))i=!0;else throw new Error("Unrecognized modifier name: "+j)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Be(n.split(" "),Pl),_=0;_<i.length;_++){var k=void 0,j=void 0;_==i.length-1?(j=i.join(" "),k=r):(j=i.slice(0,_+1).join(" "),k="...");var K=t[j];if(!K)t[j]=k;else if(K!=k)throw new Error("Inconsistent bindings for "+j)}delete e[n]}for(var V in t)e[V]=t[V];return e}function ni(e,t,n,r){t=na(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 ni(e,t.fallthrough,n,r);for(var _=0;_<t.fallthrough.length;_++){var k=ni(e,t.fallthrough[_],n,r);if(k)return k}}}function ss(e){var t=typeof e=="string"?e:Cn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(C&&e.keyCode==34&&e.char)return!1;var n=Cn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function na(e){return typeof e=="string"?gn[e]:e}function ii(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var _=t(n[i]);r.length&&dt(_.from,Ee(r).to)<=0;){var k=r.pop();if(dt(k.from,_.from)<0){_.from=k.from;break}}r.push(_)}Hr(e,function(){for(var j=r.length-1;j>=0;j--)ti(e.doc,"",r[j].from,r[j].to,"+delete");Jn(e)})}function Na(e,t,n){var r=Te(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Fa(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Le(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var _=tt(n,t.doc.direction);if(_){var k=i<0?Ee(_):_[0],j=i<0==(k.level==1),K=j?"after":"before",V;if(k.level>0||t.doc.direction=="rtl"){var te=Vn(t,n);V=i<0?n.text.length-1:0;var ae=cn(t,te,V).top;V=rt(function(pe){return cn(t,te,pe).top==ae},i<0==(k.level==1)?k.from:k.to-1,V),K=="before"&&(V=Na(n,V,1))}else V=i<0?k.to:k.from;return new Le(r,V,K)}}return new Le(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=tt(t,e.doc.direction);if(!i)return Fa(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 _=Xe(i,n.ch,n.sticky),k=i[_];if(e.doc.direction=="ltr"&&k.level%2==0&&(r>0?k.to>n.ch:k.from<n.ch))return Fa(t,n,r);var j=function($e,ot){return Na(t,$e instanceof Le?$e.ch:$e,ot)},K,V=function($e){return e.options.lineWrapping?(K=K||Vn(e,t),fo(e,t,K,$e)):{begin:0,end:t.text.length}},te=V(n.sticky=="before"?j(n,-1):n.ch);if(e.doc.direction=="rtl"||k.level==1){var ae=k.level==1==r<0,pe=j(n,ae?1:-1);if(pe!=null&&(ae?pe<=k.to&&pe<=te.end:pe>=k.from&&pe>=te.begin)){var ce=ae?"before":"after";return new Le(n.line,pe,ce)}}var Se=function($e,ot,Je){for(var ft=function(qt,xr){return xr?new Le(n.line,j(qt,1),"before"):new Le(n.line,qt,"after")};$e>=0&&$e<i.length;$e+=ot){var wt=i[$e],xt=ot>0==(wt.level!=1),It=xt?Je.begin:j(Je.end,-1);if(wt.from<=It&&It<wt.to)return ft(It,xt);if(It=xt?wt.from:j(wt.to,-1),Je.begin<=It&&It<Je.end)return ft(It,xt)}},Pe=Se(_+r,r,te);if(Pe)return Pe;var We=r>0?te.end:j(te.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Pe=Se(r>0?0:i.length-1,r,V(We)),Pe)?Pe:null}var Pi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ge)},killLine:function(e){return ii(e,function(t){if(t.empty()){var n=Oe(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Le(t.head.line+1,0)}:{from:t.head,to:Le(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ii(e,function(t){return{from:Le(t.from().line,0),to:pt(e.doc,Le(t.to().line+1,0))}})},delLineLeft:function(e){return ii(e,function(t){return{from:Le(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ii(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 ii(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(Le(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Le(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},he)},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")},he)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},he)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var _=n[i].from(),k=X(e.getLine(_.line),_.ch,r);t.push(Z(r-k%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,_=Oe(e.doc,i.line).text;if(_){if(i.ch==_.length&&(i=new Le(i.line,i.ch-1)),i.ch>0)i=new Le(i.line,i.ch+1),e.replaceRange(_.charAt(i.ch-1)+_.charAt(i.ch-2),Le(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var k=Oe(e.doc,i.line-1).text;k&&(i=new Le(i.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+k.charAt(k.length-1),Le(i.line-1,k.length-1),i,"+transpose"))}}n.push(new Jt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Hr(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);Jn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=Oe(e.doc,t),r=$r(n);return r!=n&&(t=Ot(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=Oe(e.doc,t),r=Bi(n);return r!=n&&(t=Ot(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=Oe(e.doc,n.line),i=tt(r,e.doc.direction);if(!i||i[0].level==0){var _=Math.max(n.ch,r.text.search(/\S/)),k=t.line==n.line&&t.ch<=_&&t.ch;return Le(n.line,k?0:_,n.sticky)}return n}function ia(e,t,n){if(typeof t=="string"&&(t=Pi[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)!=we}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=ni(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&ni(t,e.options.extraKeys,n,e)||ni(t,e.options.keyMap,n,e)}var Nl=new ne;function Mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&wr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),_a(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Mi(e,"Shift-"+n,t,function(r){return ia(e,r,!0)})||Mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ia(e,r)}):Mi(e,n,t,function(r){return ia(e,r)}):!1}function Fl(e,t,n){return Mi(e,"'"+n+"'",t,function(r){return ia(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),Re(t,e))return;F&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);C&&(ja=r?n:null,!r&&n==88&&!Ct&&(d?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!d&&!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;N(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}be(document,"keyup",n),be(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Re(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(pn(t.display,e)||Re(t,e)||e.ctrlKey&&!e.altKey||d&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(C&&n==ja){ja=null,Y(e);return}if(C&&(!e.which||e.which<10)&&hs(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,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var ki,Ii;function Wl(e,t){var n=+new Date;return Ii&&Ii.compare(n,e,t)?(ki=Ii=null,"triple"):ki&&ki.compare(n,e,t)?(Ii=new Wa(n,e,t),ki=null,"double"):(ki=new Wa(n,e,t),Ii=null,"single")}function vs(e){var t=this,n=t.display;if(Re(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,pn(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=In(t,e),i=ye(e),_=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,_,e))return;i==1?r?Gl(t,r,_,e):re(e)==n.scroller&&Y(e):i==2?(r&&Zi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(l?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,Mi(e,ls(_,i),i,function(k){if(typeof k=="string"&&(k=Pi[k]),!k)return!1;var j=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),j=k(e,n)!=we}finally{e.state.suppressEdits=!1}return j})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var _=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=_?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=d?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(d?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){F?setTimeout(B(vo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),_=e.doc.sel,k;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(k=_.contains(t))>-1&&(dt((k=_.ranges[k]).from(),t)<0||t.xRel>0)&&(dt(k.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,_=!1,k=Er(e,function(V){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",k),Ye(i.wrapper.ownerDocument,"mousemove",j),Ye(i.scroller,"dragstart",K),Ye(i.scroller,"drop",k),_||(Y(V),r.addNew||Zi(e.doc,n,null,null,r.extend),R&&!L||F&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),j=function(V){_=_||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},K=function(){return _=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=k,k.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),be(i.wrapper.ownerDocument,"mouseup",k),be(i.wrapper.ownerDocument,"mousemove",j),be(i.scroller,"dragstart",K),be(i.scroller,"drop",k),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new Jt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Jt(Le(t.line,0),pt(e.doc,Le(t.line+1,0)));var r=n(e,t);return new Jt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,_=e.doc;Y(t);var k,j,K=_.sel,V=K.ranges;if(r.addNew&&!r.extend?(j=_.sel.contains(n),j>-1?k=V[j]:k=new Jt(n,n)):(k=_.sel.primary(),j=_.sel.primIndex),r.unit=="rectangle")r.addNew||(k=new Jt(n,n)),n=In(e,t,!0,!0),j=-1;else{var te=ys(e,n,r.unit);r.extend?k=Ia(k,te.anchor,te.head,r.extend):k=te}r.addNew?j==-1?(j=V.length,Rr(_,rn(e,V.concat([k]),j),{scroll:!1,origin:"*mouse"})):V.length>1&&V[j].empty()&&r.unit=="char"&&!r.extend?(Rr(_,rn(e,V.slice(0,j).concat(V.slice(j+1)),0),{scroll:!1,origin:"*mouse"}),K=_.sel):Ua(_,j,k,ve):(j=0,Rr(_,new Qr([k],0),ve),K=_.sel);var ae=n;function pe(Je){if(dt(ae,Je)==0)return;if(ae=Je,r.unit=="rectangle"){for(var ft=[],wt=e.options.tabSize,xt=X(Oe(_,n.line).text,n.ch,wt),It=X(Oe(_,Je.line).text,Je.ch,wt),qt=Math.min(xt,It),xr=Math.max(xt,It),ir=Math.min(n.line,Je.line),Kr=Math.min(e.lastLine(),Math.max(n.line,Je.line));ir<=Kr;ir++){var Br=Oe(_,ir).text,hr=fe(Br,qt,wt);qt==xr?ft.push(new Jt(Le(ir,hr),Le(ir,hr))):Br.length>hr&&ft.push(new Jt(Le(ir,hr),Le(ir,fe(Br,xr,wt))))}ft.length||ft.push(new Jt(n,n)),Rr(_,rn(e,K.ranges.slice(0,j).concat(ft),j),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var jr=k,Cr=ys(e,Je,r.unit),vr=jr.anchor,mr;dt(Cr.anchor,vr)>0?(mr=Cr.head,vr=ar(jr.from(),Cr.anchor)):(mr=Cr.anchor,vr=on(jr.to(),Cr.head));var lr=K.ranges.slice(0);lr[j]=Xl(e,new Jt(pt(_,vr),mr)),Rr(_,rn(e,lr,j),ve)}}var ce=i.wrapper.getBoundingClientRect(),Se=0;function Pe(Je){var ft=++Se,wt=In(e,Je,!0,r.unit=="rectangle");if(!wt)return;if(dt(wt,ae)!=0){e.curOp.focus=D(),pe(wt);var xt=Vi(i,_);(wt.line>=xt.to||wt.line<xt.from)&&setTimeout(Er(e,function(){Se==ft&&Pe(Je)}),150)}else{var It=Je.clientY<ce.top?-20:Je.clientY>ce.bottom?20:0;It&&setTimeout(Er(e,function(){if(Se!=ft)return;i.scroller.scrollTop+=It,Pe(Je)}),50)}}function We(Je){e.state.selectingText=!1,Se=Infinity,Je&&(Y(Je),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",$e),Ye(i.wrapper.ownerDocument,"mouseup",ot),_.history.lastSelOrigin=null}var $e=Er(e,function(Je){Je.buttons===0||!ye(Je)?We(Je):Pe(Je)}),ot=Er(e,We);e.state.selectingText=ot,be(i.wrapper.ownerDocument,"mousemove",$e),be(i.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var n=t.anchor,r=t.head,i=Oe(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var _=tt(i);if(!_)return t;var k=Xe(_,n.ch,n.sticky),j=_[k];if(j.from!=n.ch&&j.to!=n.ch)return t;var K=k+(j.from==n.ch==(j.level!=1)?0:1);if(K==0||K==_.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var te=Xe(_,r.ch,r.sticky),ae=te-k||(r.ch-n.ch)*(j.level==1?-1:1);te==K-1||te==K?V=ae<0:V=ae>0}var pe=_[K+(V?-1:0)],ce=V==(pe.level==1),Se=ce?pe.from:pe.to,Pe=ce?"after":"before";return n.ch==Se&&n.sticky==Pe?t:new Jt(new Le(n.line,Se,Pe),r)}function Es(e,t,n,r){var i,_;if(t.touches)i=t.touches[0].clientX,_=t.touches[0].clientY;else try{i=t.clientX,_=t.clientY}catch(pe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var k=e.display,j=k.lineDiv.getBoundingClientRect();if(_>j.bottom||!ie(e,n))return J(t);_-=j.top-k.viewOffset;for(var K=0;K<e.display.gutterSpecs.length;++K){var V=k.gutters.childNodes[K];if(V&&V.getBoundingClientRect().right>=i){var te=pr(e.doc,_),ae=e.display.gutterSpecs[K];return xe(e,n,e,te,ae.className,t),J(t)}}}function Ha(e,t){return Es(e,t,"gutterClick",!0)}function bs(e,t){if(pn(e.display,t)||Yl(e,t))return;if(Re(e,t,"contextmenu"))return;l||e.display.input.onContextMenu(t)}function Yl(e,t){return ie(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pi(e)}var ai={toString:function(){return"CodeMirror.Init"}},_s={},aa={};function $l(e){var t=e.optionHandlers;function n(r,i,_,k){e.defaults[r]=i,_&&(t[r]=k?function(j,K,V){V!=ai&&_(j,K,V)}:_)}e.defineOption=n,e.Init=ai,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ti(r),pi(r),Nr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var _=[],k=r.doc.first;r.doc.iter(function(K){for(var V=0;;){var te=K.text.indexOf(i,V);if(te==-1)break;V=te+i.length,_.push(Le(k,te))}k++});for(var j=_.length-1;j>=0;j--)ti(r.doc,i,_[j],Le(_[j].line,_[j].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,_){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),_!=ai&&r.refresh()}),n("specialCharPlaceholder",Zt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),_i(r)},!0),n("keyMap","default",function(r,i,_){var k=na(i),j=_!=ai&&na(_);j&&j.detach&&j.detach(r,k),k.attach&&k.attach(r,j||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),_i(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ba(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Qn(r)},!0),n("scrollbarStyle","native",function(r){So(r),Qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),_i(r)},!0),n("firstLineNumber",1,_i,!0),n("lineNumberFormatter",function(r){return r},_i,!0),n("showCursorWhenSelecting",!1,gi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&($n(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gi,!0),n("singleCursorHeightPerLine",!0,gi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ti,!0),n("addModeClass",!1,Ti,!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,Ti,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=ai;if(!t!=!r){var i=e.display.dragFunctions,_=t?be:Ye;_(e.display.scroller,"dragstart",i.start),_(e.display.scroller,"dragenter",i.enter),_(e.display.scroller,"dragover",i.over),_(e.display.scroller,"dragleave",i.leave),_(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),ji(e)),xa(e),Nr(e),pi(e),setTimeout(function(){return Qn(e)},100)}function rr(e,t){var n=this;if(!(this instanceof rr))return new rr(e,t);this.options=t=t?U(t):{},U(_s,t,!1);var r=t.value;typeof r=="string"?r=new Fr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new rr.inputStyles[t.inputStyle](this),_=this.display=new dl(e,r,i,t);_.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),So(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&&!o&&_.input.focus(),F&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),Bn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):$n(this);for(var k in aa)aa.hasOwnProperty(k)&&aa[k](this,t[k],ai);Ao(this),t.finishInit&&t.finishInit(this);for(var j=0;j<Ka.length;++j)Ka[j](this);jn(this),R&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}rr.defaults=_s,rr.optionHandlers=aa;function Zl(e){var t=e.display;be(t.scroller,"mousedown",Er(e,vs)),F&&I<11?be(t.scroller,"dblclick",Er(e,function(K){if(Re(e,K))return;var V=In(e,K);if(!V||Ha(e,K)||pn(e.display,K))return;Y(K);var te=e.findWordAt(V);Zi(e.doc,te.anchor,te.head)})):be(t.scroller,"dblclick",function(K){return Re(e,K)||Y(K)}),be(t.scroller,"contextmenu",function(K){return bs(e,K)}),be(t.input.getField(),"contextmenu",function(K){t.scroller.contains(K.target)||bs(e,K)});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 _(K){if(K.touches.length!=1)return!1;var V=K.touches[0];return V.radiusX<=1&&V.radiusY<=1}function k(K,V){if(V.left==null)return!0;var te=V.left-K.left,ae=V.top-K.top;return te*te+ae*ae>20*20}be(t.scroller,"touchstart",function(K){if(!Re(e,K)&&!_(K)&&!Ha(e,K)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},K.touches.length==1&&(t.activeTouch.left=K.touches[0].pageX,t.activeTouch.top=K.touches[0].pageY)}}),be(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),be(t.scroller,"touchend",function(K){var V=t.activeTouch;if(V&&!pn(t,K)&&V.left!=null&&!V.moved&&new Date-V.start<300){var te=e.coordsChar(t.activeTouch,"page"),ae;!V.prev||k(V,V.prev)?ae=new Jt(te,te):!V.prev.prev||k(V,V.prev.prev)?ae=e.findWordAt(te):ae=new Jt(Le(te.line,0),pt(e.doc,Le(te.line+1,0))),e.setSelection(ae.anchor,ae.head),e.focus(),Y(K)}i()}),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yi(e,t.scroller.scrollTop),Nn(e,t.scroller.scrollLeft,!0),xe(e,"scroll",e))}),be(t.scroller,"mousewheel",function(K){return Ro(e,K)}),be(t.scroller,"DOMMouseScroll",function(K){return Ro(e,K)}),be(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(K){Re(e,K)||ee(K)},over:function(K){Re(e,K)||(Ll(e,K),ee(K))},start:function(K){return Al(e,K)},drop:Er(e,Cl),leave:function(K){Re(e,K)||is(e)}};var j=t.input.getField();be(j,"keyup",function(K){return ps.call(e,K)}),be(j,"keydown",Er(e,ms)),be(j,"keypress",Er(e,gs)),be(j,"focus",function(K){return Ta(e,K)}),be(j,"blur",function(K){return $n(e,K)})}var Ka=[];rr.defineInitHook=function(e){return Ka.push(e)};function Ui(e,t,n,r){var i=e.doc,_;n==null&&(n="add"),n=="smart"&&(i.mode.indent?_=Gr(e,t).state:n="prev");var k=e.options.tabSize,j=Oe(i,t),K=X(j.text,null,k);j.stateAfter&&(j.stateAfter=null);var V=j.text.match(/^\s*/)[0],te;if(!r&&!/\S/.test(j.text))te=0,n="not";else if(n=="smart"&&(te=i.mode.indent(_,j.text.slice(V.length),j.text),te==we||te>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?te=X(Oe(i,t-1).text,null,k):te=0:n=="add"?te=K+e.options.indentUnit:n=="subtract"?te=K-e.options.indentUnit:typeof n=="number"&&(te=K+n),te=Math.max(0,te);var ae="",pe=0;if(e.options.indentWithTabs)for(var ce=Math.floor(te/k);ce;--ce)pe+=k,ae+=" ";if(pe<te&&(ae+=Z(te-pe)),ae!=V)return ti(i,ae,Le(t,0),Le(t,V.length),"+input"),j.stateAfter=null,!0;for(var Se=0;Se<i.sel.ranges.length;Se++){var Pe=i.sel.ranges[Se];if(Pe.head.line==t&&Pe.head.ch<V.length){var We=Le(t,V.length);Ua(i,Se,new Jt(We,We));break}}}var nn=null;function oa(e){nn=e}function Ga(e,t,n,r,i){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var k=+new Date-200,j=i=="paste"||e.state.pasteIncoming>k,K=Ge(t),V=null;if(j&&r.ranges.length>1)if(nn&&nn.text.join(`
|
|
`)==t){if(r.ranges.length%nn.text.length==0){V=[];for(var te=0;te<nn.text.length;te++)V.push(_.splitLines(nn.text[te]))}}else K.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=Be(K,function($e){return[$e]}));for(var ae=e.curOp.updateInput,pe=r.ranges.length-1;pe>=0;pe--){var ce=r.ranges[pe],Se=ce.from(),Pe=ce.to();ce.empty()&&(n&&n>0?Se=Le(Se.line,Se.ch-n):e.state.overwrite&&!j?Pe=Le(Pe.line,Math.min(Oe(_,Pe.line).text.length,Pe.ch+Ee(K).length)):j&&nn&&nn.lineWise&&nn.text.join(`
|
|
`)==K.join(`
|
|
`)&&(Se=Pe=Le(Se.line,0)));var We={from:Se,to:Pe,text:V?V[pe%V.length]:K,origin:i||(j?"paste":e.state.cutIncoming>k?"cut":"+input")};ei(e.doc,We),wr(e,"inputRead",e,We)}t&&!j&&Ss(e,t),Jn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ae),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ts(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hr(t,function(){return Ga(t,n,0,null,"paste")}),!0}function Ss(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var _=e.getModeAt(i.head),k=!1;if(_.electricChars){for(var j=0;j<_.electricChars.length;j++)if(t.indexOf(_.electricChars.charAt(j))>-1){k=Ui(e,i.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(Oe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(k=Ui(e,i.head.line,"smart")));k&&wr(e,"electricInput",e,i.head.line)}}function ws(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,_={anchor:Le(i,0),head:Le(i+1,0)};n.push(_),t.push(e.getRange(_.anchor,_.head))}return{text:t,ranges:n}}function Cs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),Cs(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var _=this.options,k=_[r];if(_[r]==i&&r!="mode")return;_[r]=i,t.hasOwnProperty(r)&&Er(this,t[r])(this,i,k),xe(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"](na(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,_=0;_<i.length;++_)if(i[_]==r||i[_].name==r)return i.splice(_,1),!0},addOverlay:Mr(function(r,i){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");Ne(this.state.overlays,{mode:_,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(k){return k.priority}),this.state.modeGen++,Nr(this)}),removeOverlay:Mr(function(r){for(var i=this.state.overlays,_=0;_<i.length;++_){var k=i[_].modeSpec;if(k==r||typeof r=="string"&&k.name==r){i.splice(_,1),this.state.modeGen++,Nr(this);return}}}),indentLine:Mr(function(r,i,_){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Vt(this.doc,r)&&Ui(this,r,i,_)}),indentSelection:Mr(function(r){for(var i=this.doc.sel.ranges,_=-1,k=0;k<i.length;k++){var j=i[k];if(j.empty())j.head.line>_&&(Ui(this,j.head.line,r,!0),_=j.head.line,k==this.doc.sel.primIndex&&Jn(this));else{var K=j.from(),V=j.to(),te=Math.max(_,K.line);_=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ae=te;ae<_;++ae)Ui(this,ae,r);var pe=this.doc.sel.ranges;K.ch==0&&i.length==pe.length&&pe[k].from().ch>0&&Ua(this.doc,k,new Jt(K,pe[k].to()),ge)}}}),getTokenAt:function(r,i){return Rn(this,r,i)},getLineTokens:function(r,i){return Rn(this,Le(r),i,!0)},getTokenTypeAt:function(r){r=pt(this.doc,r);var i=hn(this,Oe(this.doc,r.line)),_=0,k=(i.length-1)/2,j=r.ch,K;if(j==0)K=i[2];else for(;;){var V=_+k>>1;if((V?i[V*2-1]:0)>=j)k=V;else if(i[V*2+1]<j)_=V+1;else{K=i[V*2+2];break}}var te=K?K.indexOf("overlay "):-1;return te<0?K:te==0?null:K.slice(0,te-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var _=[];if(!n.hasOwnProperty(i))return _;var k=n[i],j=this.getModeAt(r);if(typeof j[i]=="string")k[j[i]]&&_.push(k[j[i]]);else if(j[i])for(var K=0;K<j[i].length;K++){var V=k[j[i][K]];V&&_.push(V)}else j.helperType&&k[j.helperType]?_.push(k[j.helperType]):k[j.name]&&_.push(k[j.name]);for(var te=0;te<k._global.length;te++){var ae=k._global[te];ae.pred(j,this)&&le(_,ae.val)==-1&&_.push(ae.val)}return _},getStateAfter:function(r,i){var _=this.doc;return r=Mt(_,r==null?_.first+_.size-1:r),Gr(this,r+1,i).state},cursorCoords:function(r,i){var _,k=this.doc.sel.primary();return r==null?_=k.head:typeof r=="object"?_=pt(this.doc,r):_=r?k.from():k.to(),tn(this,_,i||"page")},charCoords:function(r,i){return pa(this,pt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,pr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,_){var k=!1,j;if(typeof r=="number"){var K=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>K&&(r=K,k=!0),j=Oe(this.doc,r)}else j=r;return Hi(this,j,{top:0,left:0},i||"page",_||k).top+(k?this.doc.height-en(j):0)},defaultTextHeight:function(){return Xn(this.display)},defaultCharWidth:function(){return Yn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,_,k,j){var K=this.display;r=tn(this,pt(this.doc,r));var V=r.bottom,te=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),K.sizer.appendChild(i),k=="over")V=r.top;else if(k=="above"||k=="near"){var ae=Math.max(K.wrapper.clientHeight,this.doc.height),pe=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(k=="above"||r.bottom+i.offsetHeight>ae)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ae&&(V=r.bottom),te+i.offsetWidth>pe&&(te=pe-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",j=="right"?(te=K.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(j=="left"?te=0:j=="middle"&&(te=(K.sizer.clientWidth-i.offsetWidth)/2),i.style.left=te+"px"),_&&Js(this,{left:te,top:V,right:te+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:Mr(ms),triggerOnKeyPress:Mr(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Mr(vs),execCommand:function(r){if(Pi.hasOwnProperty(r))return Pi[r].call(null,this)},triggerElectric:Mr(function(r){Ss(this,r)}),findPosH:function(r,i,_,k){var j=1;i<0&&(j=-1,i=-i);for(var K=pt(this.doc,r),V=0;V<i&&!(K=za(this.doc,K,j,_,k),K.hitSide);++V);return K},moveH:Mr(function(r,i){var _=this;this.extendSelectionsBy(function(k){return _.display.shift||_.doc.extend||k.empty()?za(_.doc,k.head,r,i,_.options.rtlMoveVisually):r<0?k.from():k.to()},he)}),deleteH:Mr(function(r,i){var _=this.doc.sel,k=this.doc;_.somethingSelected()?k.replaceSelection("",null,"+delete"):ii(this,function(j){var K=za(k,j.head,r,i,!1);return r<0?{from:K,to:j.head}:{from:j.head,to:K}})}),findPosV:function(r,i,_,k){var j=1,K=k;i<0&&(j=-1,i=-i);for(var V=pt(this.doc,r),te=0;te<i;++te){var ae=tn(this,V,"div");if(K==null?K=ae.left:ae.left=K,V=Ls(this,ae,j,_),V.hitSide)break}return V},moveV:Mr(function(r,i){var _=this,k=this.doc,j=[],K=!this.display.shift&&!k.extend&&k.sel.somethingSelected();if(k.extendSelectionsBy(function(te){if(K)return r<0?te.from():te.to();var ae=tn(_,te.head,"div");te.goalColumn!=null&&(ae.left=te.goalColumn),j.push(ae.left);var pe=Ls(_,ae,r,i);return i=="page"&&te==k.sel.primary()&&wa(_,pa(_,pe,"div").top-ae.top),pe},he),j.length)for(var V=0;V<k.sel.ranges.length;V++)k.sel.ranges[V].goalColumn=j[V]}),findWordAt:function(r){var i=this.doc,_=Oe(i,r.line).text,k=r.ch,j=r.ch;if(_){var K=this.getHelper(r,"wordChars");(r.sticky=="before"||j==_.length)&&k?--k:++j;for(var V=_.charAt(k),te=Me(V,K)?function(ae){return Me(ae,K)}:/\s/.test(V)?function(ae){return/\s/.test(ae)}:function(ae){return!/\s/.test(ae)&&!Me(ae)};k>0&&te(_.charAt(k-1));)--k;for(;j<_.length&&te(_.charAt(j));)++j}return new Jt(Le(r.line,k),Le(r.line,j))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),xe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Mr(function(r,i){vi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-dn(this)-this.display.barHeight,width:r.scrollWidth-dn(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Mn(this)}},scrollIntoView:Mr(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:Le(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):bo(this,r.from,r.to,r.margin)}),setSize:Mr(function(r,i){var _=this,k=function(K){return typeof K=="number"||/^\d+$/.test(String(K))?K+"px":K};r!=null&&(this.display.wrapper.style.width=k(r)),i!=null&&(this.display.wrapper.style.height=k(i)),this.options.lineWrapping&&ao(this);var j=this.display.viewFrom;this.doc.iter(j,this.display.viewTo,function(K){if(K.widgets){for(var V=0;V<K.widgets.length;V++)if(K.widgets[V].noHScroll){bn(_,j,"widget");break}}++j}),this.curOp.forceUpdate=!0,xe(this,"refresh",this)}),operation:function(r){return Hr(this,r)},startOperation:function(){return Bn(this)},endOperation:function(){return jn(this)},refresh:Mr(function(){var r=this.display.cachedTextHeight;Nr(this),this.curOp.forceUpdate=!0,pi(this),vi(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Xn(this.display))>.5||this.options.lineWrapping)&&xa(this),xe(this,"refresh",this)}),swapDoc:Mr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,r),pi(this),this.display.input.reset(),vi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,wr(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}},se(e),e.registerHelper=function(r,i,_){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=_},e.registerGlobalHelper=function(r,i,_,k){e.registerHelper(r,i,k),n[r]._global.push({pred:_,val:k})}}function za(e,t,n,r,i){var _=t,k=n,j=Oe(e,t.line),K=i&&e.direction=="rtl"?-n:n;function V(){var ot=t.line+K;return ot<e.first||ot>=e.first+e.size?!1:(t=new Le(ot,t.ch,t.sticky),j=Oe(e,ot))}function te(ot){var Je;if(r=="codepoint"){var ft=j.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ft)?Je=null:Je=new Le(t.line,Math.max(0,Math.min(j.text.length,t.ch+n*(ft>=55296&&ft<56320?2:1))),-n)}else i?Je=kl(e.cm,j,t,n):Je=Fa(j,t,n);if(Je==null)if(!ot&&V())t=Ba(i,e.cm,j,t.line,K);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")te();else if(r=="column")te(!0);else if(r=="word"||r=="group")for(var ae=null,pe=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),Se=!0;!(n<0&&!te(!Se));Se=!1){var Pe=j.text.charAt(t.ch)||`
|
|
`,We=Me(Pe,ce)?"w":pe&&Pe==`
|
|
`?"n":!pe||/\s/.test(Pe)?null:"p";if(pe&&!Se&&!We&&(We="s"),ae&&ae!=We){n<0&&(n=1,te(),t.sticky="after");break}if(We&&(ae=We),n>0&&!te(!Se))break}var $e=ea(e,t,_,k,!0);return Ar(_,$e)&&($e.hitSide=!0),$e}function Ls(e,t,n,r){var i=e.doc,_=t.left,k;if(r=="page"){var j=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),K=Math.max(j-.5*Xn(e.display),3);k=(n>0?t.bottom:t.top)+n*K}else r=="line"&&(k=n>0?t.bottom+3:t.top-3);for(var V;!(V=va(e,_,k),!V.outside);){if(n<0?k<=0:k>=i.height){V.hitSide=!0;break}k+=n*5}return V}var Qt=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};Qt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Cs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(j){for(var K=j.target;K;K=K.parentNode){if(K==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(K.className))break}return!1}be(i,"paste",function(j){if(!_(j)||Re(r,j)||Ts(j,r))return;I<=11&&setTimeout(Er(r,function(){return t.updateFromDOM()}),20)}),be(i,"compositionstart",function(j){t.composing={data:j.data,done:!1}}),be(i,"compositionupdate",function(j){t.composing||(t.composing={data:j.data,done:!1})}),be(i,"compositionend",function(j){t.composing&&(j.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(i,"touchstart",function(){return n.forceCompositionEnd()}),be(i,"input",function(){t.composing||t.readFromDOMSoon()});function k(j){if(!_(j)||Re(r,j))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),j.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var K=ws(r);oa({lineWise:!0,text:K.text}),j.type=="cut"&&r.operation(function(){r.setSelections(K.ranges,0,ge),r.replaceSelection("",null,"cut")})}else return;if(j.clipboardData){j.clipboardData.clearData();var V=nn.text.join(`
|
|
`);if(j.clipboardData.setData("Text",V),j.clipboardData.getData("Text")==V){j.preventDefault();return}}var te=As(),ae=te.firstChild;r.display.lineSpace.insertBefore(te,r.display.lineSpace.firstChild),ae.value=nn.text.join(`
|
|
`);var pe=document.activeElement;z(ae),setTimeout(function(){r.display.lineSpace.removeChild(te),pe.focus(),pe==i&&n.showPrimarySelection()},50)}be(i,"copy",k),be(i,"cut",k)},Qt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Qt.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},Qt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Qt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Qt.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 _=sa(t,e.anchorNode,e.anchorOffset),k=sa(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&k&&!k.bad&&dt(ar(_,k),r)==0&&dt(on(_,k),i)==0)return;var j=t.display.view,K=r.line>=t.display.viewFrom&&Ds(t,r)||{node:j[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ds(t,i);if(!V){var te=j[j.length-1].measure,ae=te.maps?te.maps[te.maps.length-1]:te.map;V={node:ae[ae.length-1],offset:ae[ae.length-2]-ae[ae.length-3]}}if(!K||!V){e.removeAllRanges();return}var pe=e.rangeCount&&e.getRangeAt(0),ce;try{ce=p(K.node,K.offset,V.offset,V.node)}catch(Se){}ce&&(!A&&t.state.focused?(e.collapse(K.node,K.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),pe&&e.anchorNode==null?e.addRange(pe):A&&this.startGracePeriod()),this.rememberSelection()},Qt.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)},Qt.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},Qt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Qt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},Qt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Qt.prototype.blur=function(){this.div.blur()},Qt.prototype.getField=function(){return this.div},Qt.prototype.supportsTouch=function(){return!0},Qt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Hr(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)},Qt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Qt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(c&&b&&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=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);n&&r&&Hr(t,function(){Rr(t.doc,_n(n,r),ge),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Qt.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=Le(r.line-1,Oe(e.doc,r.line-1).length)),i.ch==Oe(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Le(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var _,k,j;r.line==t.viewFrom||(_=Un(e,r.line))==0?(k=Ot(t.view[0].line),j=t.view[0].node):(k=Ot(t.view[_].line),j=t.view[_-1].node.nextSibling);var K=Un(e,i.line),V,te;if(K==t.view.length-1?(V=t.viewTo-1,te=t.lineDiv.lastChild):(V=Ot(t.view[K+1].line)-1,te=t.view[K+1].node.previousSibling),!j)return!1;for(var ae=e.doc.splitLines(tu(e,j,te,k,V)),pe=Xt(e.doc,Le(k,0),Le(V,Oe(e.doc,V).text.length));ae.length>1&&pe.length>1;)if(Ee(ae)==Ee(pe))ae.pop(),pe.pop(),V--;else if(ae[0]==pe[0])ae.shift(),pe.shift(),k++;else break;for(var ce=0,Se=0,Pe=ae[0],We=pe[0],$e=Math.min(Pe.length,We.length);ce<$e&&Pe.charCodeAt(ce)==We.charCodeAt(ce);)++ce;for(var ot=Ee(ae),Je=Ee(pe),ft=Math.min(ot.length-(ae.length==1?ce:0),Je.length-(pe.length==1?ce:0));Se<ft&&ot.charCodeAt(ot.length-Se-1)==Je.charCodeAt(Je.length-Se-1);)++Se;if(ae.length==1&&pe.length==1&&k==r.line)for(;ce&&ce>r.ch&&ot.charCodeAt(ot.length-Se-1)==Je.charCodeAt(Je.length-Se-1);)ce--,Se++;ae[ae.length-1]=ot.slice(0,ot.length-Se).replace(/^\u200b+/,""),ae[0]=ae[0].slice(ce).replace(/\u200b+$/,"");var wt=Le(k,ce),xt=Le(V,pe.length?Ee(pe).length-Se:0);if(ae.length>1||ae[0]||dt(wt,xt))return ti(e.doc,ae,wt,xt,"+input"),!0},Qt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qt.prototype.reset=function(){this.forceCompositionEnd()},Qt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Qt.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)},Qt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hr(this.cm,function(){return Nr(e.cm)})},Qt.prototype.setUneditable=function(e){e.contentEditable="false"},Qt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Er(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Qt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qt.prototype.onContextMenu=function(){},Qt.prototype.resetPosition=function(){},Qt.prototype.needsContentAttribute=!0;function Ds(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=Oe(e.doc,t.line),i=eo(n,r,t.line),_=tt(r,e.doc.direction),k="left";if(_){var j=Xe(_,t.ch);k=j%2?"right":"left"}var K=no(i.map,t.ch,k);return K.offset=K.collapse=="right"?K.end:K.start,K}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function oi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var _="",k=!1,j=e.doc.lineSeparator(),K=!1;function V(ce){return function(Se){return Se.id==ce}}function te(){k&&(_+=j,K&&(_+=j),k=K=!1)}function ae(ce){ce&&(te(),_+=ce)}function pe(ce){if(ce.nodeType==1){var Se=ce.getAttribute("cm-text");if(Se){ae(Se);return}var Pe=ce.getAttribute("cm-marker"),We;if(Pe){var $e=e.findMarks(Le(r,0),Le(i+1,0),V(+Pe));$e.length&&(We=$e[0].find(0))&&ae(Xt(e.doc,We.from,We.to).join(j));return}if(ce.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;ot&&te();for(var Je=0;Je<ce.childNodes.length;Je++)pe(ce.childNodes[Je]);/^(pre|p)$/i.test(ce.nodeName)&&(K=!0),ot&&(k=!0)}else ce.nodeType==3&&ae(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(pe(t),t==n);)t=t.nextSibling,K=!1;return _}function sa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return oi(e.clipPos(Le(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var _=e.display.view[i];if(_.node==r)return ru(_,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return oi(Le(Ot(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var _=e.rest?Ee(e.rest):e.line;return oi(Le(Ot(_),_.text.length),i)}var k=t.nodeType==3?t:null,j=t;for(!k&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(k=t.firstChild,n&&(n=k.nodeValue.length));j.parentNode!=r;)j=j.parentNode;var K=e.measure,V=K.maps;function te(We,$e,ot){for(var Je=-1;Je<(V?V.length:0);Je++)for(var ft=Je<0?K.map:V[Je],wt=0;wt<ft.length;wt+=3){var xt=ft[wt+2];if(xt==We||xt==$e){var It=Ot(Je<0?e.line:e.rest[Je]),qt=ft[wt]+ot;return(ot<0||xt!=We)&&(qt=ft[wt+(ot?1:0)]),Le(It,qt)}}}var ae=te(k,j,n);if(ae)return oi(ae,i);for(var pe=j.nextSibling,ce=k?k.nodeValue.length-n:0;pe;pe=pe.nextSibling){if(ae=te(pe,pe.firstChild,0),ae)return oi(Le(ae.line,ae.ch-ce),i);ce+=pe.textContent.length}for(var Se=j.previousSibling,Pe=n;Se;Se=Se.previousSibling){if(ae=te(Se,Se.firstChild,-1),ae)return oi(Le(ae.line,ae.ch+Pe),i);Pe+=Se.textContent.length}}var cr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ne,this.hasSelection=!1,this.composing=null};cr.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),T&&(i.style.width="0px"),be(i,"input",function(){F&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),be(i,"paste",function(k){if(Re(r,k)||Ts(k,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function _(k){if(Re(r,k))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var j=ws(r);oa({lineWise:!0,text:j.text}),k.type=="cut"?r.setSelections(j.ranges,null,ge):(n.prevInput="",i.value=j.text.join(`
|
|
`),z(i))}else return;k.type=="cut"&&(r.state.cutIncoming=+new Date)}be(i,"cut",_),be(i,"copy",_),be(e.scroller,"paste",function(k){if(pn(e,k)||Re(r,k))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var j=new Event("paste");j.clipboardData=k.clipboardData,i.dispatchEvent(j)}),be(e.lineSpace,"selectstart",function(k){pn(e,k)||Y(k)}),be(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"})}}),be(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},cr.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},cr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},cr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=tn(e,n.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),k=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+k.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+k.left-_.left))}return r},cr.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},cr.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&&z(this.textarea),F&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&I>=9&&(this.hasSelection=null))},cr.prototype.getField=function(){return this.textarea},cr.prototype.supportsTouch=function(){return!1},cr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},cr.prototype.blur=function(){this.textarea.blur()},cr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},cr.prototype.receivedFocus=function(){this.slowPoll()},cr.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()})},cr.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)},cr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||lt(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(F&&I>=9&&this.hasSelection===i||d&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=i.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var k=0,j=Math.min(r.length,i.length);k<j&&r.charCodeAt(k)==i.charCodeAt(k);)++k;return Hr(t,function(){Ga(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},cr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},cr.prototype.onKeyPress=function(){F&&I>=9&&(this.hasSelection=null),this.fastPoll()},cr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=In(n,e),k=r.scroller.scrollTop;if(!_||C)return;var j=n.options.resetSelectionOnContextMenu;j&&n.doc.sel.contains(_)==-1&&Er(n,Rr)(n.doc,_n(_),ge);var K=i.style.cssText,V=t.wrapper.style.cssText,te=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-te.top-5)+"px; left: "+(e.clientX-te.left-5)+`px;
|
|
z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ae;R&&(ae=window.scrollY),r.input.focus(),R&&window.scrollTo(null,ae),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function pe(){if(i.selectionStart!=null){var Pe=n.somethingSelected(),We="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=K,F&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=k),i.selectionStart!=null){(!F||F&&I<9)&&pe();var Pe=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Er(n,Xo)(n):Pe++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(F&&I>=9&&pe(),l){ee(e);var Se=function(){Ye(window,"mouseup",Se),setTimeout(ce,20)};be(window,"mouseup",Se)}else setTimeout(ce,50)},cr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},cr.prototype.setUneditable=function(){},cr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?U(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=j.getValue()}var i;if(e.form&&(be(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;i=_.submit;try{var k=_.submit=function(){r(),_.submit=i,_.submit(),_.submit=k}}catch(K){}}t.finishInit=function(K){K.save=r,K.getTextArea=function(){return e},K.toTextArea=function(){K.toTextArea=isNaN,r(),e.parentNode.removeChild(K.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var j=rr(function(K){return e.parentNode.insertBefore(K,e.nextSibling)},t);return j}function iu(e){e.off=Ye,e.on=be,e.wheelEventPixels=cl,e.Doc=Fr,e.splitLines=Ge,e.countColumn=X,e.findColumn=fe,e.isWordChar=Ce,e.Pass=we,e.signal=xe,e.Line=Pn,e.changeEnd=Tn,e.scrollbarModel=To,e.Pos=Le,e.cmpPos=dt,e.modes=Gt,e.mimeModes=bt,e.resolveMode=Bt,e.getMode=kt,e.modeExtensions=Pt,e.extendMode=jt,e.copyState=At,e.startState=mt,e.innerMode=Tt,e.commands=Pi,e.keyMap=gn,e.keyName=us,e.isModifierKey=ss,e.lookupKey=ni,e.normalizeKeyMap=Ml,e.StringStream=et,e.SharedTextMarker=Di,e.TextMarker=wn,e.LineWidget=Li,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=ee,e.addClass=N,e.contains=E,e.rmClass=f,e.keyNames=Cn}$l(rr),ql(rr);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Fr.prototype)Fr.prototype.hasOwnProperty(la)&&le(au,la)<0&&(rr.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Fr.prototype[la]));return se(Fr),rr.inputStyles={textarea:cr,contenteditable:Qt},rr.defineMode=function(e){!rr.defaults.mode&&e!="null"&&(rr.defaults.mode=e),zt.apply(this,arguments)},rr.defineMIME=Wt,rr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),rr.defineMIME("text/plain","null"),rr.defineExtension=function(e,t){rr.prototype[e]=t},rr.defineDocExtension=function(e,t){Fr.prototype[e]=t},rr.fromTextArea=nu,iu(rr),rr.version="5.58.2",rr})},Y1PL:function(yt,it,Q){"use strict";Q.r(it),Q.d(it,"ResizableTextArea",function(){return le});var q=Q("wx14"),G=Q("1OyB"),A=Q("vuIU"),H=Q("Ji7U"),M=Q("LK+K"),P=Q("cDcd"),F=Q("VTBJ"),I=Q("rePB"),R=Q("Zm9Q"),O=Q("Kwbf"),b=Q("c+Xe"),C=Q("m+aA"),L=Q("bdgK"),S=new Map;function w(ge){ge.forEach(function(ve){var he,fe=ve.target;(he=S.get(fe))===null||he===void 0||he.forEach(function(oe){return oe(fe)})})}var T=new L.default(w),c=null,o=null;function d(ge,ve){S.has(ge)||(S.set(ge,new Set),T.observe(ge)),S.get(ge).add(ve)}function u(ge,ve){S.has(ge)&&(S.get(ge).delete(ve),S.get(ge).size||(T.unobserve(ge),S.delete(ge)))}var x=function(ge){Object(H.a)(he,ge);var ve=Object(M.a)(he);function he(){return Object(G.a)(this,he),ve.apply(this,arguments)}return Object(A.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(P.Component),g=P.createContext(null);function m(ge){var ve=ge.children,he=ge.onBatchResize,fe=P.useRef(0),oe=P.useRef([]),Z=P.useContext(g),Ee=P.useCallback(function(Be,Ne,He){fe.current+=1;var ze=fe.current;oe.current.push({size:Be,element:Ne,data:He}),Promise.resolve().then(function(){ze===fe.current&&(he==null||he(oe.current),oe.current=[])}),Z==null||Z(Be,Ne,He)},[he,Z]);return P.createElement(g.Provider,{value:Ee},ve)}function l(ge){var ve=ge.children,he=ge.disabled,fe=P.useRef(null),oe=P.useRef(null),Z=P.useContext(g),Ee=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Be=P.isValidElement(ve)&&Object(b.c)(ve),Ne=Be?ve.ref:null,He=P.useMemo(function(){return Object(b.a)(Ne,fe)},[Ne,fe]),ze=P.useRef(ge);ze.current=ge;var Ae=P.useCallback(function(Ce){var Me=ze.current,Ue=Me.onResize,Ie=Me.data,De=Ce.getBoundingClientRect(),Te=De.width,rt=De.height,Qe=Ce.offsetWidth,Ve=Ce.offsetHeight,Xe=Math.floor(Te),ut=Math.floor(rt);if(Ee.current.width!==Xe||Ee.current.height!==ut||Ee.current.offsetWidth!==Qe||Ee.current.offsetHeight!==Ve){var tt={width:Xe,height:ut,offsetWidth:Qe,offsetHeight:Ve};Ee.current=tt;var qe=Qe===Math.round(Te)?Te:Qe,be=Ve===Math.round(rt)?rt:Ve,nt=Object(F.a)(Object(F.a)({},tt),{},{offsetWidth:qe,offsetHeight:be});Z==null||Z(nt,Ce,Ie),Ue&&Promise.resolve().then(function(){Ue(nt,Ce)})}},[]);return P.useEffect(function(){var Ce=Object(C.a)(fe.current)||Object(C.a)(oe.current);return Ce&&!he&&d(Ce,Ae),function(){return u(Ce,Ae)}},[fe.current,he]),P.createElement(x,{ref:oe},Be?P.cloneElement(ve,{ref:He}):ve)}var y="rc-observer-key";function f(ge){var ve=ge.children,he=Object(R.a)(ve);return he.map(function(fe,oe){var Z=(fe==null?void 0:fe.key)||"".concat(y,"-").concat(oe);return P.createElement(l,Object(q.a)({},ge,{key:Z}),fe)})}f.Collection=m;var h=f,s=Q("bT9E"),a=Q("TSYQ"),v=Q.n(a),p=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],D={},N;function W(ge){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=ge.getAttribute("id")||ge.getAttribute("data-reactid")||ge.getAttribute("name");if(ve&&D[he])return D[he];var fe=window.getComputedStyle(ge),oe=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),Ee=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),Be=E.map(function(He){return"".concat(He,":").concat(fe.getPropertyValue(He))}).join(";"),Ne={sizingStyle:Be,paddingSize:Z,borderSize:Ee,boxSizing:oe};return ve&&he&&(D[he]=Ne),Ne}function z(ge){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),ge.getAttribute("wrap")?N.setAttribute("wrap",ge.getAttribute("wrap")):N.removeAttribute("wrap");var oe=W(ge,ve),Z=oe.paddingSize,Ee=oe.borderSize,Be=oe.boxSizing,Ne=oe.sizingStyle;N.setAttribute("style","".concat(Ne,";").concat(p)),N.value=ge.value||ge.placeholder||"";var He=Number.MIN_SAFE_INTEGER,ze=Number.MAX_SAFE_INTEGER,Ae=N.scrollHeight,Ce;if(Be==="border-box"?Ae+=Ee:Be==="content-box"&&(Ae-=Z),he!==null||fe!==null){N.value=" ";var Me=N.scrollHeight-Z;he!==null&&(He=Me*he,Be==="border-box"&&(He=He+Z+Ee),Ae=Math.max(He,Ae)),fe!==null&&(ze=Me*fe,Be==="border-box"&&(ze=ze+Z+Ee),Ce=Ae>ze?"":"hidden",Ae=Math.min(ze,Ae))}return{height:Ae,minHeight:He,maxHeight:ze,overflowY:Ce,resize:"none"}}var B=Q("Gytx"),U=Q.n(B),X;(function(ge){ge[ge.NONE=0]="NONE",ge[ge.RESIZING=1]="RESIZING",ge[ge.RESIZED=2]="RESIZED"})(X||(X={}));var ne=function(ge){Object(H.a)(he,ge);var ve=Object(M.a)(he);function he(fe){var oe;return Object(G.a)(this,he),oe=ve.call(this,fe),oe.nextFrameActionId=void 0,oe.resizeFrameId=void 0,oe.textArea=void 0,oe.saveTextArea=function(Z){oe.textArea=Z},oe.handleResize=function(Z){var Ee=oe.state.resizeStatus,Be=oe.props,Ne=Be.autoSize,He=Be.onResize;if(Ee!==X.NONE)return;typeof He=="function"&&He(Z),Ne&&oe.resizeOnNextFrame()},oe.resizeOnNextFrame=function(){cancelAnimationFrame(oe.nextFrameActionId),oe.nextFrameActionId=requestAnimationFrame(oe.resizeTextarea)},oe.resizeTextarea=function(){var Z=oe.props.autoSize;if(!Z||!oe.textArea)return;var Ee=Z.minRows,Be=Z.maxRows,Ne=z(oe.textArea,!1,Ee,Be);oe.setState({textareaStyles:Ne,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(oe.resizeFrameId),oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:X.RESIZED},function(){oe.resizeFrameId=requestAnimationFrame(function(){oe.setState({resizeStatus:X.NONE}),oe.fixFirefoxAutoScroll()})})})})},oe.renderTextArea=function(){var Z=oe.props,Ee=Z.prefixCls,Be=Ee===void 0?"rc-textarea":Ee,Ne=Z.autoSize,He=Z.onResize,ze=Z.className,Ae=Z.disabled,Ce=oe.state,Me=Ce.textareaStyles,Ue=Ce.resizeStatus,Ie=Object(s.a)(oe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=v()(Be,ze,Object(I.a)({},"".concat(Be,"-disabled"),Ae));"value"in Ie&&(Ie.value=Ie.value||"");var Te=Object(F.a)(Object(F.a)(Object(F.a)({},oe.props.style),Me),Ue===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(h,{onResize:oe.handleResize,disabled:!(Ne||He)},P.createElement("textarea",Object(q.a)({},Ie,{className:De,style:Te,ref:oe.saveTextArea})))},oe.state={textareaStyles:{},resizeStatus:X.NONE},oe}return Object(A.a)(he,[{key:"componentDidUpdate",value:function(oe){(oe.value!==this.props.value||!U()(oe.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var oe=this.textArea.selectionStart,Z=this.textArea.selectionEnd;this.textArea.setSelectionRange(oe,Z)}}catch(Ee){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(P.Component),le=ne,de=function(ge){Object(H.a)(he,ge);var ve=Object(M.a)(he);function he(fe){var oe;Object(G.a)(this,he),oe=ve.call(this,fe),oe.resizableTextArea=void 0,oe.focus=function(){oe.resizableTextArea.textArea.focus()},oe.saveTextArea=function(Ee){oe.resizableTextArea=Ee},oe.handleChange=function(Ee){var Be=oe.props.onChange;oe.setValue(Ee.target.value,function(){oe.resizableTextArea.resizeTextarea()}),Be&&Be(Ee)},oe.handleKeyDown=function(Ee){var Be=oe.props,Ne=Be.onPressEnter,He=Be.onKeyDown;Ee.keyCode===13&&Ne&&Ne(Ee),He&&He(Ee)};var Z=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return oe.state={value:Z},oe}return Object(A.a)(he,[{key:"setValue",value:function(oe,Z){"value"in this.props||this.setState({value:oe},Z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(le,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(oe){return"value"in oe?{value:oe.value}:null}}]),he}(P.Component),we=it.default=de},ZWs3:function(yt,it,Q){"use strict";Q.d(it,"a",function(){return b});var q=Q("+L6B"),G=Q("2/Rp"),A=Q("0Owb"),H=Q("9og8"),M=Q("tJVT"),P=Q("PpiC"),F=Q("WmNS"),I=Q.n(F),R=Q("cDcd"),O=Q.n(R),b=function(L){var S=L.children,w=Object(P.a)(L,["children"]),T=Object(R.useState)(!1),c=Object(M.a)(T,2),o=c[0],d=c[1];return O.a.createElement(G.a,Object(A.a)({},w,{loading:o,onClick:function(){var u=Object(H.a)(I.a.mark(function x(g){return I.a.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,d(!0),l.next=4,w.onClick(g);case 4:d(!1),l.next=10;break;case 7:l.prev=7,l.t0=l.catch(0),d(!1);case 10:case"end":return l.stop()}},x,null,[[0,7]])}));return function(x){return u.apply(this,arguments)}}()}),S)}},ZpRC:function(yt,it,Q){"use strict";function q(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function G(b,C){return(!C||b!=="hidden")&&b!=="visible"&&b!=="clip"}function A(b,C){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var L=getComputedStyle(b,null);return G(L.overflowY,C)||G(L.overflowX,C)||function(S){var w=function(T){if(!T.ownerDocument||!T.ownerDocument.defaultView)return null;try{return T.ownerDocument.defaultView.frameElement}catch(c){return null}}(S);return!!w&&(w.clientHeight<S.scrollHeight||w.clientWidth<S.scrollWidth)}(b)}return!1}function H(b,C,L,S,w,T,c,o){return T<b&&c>C||T>b&&c<C?0:T<=b&&o<=L||c>=C&&o>=L?T-b-S:c>C&&o<L||T<b&&o>L?c-C+w:0}var M=function(b,C){var L=window,S=C.scrollMode,w=C.block,T=C.inline,c=C.boundary,o=C.skipOverflowHiddenElements,d=typeof c=="function"?c:function(Me){return Me!==c};if(!q(b))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,x=[],g=b;q(g)&&d(g);){if((g=g.parentElement)===u){x.push(g);break}g!=null&&g===document.body&&A(g)&&!A(document.documentElement)||g!=null&&A(g,o)&&x.push(g)}for(var m=L.visualViewport?L.visualViewport.width:innerWidth,l=L.visualViewport?L.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=b.getBoundingClientRect(),s=h.height,a=h.width,v=h.top,p=h.right,E=h.bottom,D=h.left,N=w==="start"||w==="nearest"?v:w==="end"?E:v+s/2,W=T==="center"?D+a/2:T==="end"?p:D,z=[],B=0;B<x.length;B++){var U=x[B],X=U.getBoundingClientRect(),ne=X.height,le=X.width,de=X.top,we=X.right,ge=X.bottom,ve=X.left;if(S==="if-needed"&&v>=0&&D>=0&&E<=l&&p<=m&&v>=de&&E<=ge&&D>=ve&&p<=we)return z;var he=getComputedStyle(U),fe=parseInt(he.borderLeftWidth,10),oe=parseInt(he.borderTopWidth,10),Z=parseInt(he.borderRightWidth,10),Ee=parseInt(he.borderBottomWidth,10),Be=0,Ne=0,He="offsetWidth"in U?U.offsetWidth-U.clientWidth-fe-Z:0,ze="offsetHeight"in U?U.offsetHeight-U.clientHeight-oe-Ee:0;if(u===U)Be=w==="start"?N:w==="end"?N-l:w==="nearest"?H(f,f+l,l,oe,Ee,f+N,f+N+s,s):N-l/2,Ne=T==="start"?W:T==="center"?W-m/2:T==="end"?W-m:H(y,y+m,m,fe,Z,y+W,y+W+a,a),Be=Math.max(0,Be+f),Ne=Math.max(0,Ne+y);else{Be=w==="start"?N-de-oe:w==="end"?N-ge+Ee+ze:w==="nearest"?H(de,ge,ne,oe,Ee+ze,N,N+s,s):N-(de+ne/2)+ze/2,Ne=T==="start"?W-ve-fe:T==="center"?W-(ve+le/2)+He/2:T==="end"?W-we+Z+He:H(ve,we,le,fe,Z+He,W,W+a,a);var Ae=U.scrollLeft,Ce=U.scrollTop;N+=Ce-(Be=Math.max(0,Math.min(Ce+Be,U.scrollHeight-ne+ze))),W+=Ae-(Ne=Math.max(0,Math.min(Ae+Ne,U.scrollWidth-le+He)))}z.push({el:U,top:Be,left:Ne})}return z};function P(b){return b===Object(b)&&Object.keys(b).length!==0}function F(b,C){C===void 0&&(C="auto");var L="scrollBehavior"in document.body.style;b.forEach(function(S){var w=S.el,T=S.top,c=S.left;w.scroll&&L?w.scroll({top:T,left:c,behavior:C}):(w.scrollTop=T,w.scrollLeft=c)})}function I(b){return b===!1?{block:"end",inline:"nearest"}:P(b)?b:{block:"start",inline:"nearest"}}function R(b,C){var L=!b.ownerDocument.documentElement.contains(b);if(P(C)&&typeof C.behavior=="function")return C.behavior(L?[]:M(b,C));if(L)return;var S=I(C);return F(M(b,S),S.behavior)}var O=it.a=R},bT9E:function(yt,it,Q){"use strict";Q.d(it,"a",function(){return G});var q=Q("VTBJ");function G(A,H){var M=Object(q.a)({},A);return Array.isArray(H)&&H.forEach(function(P){delete M[P]}),M}},c5Ni:function(yt,it,Q){},dejd:function(yt,it,Q){},dmUQ:function(yt,it,Q){"use strict";var q=Q("Ff2n"),G=Q("rePB"),A=Q("1OyB"),H=Q("vuIU"),M=Q("Ji7U"),P=Q("md7G"),F=Q("foSv"),I=Q("cDcd"),R=Q.n(I),O=Q("TSYQ"),b=Q.n(O),C=Q("4IlW");function L(s,a){var v=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(s,E).enumerable})),v.push.apply(v,p)}return v}function S(s){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?L(Object(v),!0).forEach(function(p){Object(G.a)(s,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(v)):L(Object(v)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(v,p))})}return s}function w(s){var a=T();return function(){var p=Object(F.a)(s),E;if(a){var D=Object(F.a)(this).constructor;E=Reflect.construct(p,arguments,D)}else E=p.apply(this,arguments);return Object(P.a)(this,E)}}function T(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function c(){}function o(s){s.preventDefault()}var d=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,x=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},l=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},y=function(s){Object(M.a)(v,s);var a=w(v);function v(p){var E;Object(A.a)(this,v),E=a.call(this,p),E.onKeyDown=function(W){var z=E.props,B=z.onKeyDown,U=z.onPressEnter;if(W.keyCode===C.a.UP){var X=E.getRatio(W);E.up(W,X,null),E.stop()}else if(W.keyCode===C.a.DOWN){var ne=E.getRatio(W);E.down(W,ne,null),E.stop()}else W.keyCode===C.a.ENTER&&U&&U(W);if(E.recordCursorPosition(),E.lastKeyCode=W.keyCode,B){for(var le=arguments.length,de=new Array(le>1?le-1:0),we=1;we<le;we++)de[we-1]=arguments[we];B.apply(void 0,[W].concat(de))}},E.onKeyUp=function(W){var z=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),z){for(var B=arguments.length,U=new Array(B>1?B-1:0),X=1;X<B;X++)U[X-1]=arguments[X];z.apply(void 0,[W].concat(U))}},E.onChange=function(W){var z=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(W)),E.setState({inputValue:E.rawInput}),z(E.toNumber(E.rawInput))},E.onMouseUp=function(){var W=E.props.onMouseUp;E.recordCursorPosition(),W&&W.apply(void 0,arguments)},E.onFocus=function(){var W;E.setState({focused:!0}),(W=E.props).onFocus.apply(W,arguments)},E.onBlur=function(){var W=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var z=E.getCurrentValidValue(E.state.inputValue),B=E.setValue(z,c);if(W){var U=E.input.value,X=E.getInputDisplayValue({focus:!1,value:B});E.input.value=X&&Number(X),W.apply(void 0,arguments),E.input.value=U}},E.getRatio=function(W){var z=1;return W.metaKey||W.ctrlKey?z=.1:W.shiftKey&&(z=10),z},E.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},E.getPrecision=function(W){if(m(E.props.precision))return E.props.precision;var z=String(W);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var B=0;return z.indexOf(".")>=0&&(B=z.length-z.indexOf(".")-1),B},E.getInputDisplayValue=function(W){var z=W||E.state,B=z.focused,U=z.inputValue,X=z.value,ne;B?ne=U:ne=E.toPrecisionAsStep(X),ne==null&&(ne="");var le=E.formatWrapper(ne);return m(E.props.decimalSeparator)&&(le=le.toString().replace(".",E.props.decimalSeparator)),le},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(W){}},E.restoreByAfter=function(W){if(W===void 0)return!1;var z=E.input.value,B=z.lastIndexOf(W);if(B===-1)return!1;var U=E.cursorBefore.length;return E.lastKeyCode===C.a.DELETE&&E.cursorBefore.charAt(U-1)===W[0]?(E.fixCaret(U,U),!0):B+W.length===z.length?(E.fixCaret(B,B),!0):!1},E.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(z,B){var U=W.substring(B);return E.restoreByAfter(U)})},E.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(W,z,B){E.pressingUpOrDown=!0,E.step("down",W,z,B)},E.up=function(W,z,B){E.pressingUpOrDown=!0,E.step("up",W,z,B)},E.saveInput=function(W){E.input=W};var D=p.value;D===void 0&&(D=p.defaultValue),E.state={focused:p.autoFocus};var N=E.getValidValue(E.toNumber(D));return E.state=S(S({},E.state),{},{inputValue:E.toPrecisionAsStep(N),value:N}),E}return Object(H.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var D=this.props,N=D.value,W=D.onChange,z=D.max,B=D.min,U=this.state.focused;if(E){if(!l(E.value,N)||!l(E.max,z)||!l(E.min,B)){var X=U?N:this.getValidValue(N),ne;this.pressingUpOrDown?ne=X:this.inputting?ne=this.rawInput:ne=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:ne})}var le="value"in this.props?N:this.state.value;"max"in this.props&&E.max!==z&&typeof le=="number"&&le>z&&W&&W(z),"min"in this.props&&E.min!==B&&typeof le=="number"&&le<B&&W&&W(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===C.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===C.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case C.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case C.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(we){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(E){var D=E;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(E){var D=E.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(E){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(E);return isNaN(W)?E:(W<D&&(W=D),W>N&&(W=N),W)}},{key:"setValue",value:function(E,D){var N=this.props.precision,W=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),z=this.state.value,B=z===void 0?null:z,U=this.state.inputValue,X=U===void 0?null:U,ne=typeof W=="number"?W.toFixed(N):"".concat(W),le=W!==B||ne!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},D)):this.setState({value:W,inputValue:this.toPrecisionAsStep(E)},D),le&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(E){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,W=N.precision,z=N.step;if(m(W))return W;var B=this.getPrecision(D),U=this.getPrecision(z),X=this.getPrecision(E);return E?Math.max(X,B+U):B+U}},{key:"getPrecisionFactor",value:function(E){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(E,D);return Math.pow(10,N)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var D=Math.abs(this.getMaxPrecision(E));return isNaN(D)?E.toString():Number(E).toFixed(D)}},{key:"toNumber",value:function(E){var D=this.props.precision,N=this.state.focused,W=E&&E.length>16&&N;return this.isNotCompleteNumber(E)||W?E:m(D)?Math.round(E*Math.pow(10,D))/Math.pow(10,D):Number(E)}},{key:"upStep",value:function(E,D){var N=this.props.step,W=this.getPrecisionFactor(E,D),z=Math.abs(this.getMaxPrecision(E,D)),B=((W*E+W*N*D)/W).toFixed(z);return this.toNumber(B)}},{key:"downStep",value:function(E,D){var N=this.props.step,W=this.getPrecisionFactor(E,D),z=Math.abs(this.getMaxPrecision(E,D)),B=((W*E-W*N*D)/W).toFixed(z);return this.toNumber(B)}},{key:"step",value:function(E,D){var N=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var B=this.props;if(B.disabled)return;var U=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(U))return;var X=this["".concat(E,"Step")](U,W),ne=X>B.max||X<B.min;if(X>B.max?X=B.max:X<B.min&&(X=B.min),this.setValue(X,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),ne)return;this.autoStepTimer=setTimeout(function(){N[E](D,W,!0)},z?u:x)}},{key:"fixCaret",value:function(E,D){if(E===void 0||D===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,W=this.input.selectionEnd;(E!==N||D!==W)&&this.input.setSelectionRange(E,D)}catch(z){}}},{key:"render",value:function(){var E,D=this.props,N=D.prefixCls,W=D.disabled,z=D.readOnly,B=D.useTouch,U=D.autoComplete,X=D.upHandler,ne=D.downHandler,le=D.className,de=D.max,we=D.min,ge=D.style,ve=D.title,he=D.onMouseEnter,fe=D.onMouseLeave,oe=D.onMouseOver,Z=D.onMouseOut,Ee=D.required,Be=D.onClick,Ne=D.tabIndex,He=D.type,ze=D.placeholder,Ae=D.id,Ce=D.inputMode,Me=D.pattern,Ue=D.step,Ie=D.maxLength,De=D.autoFocus,Te=D.name,rt=D.onPaste,Qe=D.onInput,Ve=Object(q.a)(D,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Xe=this.state,ut=Xe.value,tt=Xe.focused,qe=b()(N,(E={},Object(G.a)(E,le,!!le),Object(G.a)(E,"".concat(N,"-disabled"),W),Object(G.a)(E,"".concat(N,"-focused"),tt),E)),be={};Object.keys(Ve).forEach(function(ee){(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(be[ee]=Ve[ee])});var nt=!z&&!W,Ye=this.getInputDisplayValue(null),xe=(ut||ut===0)&&(isNaN(ut)||Number(ut)>=de),Re=(ut||ut===0)&&(isNaN(ut)||Number(ut)<=we),ue=xe||W||z,ie=Re||W||z,se=b()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(G.a)({},"".concat(N,"-handler-up-disabled"),ue)),Y=b()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(G.a)({},"".concat(N,"-handler-down-disabled"),ie)),$=B?{onTouchStart:ue?c:this.up,onTouchEnd:this.stop}:{onMouseDown:ue?c:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=B?{onTouchStart:ie?c:this.down,onTouchEnd:this.stop}:{onMouseDown:ie?c:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:qe,style:ge,title:ve,onMouseEnter:he,onMouseLeave:fe,onMouseOver:oe,onMouseOut:Z,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(N,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":ue,className:se}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ie,className:Y}),ne||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(N,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":we,"aria-valuemax":de,"aria-valuenow":ut,required:Ee,type:He,placeholder:ze,onPaste:rt,onClick:Be,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:Ne,autoComplete:U,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:nt?this.onKeyDown:c,onKeyUp:nt?this.onKeyUp:c,autoFocus:De,maxLength:Ie,readOnly:z,disabled:W,max:de,min:we,step:Ue,name:Te,title:ve,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:Me,inputMode:Ce,onInput:Qe},be))))}}]),v}(R.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:c,onKeyDown:c,onPressEnter:c,onFocus:c,onBlur:c,parser:d,required:!1,autoComplete:"off"};var f=y,h=it.a=f},kSUc:function(yt,it,Q){},kqOp:function(yt,it,Q){"use strict";Q.d(it,"a",function(){return O});var q=Q("0Owb"),G=Q("fWQN"),A=Q("mtLc"),H=Q("yKVA"),M=Q("879j"),P=Q("cDcd"),F=Q.n(P),I=Q("Ot1p"),R="\u2581",O=function(b){Object(H.a)(L,b);var C=Object(M.a)(L);function L(){var S;Object(G.a)(this,L);for(var w=arguments.length,T=new Array(w),c=0;c<w;c++)T[c]=arguments[c];return S=C.call.apply(C,[this].concat(T)),S.getChCountBeforeCursor=function(o,d){for(var u=d.line,x=0,g=0;g<u;g++)x+=o.getLine(g).split(R).length-1;var m=o.getLine(u).substring(0,d.ch);return x+=m.split(R).length-1,x},S.onCMBeforeChange=function(o,d){var u=o.getRange(d.from,d.to),x=0;if(d.text.forEach(function(y){x+=y.split(R).length-1}),u&&u.indexOf(R)!=-1){var g=u.split(R).length-1,m=S.getChCountBeforeCursor(o,d.from);console.log("\u5220\u9664".concat(g,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(m,"\u4E2A\uFF0C\u65B0\u589E").concat(x,"\u4E2A")),S.props.deleteEmptyDisabled?d.cancel():S.props.onPlaceholderChange&&S.props.onPlaceholderChange(m,g,x)}else if(x){var l=S.getChCountBeforeCursor(o,d.from);console.log("\u65B0\u589E".concat(x,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(l,"\u4E2A")),S.props.onPlaceholderChange&&S.props.onPlaceholderChange(l,0,x)}},S}return Object(A.a)(L,[{key:"render",value:function(){return F.a.createElement(I.a,Object(q.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),L}(P.Component)},lZu9:function(yt,it,Q){(function(q){q(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(G,A){var H=q.getMode(G,"text/html"),M=H.name=="null";function P(B){if(q.findModeByName){var U=q.findModeByName(B);U&&(B=U.mime||U.mimes[0])}var X=q.getMode(G,B);return X.name=="null"?null:X}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 F={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 F)F.hasOwnProperty(I)&&A.tokenTypeOverrides[I]&&(F[I]=A.tokenTypeOverrides[I]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,C=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,L=/^ {0,3}(?:\={1,}|-{2,})\s*$/,S=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,T=/^\s*\[[^\]]+?\]:.*$/,c=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function d(B,U,X){return U.f=U.inline=X,X(B,U)}function u(B,U,X){return U.f=U.block=X,X(B,U)}function x(B){return!B||!/\S/.test(B.string)}function g(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==l){var U=M;if(!U){var X=q.innerMode(H,B.htmlState);U=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}U&&(B.f=s,B.block=m,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function m(B,U){var X=B.column()===U.indentation,ne=x(U.prevLine.stream),le=U.indentedCode,de=U.prevLine.hr,we=U.list!==!1,ge=(U.listStack[U.listStack.length-1]||0)+3;U.indentedCode=!1;var ve=U.indentation;if(U.indentationDiff===null&&(U.indentationDiff=U.indentation,we)){for(U.list=null;ve<U.listStack[U.listStack.length-1];)U.listStack.pop(),U.listStack.length?U.indentation=U.listStack[U.listStack.length-1]:U.list=!1;U.list!==!1&&(U.indentationDiff=ve-U.listStack[U.listStack.length-1])}var he=!ne&&!de&&!U.prevLine.header&&(!we||!le)&&!U.prevLine.fencedCodeEnd,fe=(U.list===!1||de||ne)&&U.indentation<=ge&&B.match(R),oe=null;if(U.indentationDiff>=4&&(le||U.prevLine.fencedCodeEnd||U.prevLine.header||ne))return B.skipToEnd(),U.indentedCode=!0,F.code;if(B.eatSpace())return null;if(X&&U.indentation<=ge&&(oe=B.match(C))&&oe[1].length<=6)return U.quote=0,U.header=oe[1].length,U.thisLine.header=!0,A.highlightFormatting&&(U.formatting="header"),U.f=U.inline,f(U);if(U.indentation<=ge&&B.eat(">"))return U.quote=X?1:U.quote+1,A.highlightFormatting&&(U.formatting="quote"),B.eatSpace(),f(U);if(!fe&&!U.setext&&X&&U.indentation<=ge&&(oe=B.match(O))){var Z=oe[1]?"ol":"ul";return U.indentation=ve+B.current().length,U.list=!0,U.quote=0,U.listStack.push(U.indentation),U.em=!1,U.strong=!1,U.code=!1,U.strikethrough=!1,A.taskLists&&B.match(b,!1)&&(U.taskList=!0),U.f=U.inline,A.highlightFormatting&&(U.formatting=["list","list-"+Z]),f(U)}else{if(X&&U.indentation<=ge&&(oe=B.match(w,!0)))return U.quote=0,U.fencedEndRE=new RegExp(oe[1]+"+ *$"),U.localMode=A.fencedCodeBlockHighlighting&&P(oe[2]||A.fencedCodeBlockDefaultMode),U.localMode&&(U.localState=q.startState(U.localMode)),U.f=U.block=y,A.highlightFormatting&&(U.formatting="code-block"),U.code=-1,f(U);if(U.setext||(!he||!we)&&!U.quote&&U.list===!1&&!U.code&&!fe&&!T.test(B.string)&&(oe=B.lookAhead(1))&&(oe=oe.match(L)))return U.setext?(U.header=U.setext,U.setext=0,B.skipToEnd(),A.highlightFormatting&&(U.formatting="header")):(U.header=oe[0].charAt(0)=="="?1:2,U.setext=U.header),U.thisLine.header=!0,U.f=U.inline,f(U);if(fe)return B.skipToEnd(),U.hr=!0,U.thisLine.hr=!0,F.hr;if(B.peek()==="[")return d(B,U,D)}return d(B,U,U.inline)}function l(B,U){var X=H.token(B,U.htmlState);if(!M){var ne=q.innerMode(H,U.htmlState);(ne.mode.name=="xml"&&ne.state.tagStart===null&&!ne.state.context&&ne.state.tokenize.isInText||U.md_inside&&B.current().indexOf(">")>-1)&&(U.f=s,U.block=m,U.htmlState=null)}return X}function y(B,U){var X=U.listStack[U.listStack.length-1]||0,ne=U.indentation<X,le=X+3;if(U.fencedEndRE&&U.indentation<=le&&(ne||B.match(U.fencedEndRE))){A.highlightFormatting&&(U.formatting="code-block");var de;return ne||(de=f(U)),U.localMode=U.localState=null,U.block=m,U.f=s,U.fencedEndRE=null,U.code=0,U.thisLine.fencedCodeEnd=!0,ne?u(B,U,U.block):de}else return U.localMode?U.localMode.token(B,U.localState):(B.skipToEnd(),F.code)}function f(B){var U=[];if(B.formatting){U.push(F.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var X=0;X<B.formatting.length;X++)U.push(F.formatting+"-"+B.formatting[X]),B.formatting[X]==="header"&&U.push(F.formatting+"-"+B.formatting[X]+"-"+B.header),B.formatting[X]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=B.quote?U.push(F.formatting+"-"+B.formatting[X]+"-"+B.quote):U.push("error"))}if(B.taskOpen)return U.push("meta"),U.length?U.join(" "):null;if(B.taskClosed)return U.push("property"),U.length?U.join(" "):null;if(B.linkHref?U.push(F.linkHref,"url"):(B.strong&&U.push(F.strong),B.em&&U.push(F.em),B.strikethrough&&U.push(F.strikethrough),B.emoji&&U.push(F.emoji),B.linkText&&U.push(F.linkText),B.code&&U.push(F.code),B.image&&U.push(F.image),B.imageAltText&&U.push(F.imageAltText,"link"),B.imageMarker&&U.push(F.imageMarker)),B.header&&U.push(F.header,F.header+"-"+B.header),B.quote&&(U.push(F.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=B.quote?U.push(F.quote+"-"+B.quote):U.push(F.quote+"-"+A.maxBlockquoteDepth)),B.list!==!1){var ne=(B.listStack.length-1)%3;ne?ne===1?U.push(F.list2):U.push(F.list3):U.push(F.list1)}return B.trailingSpaceNewLine?U.push("trailing-space-new-line"):B.trailingSpace&&U.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),U.length?U.join(" "):null}function h(B,U){return B.match(S,!0)?f(U):void 0}function s(B,U){var X=U.text(B,U);if(typeof X!="undefined")return X;if(U.list)return U.list=null,f(U);if(U.taskList){var ne=B.match(b,!0)[1]===" ";return ne?U.taskOpen=!0:U.taskClosed=!0,A.highlightFormatting&&(U.formatting="task"),U.taskList=!1,f(U)}if(U.taskOpen=!1,U.taskClosed=!1,U.header&&B.match(/^#+$/,!0))return A.highlightFormatting&&(U.formatting="header"),f(U);var le=B.next();if(U.linkTitle){U.linkTitle=!1;var de=le;le==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(B.match(new RegExp(we),!0))return F.linkHref}if(le==="`"){var ge=U.formatting;A.highlightFormatting&&(U.formatting="code"),B.eatWhile("`");var ve=B.current().length;if(U.code==0&&(!U.quote||ve==1))return U.code=ve,f(U);if(ve==U.code){var he=f(U);return U.code=0,he}else return U.formatting=ge,f(U)}else if(U.code)return f(U);if(le==="\\"&&(B.next(),A.highlightFormatting)){var fe=f(U),oe=F.formatting+"-escape";return fe?fe+" "+oe:oe}if(le==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return U.imageMarker=!0,U.image=!0,A.highlightFormatting&&(U.formatting="image"),f(U);if(le==="["&&U.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return U.imageMarker=!1,U.imageAltText=!0,A.highlightFormatting&&(U.formatting="image"),f(U);if(le==="]"&&U.imageAltText){A.highlightFormatting&&(U.formatting="image");var fe=f(U);return U.imageAltText=!1,U.image=!1,U.inline=U.f=v,fe}if(le==="["&&!U.image)return U.linkText&&B.match(/^.*?\]/)||(U.linkText=!0,A.highlightFormatting&&(U.formatting="link")),f(U);if(le==="]"&&U.linkText){A.highlightFormatting&&(U.formatting="link");var fe=f(U);return U.linkText=!1,U.inline=U.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?v:s,fe}if(le==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,A.highlightFormatting&&(U.formatting="link");var fe=f(U);return fe?fe+=" ":fe="",fe+F.linkInline}if(le==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,A.highlightFormatting&&(U.formatting="link");var fe=f(U);return fe?fe+=" ":fe="",fe+F.linkEmail}if(A.xml&&le==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var Z=B.string.indexOf(">",B.pos);if(Z!=-1){var Ee=B.string.substring(B.start,Z);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(U.md_inside=!0)}return B.backUp(1),U.htmlState=q.startState(H),u(B,U,l)}if(A.xml&&le==="<"&&B.match(/^\/\w*?>/))return U.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var Be=1,Ne=B.pos==1?" ":B.string.charAt(B.pos-2);Be<3&&B.eat(le);)Be++;var He=B.peek()||" ",ze=!/\s/.test(He)&&(!c.test(He)||/\s/.test(Ne)||c.test(Ne)),Ae=!/\s/.test(Ne)&&(!c.test(Ne)||/\s/.test(He)||c.test(He)),Ce=null,Me=null;if(Be%2&&(!U.em&&ze&&(le==="*"||!Ae||c.test(Ne))?Ce=!0:U.em==le&&Ae&&(le==="*"||!ze||c.test(He))&&(Ce=!1)),Be>1&&(!U.strong&&ze&&(le==="*"||!Ae||c.test(Ne))?Me=!0:U.strong==le&&Ae&&(le==="*"||!ze||c.test(He))&&(Me=!1)),Me!=null||Ce!=null){A.highlightFormatting&&(U.formatting=Ce==null?"strong":Me==null?"em":"strong em"),Ce===!0&&(U.em=le),Me===!0&&(U.strong=le);var he=f(U);return Ce===!1&&(U.em=!1),Me===!1&&(U.strong=!1),he}}else if(le===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return f(U);B.backUp(1)}if(A.strikethrough){if(le==="~"&&B.eatWhile(le)){if(U.strikethrough){A.highlightFormatting&&(U.formatting="strikethrough");var he=f(U);return U.strikethrough=!1,he}else if(B.match(/^[^\s]/,!1))return U.strikethrough=!0,A.highlightFormatting&&(U.formatting="strikethrough"),f(U)}else if(le===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return f(U);B.backUp(2)}}if(A.emoji&&le===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){U.emoji=!0,A.highlightFormatting&&(U.formatting="emoji");var Ue=f(U);return U.emoji=!1,Ue}return le===" "&&(B.match(/^ +$/,!1)?U.trailingSpace++:U.trailingSpace&&(U.trailingSpaceNewLine=!0)),f(U)}function a(B,U){var X=B.next();if(X===">"){U.f=U.inline=s,A.highlightFormatting&&(U.formatting="link");var ne=f(U);return ne?ne+=" ":ne="",ne+F.linkInline}return B.match(/^[^>]+/,!0),F.linkInline}function v(B,U){if(B.eatSpace())return null;var X=B.next();return X==="("||X==="["?(U.f=U.inline=E(X==="("?")":"]"),A.highlightFormatting&&(U.formatting="link-string"),U.linkHref=!0,f(U)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(B){return function(U,X){var ne=U.next();if(ne===B){X.f=X.inline=s,A.highlightFormatting&&(X.formatting="link-string");var le=f(X);return X.linkHref=!1,le}return U.match(p[B]),X.linkHref=!0,f(X)}}function D(B,U){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(U.f=N,B.next(),A.highlightFormatting&&(U.formatting="link"),U.linkText=!0,f(U)):d(B,U,s)}function N(B,U){if(B.match(/^\]:/,!0)){U.f=U.inline=W,A.highlightFormatting&&(U.formatting="link");var X=f(U);return U.linkText=!1,X}return B.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function W(B,U){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?U.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),U.f=U.inline=s,F.linkHref+" url")}var z={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:h,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&q.copyState(H,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?q.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,U){if(U.formatting=!1,B!=U.thisLine.stream){if(U.header=0,U.hr=!1,B.match(/^\s*$/,!0))return g(U),null;if(U.prevLine=U.thisLine,U.thisLine={stream:B},U.taskList=!1,U.trailingSpace=0,U.trailingSpaceNewLine=!1,!U.localState&&(U.f=U.block,U.f!=l)){var X=B.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(U.indentation=X,U.indentationDiff=null,X>0)return null}}return U.f(B,U)},innerMode:function(B){return B.block==l?{state:B.htmlState,mode:H}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:z}},indent:function(B,U,X){return B.block==l&&H.indent?H.indent(B.htmlState,U,X):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,U,X):q.Pass},blankLine:g,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},osHv:function(yt,it,Q){(function(q){q(Q("VrN/"))})(function(q){"use strict";var G=q.Pos;function A(c,o){return c.line-o.line||c.ch-o.ch}var H="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",M=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+H+"]["+M+"]*)","g");function F(c,o,d,u){this.line=o,this.ch=d,this.cm=c,this.text=c.getLine(o),this.min=u?Math.max(u.from,c.firstLine()):c.firstLine(),this.max=u?Math.min(u.to-1,c.lastLine()):c.lastLine()}function I(c,o){var d=c.cm.getTokenTypeAt(G(c.line,o));return d&&/\btag\b/.test(d)}function R(c){return c.line>=c.max?void 0:(c.ch=0,c.text=c.cm.getLine(++c.line),!0)}function O(c){return c.line<=c.min?void 0:(c.text=c.cm.getLine(--c.line),c.ch=c.text.length,!0)}function b(c){for(;;){var o=c.text.indexOf(">",c.ch);if(o==-1){if(R(c))continue;return}if(!I(c,o+1)){c.ch=o+1;continue}var d=c.text.lastIndexOf("/",o),u=d>-1&&!/\S/.test(c.text.slice(d+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function C(c){for(;;){var o=c.ch?c.text.lastIndexOf("<",c.ch-1):-1;if(o==-1){if(O(c))continue;return}if(!I(c,o+1)){c.ch=o;continue}P.lastIndex=o,c.ch=o;var d=P.exec(c.text);if(d&&d.index==o)return d}}function L(c){for(;;){P.lastIndex=c.ch;var o=P.exec(c.text);if(!o){if(R(c))continue;return}if(!I(c,o.index+1)){c.ch=o.index+1;continue}return c.ch=o.index+o[0].length,o}}function S(c){for(;;){var o=c.ch?c.text.lastIndexOf(">",c.ch-1):-1;if(o==-1){if(O(c))continue;return}if(!I(c,o+1)){c.ch=o;continue}var d=c.text.lastIndexOf("/",o),u=d>-1&&!/\S/.test(c.text.slice(d+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function w(c,o){for(var d=[];;){var u=L(c),x,g=c.line,m=c.ch-(u?u[0].length:0);if(!u||!(x=b(c)))return;if(x=="selfClose")continue;if(u[1]){for(var l=d.length-1;l>=0;--l)if(d[l]==u[2]){d.length=l;break}if(l<0&&(!o||o==u[2]))return{tag:u[2],from:G(g,m),to:G(c.line,c.ch)}}else d.push(u[2])}}function T(c,o){for(var d=[];;){var u=S(c);if(!u)return;if(u=="selfClose"){C(c);continue}var x=c.line,g=c.ch,m=C(c);if(!m)return;if(m[1])d.push(m[2]);else{for(var l=d.length-1;l>=0;--l)if(d[l]==m[2]){d.length=l;break}if(l<0&&(!o||o==m[2]))return{tag:m[2],from:G(c.line,c.ch),to:G(x,g)}}}}q.registerHelper("fold","xml",function(c,o){for(var d=new F(c,o.line,0);;){var u=L(d);if(!u||d.line!=o.line)return;var x=b(d);if(!x)return;if(!u[1]&&x!="selfClose"){var g=G(d.line,d.ch),m=w(d,u[2]);return m&&A(m.from,g)>0?{from:g,to:m.from}:null}}}),q.findMatchingTag=function(c,o,d){var u=new F(c,o.line,o.ch,d);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var x=b(u),g=x&&G(u.line,u.ch),m=x&&C(u);if(!x||!m||A(u,o)>0)return;var l={from:G(u.line,u.ch),to:g,tag:m[2]};return x=="selfClose"?{open:l,close:null,at:"open"}:m[1]?{open:T(u,m[2]),close:l,at:"close"}:(u=new F(c,g.line,g.ch,d),{open:l,close:w(u,m[2]),at:"open"})},q.findEnclosingTag=function(c,o,d,u){for(var x=new F(c,o.line,o.ch,d);;){var g=T(x,u);if(!g)break;var m=new F(c,o.line,o.ch,d),l=w(m,g.tag);if(l)return{open:g,close:l}}},q.scanForClosingTag=function(c,o,d,u){var x=new F(c,o.line,o.ch,u?{from:0,to:u}:null);return w(x,d)}})},"p77/":function(yt,it,Q){},rUJ1:function(yt,it){const Q=/[&<>"']/,q=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},M=y=>H[y];function P(y,f){if(f){if(Q.test(y))return y.replace(q,M)}else if(G.test(y))return y.replace(A,M);return y}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(y){return y.replace(F,(f,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const R=/(^|[^\[])\^/g;function O(y,f){y=y.source||y,f=f||"";const h={replace:(s,a)=>(a=a.source||a,a=a.replace(R,"$1"),y=y.replace(s,a),h),getRegex:()=>new RegExp(y,f)};return h}const b=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(y,f,h){if(y){let s;try{s=decodeURIComponent(I(h)).replace(b,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}f&&!C.test(h)&&(h=o(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(s){return null}return h}const S={},w=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,f){S[" "+y]||(w.test(y)?S[" "+y]=y+"/":S[" "+y]=g(y,"/",!0)),y=S[" "+y];const h=y.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:y.replace(T,"$1")+f:f.charAt(0)==="/"?h?f:y.replace(c,"$1")+f:y+f}const d={exec:function(){}};function u(y){let f=1,h,s;for(;f<arguments.length;f++){h=arguments[f];for(s in h)Object.prototype.hasOwnProperty.call(h,s)&&(y[s]=h[s])}return y}function x(y,f){const h=y.replace(/\|/g,(v,p,E)=>{let D=!1,N=p;for(;--N>=0&&E[N]==="\\";)D=!D;return D?"|":" |"}),s=h.split(/ \|/);let a=0;if(s.length>f)s.splice(f);else for(;s.length<f;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function g(y,f,h){const s=y.length;if(s===0)return"";let a=0;for(;a<s;){const v=y.charAt(s-a-1);if(v===f&&!h)a++;else if(v!==f&&h)a++;else break}return y.substr(0,s-a)}function m(y,f){if(y.indexOf(f[1])===-1)return-1;const h=y.length;let s=0,a=0;for(;a<h;a++)if(y[a]==="\\")a++;else if(y[a]===f[0])s++;else if(y[a]===f[1]&&(s--,s<0))return a;return-1}function l(y){y&&y.sanitize&&!y.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")}yt.exports={escape:P,unescape:I,edit:O,cleanUrl:L,resolveUrl:o,noopTest:d,merge:u,splitCells:x,rtrim:g,findClosingBracket:m,checkSanitizeDeprecation:l}},sDPU:function(yt,it,Q){"use strict";Q.r(it);var q=Q("cWXX"),G=Q("/ezw"),A=Q("k1fw"),H=Q("9og8"),M=Q("tJVT"),P=Q("WmNS"),F=Q.n(P),I=Q("cDcd"),R=Q.n(I),O=Q("Ty5D"),b=Q("9kvl"),C=Q("FIWC"),L=Q.n(C),S=Q("sbIO"),w=Q("ErOA"),T=Q("LvDl"),c=Q.n(T),o=function(u){var x,g,m,l,y=u.paperlibrary,f=u.user,h=u.globalSetting,s=u.dispatch,a=u.location,v=(a==null||((x=a.query)===null||x===void 0)?void 0:x.select)||0,p=Object(I.useState)(!1),E=Object(M.a)(p,2),D=E[0],N=E[1],W=Object(I.useState)(!0),z=Object(M.a)(W,2),B=z[0],U=z[1],X=Object(I.useState)(Number(v)),ne=Object(M.a)(X,2),le=ne[0],de=ne[1],we=Object(I.useState)({}),ge=Object(M.a)(we,2),ve=ge[0],he=ge[1],fe=Object(O.i)(),oe=f.userInfo;Object(I.useEffect)(function(){return s({type:"globalSetting/footerToggle",payload:!1}),function(){s({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(I.useEffect)(function(){return s({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){s({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(I.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(I.useEffect)(function(){Z(le)},[]);var Z=function(){var Ae=Object(H.a)(F.a.mark(function Ce(){var Me,Ue,Ie=arguments;return F.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Me=Ie.length>0&&Ie[0]!==void 0?Ie[0]:0,console.log(fe),Te.next=4,Object(w.a)("/api/exercises/".concat(fe.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:Me}});case 4:Ue=Te.sent,U(!1),he(Ee(Ue));case 7:case"end":return Te.stop()}},Ce)}));return function(){return Ae.apply(this,arguments)}}(),Ee=function(Ce){var Me={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!Ce)return;var Ue=Ce||{},Ie=Ue.exam,De=Ue.single_questions,Te=Ue.multiple_questions,rt=Ue.judgement_questions,Qe=Ue.program_questions,Ve=Ue.completion_questions,Xe=Ue.subjective_questions,ut=Ue.practical_questions,tt=Ue.combination_questions,qe=[Object(A.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},De),Object(A.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Te),Object(A.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Ve),Object(A.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},rt),Object(A.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},Xe),Object(A.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},Qe),Object(A.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},ut),Object(A.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},tt)],be=[],nt=0,Ye=0,xe=qe.filter(function(Re){return Re.questions_count>0}).map(function(Re,ue){var ie;return(ie=Re.questions)===null||ie===void 0||ie.forEach(function(se){be.push(se.id),nt=nt+se.score,Ye=Ye+1}),Object(A.a)(Object(A.a)({},Re),{number:Me[ue+1]})});return{all_questions_count:Ye,all_score:nt,questionList:xe,ids:be,exam:Ie}},Be=function(){b.d.push("/classrooms/".concat(fe.coursesId,"/exercise"))},Ne=function(){alert("\u4FDD\u5B58")},He=function(){var Ae=Object(H.a)(F.a.mark(function Ce(Me,Ue){var Ie,De,Te;return F.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Qe.next=2,Object(w.a)("/api/exercises/".concat(fe.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:Me==null?void 0:Me.single_question_id}});case 2:Ie=Qe.sent,Ie!=null&&Ie.question&&(Te=Object(T.cloneDeep)(ve),Te.questionList=Te==null||((De=Te.questionList)===null||De===void 0)?void 0:De.map(function(Ve){if(Ve.type===Ue.type){var Xe=Object(T.cloneDeep)(Ve==null?void 0:Ve.questions);return Xe.splice(Ue.index,1,Ie==null?void 0:Ie.question),Object(A.a)(Object(A.a)({},Ve),{},{questions:Xe})}return Ve}),he(Te));case 4:case"end":return Qe.stop()}},Ce)}));return function(Me,Ue){return Ae.apply(this,arguments)}}(),ze=function(){var Ae=Object(H.a)(F.a.mark(function Ce(Me){return F.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:document.body.scrollIntoView(),Z(Me),de(Me);case 3:case"end":return Ie.stop()}},Ce)}));return function(Me){return Ae.apply(this,arguments)}}();return console.log(Object(O.h)(),"location333"),R.a.createElement("section",{className:L.a.wrap},R.a.createElement(G.a,{loading:B,active:!0,paragraph:{rows:5}},((g=Object(O.h)())===null||g===void 0||((m=g.pathname)===null||m===void 0)?void 0:m.includes("preview"))&&R.a.createElement("div",{className:L.a.crumbs},R.a.createElement("b",null),R.a.createElement("span",{className:"current",onClick:function(){return b.d.push("/classrooms/".concat(fe.coursesId,"/exercise"))}},"".concat(oe==null||((l=oe.course)===null||l===void 0)?void 0:l.course_name,">")),R.a.createElement("span",{className:"current",onClick:function(){return b.d.push("/classrooms/".concat(fe.coursesId,"/exercise"))}},"\u8BD5\u5377\u5217\u8868>"),R.a.createElement("span",{style:{color:"#bebebe"}},"\u9884\u89C8")),R.a.createElement(S.a,{loading:D,submit:Ne,goBack:Be,data:ve,selectValue:le,editPreview:!0,onExchange:He,onSkipExamination:ze})))};it.default=Object(b.a)(function(d){var u=d.paperlibrary,x=d.user,g=d.globalSetting;return{paperlibrary:u,user:x,globalSetting:g}})(o)},sbIO:function(yt,it,Q){"use strict";var q=Q("DjyN"),G=Q("NUBc"),A=Q("5Dmo"),H=Q("3S7+"),M=Q("/zsF"),P=Q("PArb"),F=Q("Q9mQ"),I=Q("diRs"),R=Q("+L6B"),O=Q("2/Rp"),b=Q("5NDa"),C=Q("5rEg"),L=Q("miYZ"),S=Q("tsqr"),w=Q("9og8"),T=Q("giR+"),c=Q("fyUT"),o=Q("2qtc"),d=Q("kLXV"),u=Q("tJVT"),x=Q("WmNS"),g=Q.n(x),m=Q("cDcd"),l=Q.n(m),y=Q("PsQE"),f=Q.n(y),h=Q("0eGx"),s=Q.n(h),a=Q("9Bee"),v=Q("Ty5D"),p=Q("9kvl"),E=Q("ErOA"),D=Q("+yhJ"),N=Q.n(D),W=Q("RZ/O"),z=Q.n(W),B=Q("LvDl"),U=Q("6K3P"),X=Q.n(U),ne=Q("sRBo"),le=Q("kaz8"),de=Q("oBTY"),we=Q("PpiC"),ge=Q("Ot1p"),ve=Q("kqOp"),he=Q("7qnI"),fe=Q("1vsH"),oe=Q("PGNT"),Z=Q.n(oe),Ee=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Be=function(J,ee){var re=J.globalSetting,ye=J.loading,_e=J.dispatch,je=J.isEdit,Ke=J.editData,st=Object(we.a)(J,["globalSetting","loading","dispatch","isEdit","editData"]),Dt=Object(m.useState)(""),Ge=Object(u.a)(Dt,2),lt=Ge[0],Ct=Ge[1],ht=Object(m.useState)(""),Lt=Object(u.a)(ht,2),Gt=Lt[0],bt=Lt[1],zt=Object(m.useState)([]),Wt=Object(u.a)(zt,2),Bt=Wt[0],kt=Wt[1],Pt=Object(m.useState)(""),jt=Object(u.a)(Pt,2),At=jt[0],Tt=jt[1],mt=Object(m.useState)(),et=Object(u.a)(mt,2),Oe=et[0],Xt=et[1],Ut=Object(m.useState)(!1),Ht=Object(u.a)(Ut,2),Ot=Ht[0],pr=Ht[1];Object(m.useEffect)(function(){if(!Ke||!je)return;Ct(Ke==null?void 0:Ke.name),bt(Ke==null?void 0:Ke.analysis),Xt(Ke==null?void 0:Ke.is_ordered),pr(!0)},[Ke]),Object(m.useEffect)(function(){if(!Ot)return;var ar=Ke==null?void 0:Ke.standard_answer.map(function(Mt){return Mt.answer_text});kt(ar),pr(!1)},[Ot]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Vt,Clear:Et}});var Vt=function(){var Mt=[],pt=!1;return lt?(Bt.forEach(function(nr,ke){Mt.push({position:ke+1,answer_text:[]}),nr.forEach(function(ur,Tr){Mt[ke].answer_text.push(ur),(!ur||!Object(fe.fb)(ur,1e4))&&(Tt("".concat(ke,"-").concat(Tr)),S.b.info(ur?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),pt=!0)})}),pt?!1:(Mt==null?void 0:Mt.length)>20?(S.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:lt,analysis:Gt,standard_answers:Mt,is_ordered:Oe}):(S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Et=function(){Ct(""),bt(""),kt([]),Xt(!1)},Le=function(Mt,pt,nr){var ke=Bt.slice();if(pt&&ke.splice(Mt,pt),nr)for(var ur=0;ur<nr;ur++)ke.splice(Mt+ur,0,[""]);kt(ke)},dt=function(Mt,pt,nr){Tt("");var ke=Bt.slice();ke[Mt][pt]=nr,kt(ke)},Ar=function(Mt){var pt=Bt.slice();pt[Mt]=[].concat(Object(de.a)(pt[Mt]),[""]),kt(pt)},an=function(Mt,pt){var nr=Bt.slice();if(!nr[Mt][pt]){nr[Mt]=nr[Mt].filter(function(ke,ur){return ur!==pt}),kt(nr);return}d.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:Z.a.modal,onOk:function(){nr[Mt]=nr[Mt].filter(function(ur,Tr){return Tr!==pt}),kt(nr)}})},on=function(Mt){d.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:Z.a.modal,onOk:function(){var nr=Bt.slice();nr=Bt.filter(function(ke,ur){return Mt!==ur}),kt(nr)}})};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement("div",null,l.a.createElement(ve.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:lt,onChange:function(Mt){return Ct(Mt)},showNullButton:!0,onPlaceholderChange:Le})),l.a.createElement("div",{className:"mt20"},Bt.map(function(ar,Mt){return l.a.createElement(he.a,{key:Mt,answers:ar,index:Mt,flex:1,is_md:!0,activeOptionErrorIndex:At,onAnswerChange:dt,addChildAnswer:Ar,deleteChildAnswer:an,deleteChildAnswermain:on})})),l.a.createElement("div",{className:"mt20"},Bt.length>1&&l.a.createElement("span",null,l.a.createElement(le.a,{checked:Oe,onChange:function(Mt){return Xt(Mt.target.checked)},className:"".concat(Z.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(Z.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Gt,onChange:function(Mt){return bt(Mt)}}))},Ne=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Be)),He=Q("7Kak"),ze=Q("9yH6"),Ae=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ce=function(J,ee){var re=J.globalSetting,ye=J.loading,_e=J.editData,je=J.dispatch,Ke=J.onRef,st=Ke===void 0?function(){}:Ke,Dt=J.isEdit,Ge=Object(we.a)(J,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),lt=Object(m.useState)(),Ct=Object(u.a)(lt,2),ht=Ct[0],Lt=Ct[1],Gt=Object(m.useState)(""),bt=Object(u.a)(Gt,2),zt=bt[0],Wt=bt[1],Bt=Object(m.useState)(""),kt=Object(u.a)(Bt,2),Pt=kt[0],jt=kt[1];Object(m.useEffect)(function(){if(!_e||!Dt)return;Wt(_e==null?void 0:_e.name),jt(_e==null?void 0:_e.analysis);var mt=_e==null?void 0:_e.choices.find(function(et){return et.is_answer});Lt(mt.choice_text==="\u6B63\u786E"?"0":"1")},[_e]),Object(m.useImperativeHandle)(ee,function(){return{onSave:At,Clear:Tt}});var At=function(){if(!zt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!ht)return S.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var et=[{choice_text:"\u6B63\u786E",is_answer:ht==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:ht==="1"?1:0}];return{name:zt,choices:et,analysis:Pt}},Tt=function(){Wt(""),jt(""),Lt("")};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(ge.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:zt,onChange:function(et){return Wt(et)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:Z.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(ze.a.Group,{buttonStyle:"solid",value:ht,onChange:function(et){return Lt(et.target.value)}},l.a.createElement(ze.a.Button,{value:"0",className:"".concat(Z.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(ze.a.Button,{value:"1",className:Z.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Pt,onChange:function(et){return jt(et)}}))},Me=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ce)),Ue=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ie=function(J,ee){var re=J.editData,ye=J.globalSetting,_e=J.loading,je=J.dispatch,Ke=J.onRef,st=Ke===void 0?function(){}:Ke,Dt=J.isEdit,Ge=Object(we.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),lt=Object(m.useState)([]),Ct=Object(u.a)(lt,2),ht=Ct[0],Lt=Ct[1],Gt=Object(m.useState)(),bt=Object(u.a)(Gt,2),zt=bt[0],Wt=bt[1],Bt=Object(m.useState)([]),kt=Object(u.a)(Bt,2),Pt=kt[0],jt=kt[1],At=Object(m.useState)(""),Tt=Object(u.a)(At,2),mt=Tt[0],et=Tt[1],Oe=Object(m.useState)(""),Xt=Object(u.a)(Oe,2),Ut=Xt[0],Ht=Xt[1];Object(m.useEffect)(function(){Lt(["","","",""])},[]),Object(m.useEffect)(function(){if(!re||!Dt)return;et(re==null?void 0:re.name),Ht(re==null?void 0:re.analysis),Lt(re==null?void 0:re.choices.map(function(Et){return Et.choice_text}));var Vt=[];re==null||re.choices.map(function(Et,Le){Et.is_answer&&Vt.push(Le)}),jt(Vt)},[re]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Ot,Clear:pr}});var Ot=function(){if(!mt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Et=ht.findIndex(function(dt){return!dt});if(Et>-1)return S.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Ue[Et]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!Pt.length)return S.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(Pt.length<2)return S.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Le=ht.map(function(dt,Ar){return{choice_text:dt,is_answer:Pt.includes(Ar)?1:0}});return{name:mt,choices:Le,analysis:Ut}},pr=function(){Lt(["","","",""]),et(""),Ht(""),jt("")};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(ge.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:mt,onChange:function(Et){return et(Et)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:Z.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ht.map(function(Vt,Et){return l.a.createElement("div",{className:Z.a.choiceWrap,key:Et},l.a.createElement(H.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(Z.a.answer," ").concat(Pt.includes(Et)?Z.a.activeAnswer:""),onClick:function(){Pt.includes(Et)?jt(Pt.filter(function(dt){return dt!==Et})):jt([].concat(Object(de.a)(Pt),[Et]))}},Ue[Et])),l.a.createElement("div",{className:Z.a.editorWrap},zt===Et?l.a.createElement(ge.a,{id:"single-question-option-".concat(Et),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Vt,onChange:function(dt){ht[Et]=dt,Lt(ht)}}):l.a.createElement("div",{className:Z.a.htmlWrap,onClick:function(){return Wt(Et)}},l.a.createElement(a.a,{value:Vt}))),Et>1&&l.a.createElement(H.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(Z.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Lt(ht.filter(function(dt,Ar){return Ar!==Et})),Pt.includes(Et)?jt(Pt.filter(function(dt){return dt!==Et})):jt([].concat(Object(de.a)(Pt),[Et]))}})),Et<7&&Et===ht.length-1&&l.a.createElement(H.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(Z.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Lt([].concat(Object(de.a)(ht),[""]))}})))}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ut,onChange:function(Et){return Ht(Et)}}))},De=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ie)),Te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],rt=function(J,ee){var re=J.editData,ye=J.globalSetting,_e=J.loading,je=J.dispatch,Ke=J.onRef,st=Ke===void 0?function(){}:Ke,Dt=J.isEdit,Ge=Object(we.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),lt=Object(m.useState)([]),Ct=Object(u.a)(lt,2),ht=Ct[0],Lt=Ct[1],Gt=Object(m.useState)(),bt=Object(u.a)(Gt,2),zt=bt[0],Wt=bt[1],Bt=Object(m.useState)(),kt=Object(u.a)(Bt,2),Pt=kt[0],jt=kt[1],At=Object(m.useState)(""),Tt=Object(u.a)(At,2),mt=Tt[0],et=Tt[1],Oe=Object(m.useState)(""),Xt=Object(u.a)(Oe,2),Ut=Xt[0],Ht=Xt[1];Object(m.useEffect)(function(){Lt(["","","",""])},[]),Object(m.useEffect)(function(){if(!re||!Dt)return;et(re==null?void 0:re.name),Ht(re==null?void 0:re.analysis),Lt(re==null?void 0:re.choices.map(function(Vt){return Vt.choice_text})),jt(re==null?void 0:re.choices.findIndex(function(Vt){return Vt.is_answer}))},[re]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Ot,Clear:pr}});var Ot=function(){if(!mt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Et=ht.findIndex(function(dt){return!dt});if(Et>-1)return S.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Te[Et]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",Pt),!(typeof Pt=="number"))return S.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Le=ht.map(function(dt,Ar){return{choice_text:dt,is_answer:Pt===Ar?1:0}});return{name:mt,choices:Le,analysis:Ut}},pr=function(){Lt(["","","",""]),et(""),Ht(""),jt("")};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(ge.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:mt,onChange:function(Et){return et(Et)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:Z.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ht.map(function(Vt,Et){return l.a.createElement("div",{className:Z.a.choiceWrap,key:Et},l.a.createElement(H.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(Z.a.answer," ").concat(Pt===Et?Z.a.activeAnswer:""),onClick:function(){return jt(Et)}},Te[Et])),l.a.createElement("div",{className:Z.a.editorWrap},zt===Et?l.a.createElement(ge.a,{id:"single-question-option-".concat(Et),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Vt,onChange:function(dt){ht[Et]=dt,Lt(ht)}}):l.a.createElement("div",{className:Z.a.htmlWrap,onClick:function(){return Wt(Et)}},l.a.createElement(a.a,{value:Vt}))),Et>1&&l.a.createElement(H.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(Z.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Lt(ht.filter(function(dt,Ar){return Ar!==Et})),Et===Pt&&jt(null)}})),Et<7&&Et===ht.length-1&&l.a.createElement(H.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(Z.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Lt([].concat(Object(de.a)(ht),[""]))}})))}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ut,onChange:function(Et){return Ht(Et)}}))},Qe=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(rt)),Ve=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Xe=function(J,ee){var re=J.editData,ye=J.globalSetting,_e=J.loading,je=J.dispatch,Ke=J.onRef,st=Ke===void 0?function(){}:Ke,Dt=J.isEdit,Ge=Object(we.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),lt=Object(m.useState)(""),Ct=Object(u.a)(lt,2),ht=Ct[0],Lt=Ct[1],Gt=Object(m.useState)(""),bt=Object(u.a)(Gt,2),zt=bt[0],Wt=bt[1],Bt=Object(m.useState)(""),kt=Object(u.a)(Bt,2),Pt=kt[0],jt=kt[1];Object(m.useEffect)(function(){var mt;if(!re||!Dt)return;Lt(re==null?void 0:re.name),Wt(re==null?void 0:re.analysis),jt(re==null||((mt=re.answer_texts)===null||mt===void 0)?void 0:mt[0])},[re]),Object(m.useImperativeHandle)(ee,function(){return{onSave:At,Clear:Tt}});var At=function(){return ht?Pt?{name:ht,answer_texts:[Pt],analysis:zt}:(S.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Tt=function(){Lt(""),Wt(""),jt("")};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(ge.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ht,onChange:function(et){return Lt(et)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(ge.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Pt,onChange:function(et){return jt(et)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:zt,onChange:function(et){return Wt(et)}}))},ut=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Xe)),tt=Q("k1fw"),qe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],be=function(J,ee){var re=J.globalSetting,ye=J.loading,_e=J.dispatch,je=J.editData,Ke=J.onRef,st=Ke===void 0?function(){}:Ke,Dt=J.isEdit,Ge=Object(we.a)(J,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),lt=Object(m.useState)(""),Ct=Object(u.a)(lt,2),ht=Ct[0],Lt=Ct[1],Gt=Object(m.useState)([]),bt=Object(u.a)(Gt,2),zt=bt[0],Wt=bt[1];console.log(zt),Object(m.useEffect)(function(){var At;if(!je||!Dt)return;Lt(je==null?void 0:je.name);var Tt=je==null||((At=je.sub_item_banks)===null||At===void 0)?void 0:At.map(function(mt){var et,Oe,Xt;return Object(tt.a)(Object(tt.a)({},mt),{},{id:mt.id,open:!1,qusList:mt==null||((et=mt.choices)===null||et===void 0)?void 0:et.map(function(Ut){return Ut.choice_text}),activeQusEditor:null,qusAnswer:(Oe=[mt==null||((Xt=mt.choices)===null||Xt===void 0)?void 0:Xt.findIndex(function(Ut){return Ut.is_answer})])===null||Oe===void 0?void 0:Oe.filter(function(Ut){return Ut!==-1})})});Wt(Tt)},[je]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Bt,Clear:kt}});var Bt=function(){if(!ht)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(zt.length===0)return S.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var Tt=0;Tt<zt.length;Tt++){var mt,et=zt[Tt];if(!(et!=null&&et.name))return S.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(Tt+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Oe=et==null||((mt=et.qusList)===null||mt===void 0)?void 0:mt.findIndex(function(Ut){return!Ut});if(Oe>-1)return S.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Tt+1,"\u5C0F\u9898").concat(qe[Oe],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(et!=null&&et.qusAnswer.length))return S.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Tt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var Xt=zt.map(function(Ut){return{id:Ut.id>1?Ut.id:null,name:Ut.name,item_type:Ut.item_type,analysis:Ut.analysis,choices:Ut.qusList.map(function(Ht,Ot){return{choice_text:Ht,is_answer:Ut.qusAnswer[0]===Ot?1:0}})}});return{name:ht,sub_item_banks:Xt}},kt=function(){Lt(""),Wt([])},Pt=function(){var Tt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Wt(zt.concat(Tt))},jt=function(Tt,mt,et){var Oe=Object(B.cloneDeep)(zt);if(Tt==="open"&&(Oe[mt].open=!Oe[mt].open),Tt==="delete"&&Oe.splice(mt,1),Tt==="value"&&(Oe[mt].name=et),Tt==="answer"&&(Oe[mt].qusAnswer=[et]),Tt==="edit"&&(Oe[mt].activeQusEditor=et),Tt==="details"&&(Oe[mt].qusList[Oe[mt].activeQusEditor]=et),Tt==="addQus"&&(Oe[mt].qusList=Oe[mt].qusList.concat("")),Tt==="deleteQus"){var Xt;Oe[mt].qusList=Oe[mt].qusList.filter(function(Ut,Ht){return Ht!==et}),Oe[mt].qusAnswer=(Xt=Oe[mt].qusAnswer)===null||Xt===void 0?void 0:Xt.filter(function(Ut){return Ut!==et})}Tt==="analysis"&&(Oe[mt].analysis=et),Wt(Oe)};return l.a.createElement("section",{className:Z.a.wrap},l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(ge.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ht,onChange:function(Tt){return Lt(Tt)}}),zt==null?void 0:zt.map(function(At,Tt){var mt;return l.a.createElement("div",{className:Z.a.fold,key:At.id},l.a.createElement("div",{onClick:function(){return jt("open",Tt)},className:Z.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:At.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",Tt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Oe){Oe.stopPropagation(),jt("delete",Tt)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:At.open?"block":"none"}},l.a.createElement(ge.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:At==null?void 0:At.name,onChange:function(Oe){return jt("value",Tt,Oe)}}),l.a.createElement("p",{className:Z.a.titleWrap},l.a.createElement("span",{className:Z.a.required},"*"),l.a.createElement("span",{className:Z.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:Z.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),At==null||((mt=At.qusList)===null||mt===void 0)?void 0:mt.map(function(et,Oe){var Xt,Ut;return l.a.createElement("div",{className:Z.a.choiceWrap,key:Oe},l.a.createElement(H.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(Z.a.answer," ").concat(At!=null&&(Xt=At.qusAnswer)!==null&&Xt!==void 0&&Xt.includes(Oe)?Z.a.activeAnswer:""),onClick:function(){return jt("answer",Tt,Oe)}},qe[Oe])),l.a.createElement("div",{className:Z.a.editorWrap},(At==null?void 0:At.activeQusEditor)===Oe?l.a.createElement(ge.a,{id:"single-question-option-".concat(Oe),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:et,onChange:function(Ot){return jt("details",Tt,Ot)}}):l.a.createElement("div",{className:Z.a.htmlWrap,onClick:function(){return jt("edit",Tt,Oe)}},l.a.createElement(a.a,{value:et}))),Oe>1&&l.a.createElement(H.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(Z.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return jt("deleteQus",Tt,Oe)}})),Oe<7&&Oe===(At==null||((Ut=At.qusList)===null||Ut===void 0)?void 0:Ut.length)-1&&l.a.createElement(H.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(Z.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return jt("addQus",Tt)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:Z.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(ge.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:At.analysis,onChange:function(Oe){return jt("analysis",Tt,Oe)}})))}))},nt=Object(p.a)(function($){var J=$.loading,ee=$.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(be)),Ye=Q("14J3"),xe=Q("BMrR"),Re=Q("ZWs3"),ue=function(J){var ee=J.visible,re=J.onCancel,ye=J.onRandomExchange,_e=J.selectFromProblemSet;return l.a.createElement(d.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:ee,onCancel:re,centered:!0,maskClosable:!0,footer:null},l.a.createElement(xe.a,{justify:"center"},l.a.createElement(Re.a,{onClick:ye},"\u968F\u673A\u66F4\u6362"),l.a.createElement(O.a,{style:{marginLeft:24},onClick:_e},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},ie=ue,se=function(J){var ee,re,ye,_e,je,Ke,st,Dt,Ge=J.data,lt=J.submit,Ct=J.goBack,ht=J.loading,Lt=J.onTypeScore,Gt=J.editPreview,bt=Gt===void 0?!1:Gt,zt=J.onSkipExamination,Wt=J.selectValue,Bt=J.onExchange,kt=Object(m.useRef)(),Pt=Object(m.useRef)(Object(B.debounce)(function(){return ar()},100,{leading:!0,trailing:!0})),jt=Object(m.useState)(null),At=Object(u.a)(jt,2),Tt=At[0],mt=At[1],et=Object(m.useState)(!1),Oe=Object(u.a)(et,2),Xt=Oe[0],Ut=Oe[1],Ht=Object(m.useState)(!1),Ot=Object(u.a)(Ht,2),pr=Ot[0],Vt=Ot[1],Et=Object(m.useRef)(),Le=Object(v.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",Pt==null?void 0:Pt.current),function(){window.removeEventListener("scroll",Pt==null?void 0:Pt.current)}},[]),Object(m.useEffect)(function(){Ut(!0)},[]),Object(m.useEffect)(function(){var Ze,me,Fe,gt,at=(Ze=document.getElementById("examName"))===null||Ze===void 0||((me=Ze.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||me===void 0||((Fe=me[0])===null||Fe===void 0||((gt=Fe.childNodes)===null||gt===void 0)))?void 0:gt[2];at&&(at.nodeValue="\u4EFD")},[Ge]);var dt=function(me){var Fe=parseInt(me);return isNaN(Fe)?"":Fe};function Ar(){var Ze=0,me=0,Fe=0;return document.body&&(me=document.body.scrollTop),document.documentElement&&(Fe=document.documentElement.scrollTop),Ze=me-Fe>0?me:Fe,Ze}function an(){var Ze=0,me=0,Fe=0;return document.body&&(me=document.body.scrollHeight),document.documentElement&&(Fe=document.documentElement.scrollHeight),Ze=me-Fe>0?me:Fe,Ze}function on(){var Ze=0;return document.compatMode=="CSS1Compat"?Ze=document.documentElement.clientHeight:Ze=document.body.clientHeight,Ze}var ar=function(){var me=document.getElementById("preview_btns"),Fe=document.getElementById("preview_btns_else");Ar()+on()>=an()-68?(me.style.visibility="hidden",Fe.style.visibility="visible"):(me.style.visibility="visible",Fe.style.visibility="hidden")},Mt=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],pt=function(me){var Fe,gt=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("aside",{className:f.a.single},me==null||((Fe=me.choices)===null||Fe===void 0)?void 0:Fe.map(function(at,ct){return at.is_answer&>.push(sn[ct]),l.a.createElement("ul",{key:ct},l.a.createElement("li",null,sn[ct],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:at.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",gt.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Mt[me.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:me.analysis?me.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(me==null?void 0:me.discipline_name,"/").concat(me==null?void 0:me.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),me==null?void 0:me.tag_discipline_name))))},nr=function(me){var Fe,gt=me==null||((Fe=me.standard_answer)===null||Fe===void 0)?void 0:Fe.map(function(at){var ct;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(at.position,"\uFF09\uFF1A").concat(at==null||((ct=at.answer_text)===null||ct===void 0)?void 0:ct.join("\u3001"))});return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",gt),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:me.analysis?me.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(me==null?void 0:me.discipline_name,"/").concat(me==null?void 0:me.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),me==null?void 0:me.tag_discipline_name))))},ke=function(me){var Fe;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",me==null||((Fe=me.answer_texts)===null||Fe===void 0)?void 0:Fe[0]),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:me.analysis?me.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(me==null?void 0:me.discipline_name,"/").concat(me==null?void 0:me.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),me==null?void 0:me.tag_discipline_name)))},ur=function(me){var Fe;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u9884\u671F\u8F93\u51FA:"),l.a.createElement(a.a,{value:me==null||((Fe=me.program_attr)===null||Fe===void 0)?void 0:Fe.description})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(me==null?void 0:me.discipline_name,"/").concat(me==null?void 0:me.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),me==null?void 0:me.tag_discipline_name)))},Tr=function(me,Fe){var gt;return l.a.createElement("div",null,me==null||((gt=me.sub_item_banks)===null||gt===void 0)?void 0:gt.map(function(at,ct){var St,er=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},Fe+1+"."+(ct+1),"\uFF08\u5355\u9009\u9898\uFF09",at.name),l.a.createElement("aside",{className:f.a.single},at==null||((St=at.choices)===null||St===void 0)?void 0:St.map(function(tr,or){return tr.is_answer&&er.push(sn[or]),l.a.createElement("ul",{key:or},l.a.createElement("li",null,sn[or],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:tr.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",er.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Mt[at.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:at.analysis?at.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(me==null?void 0:me.discipline_name,"/").concat(me==null?void 0:me.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),me==null?void 0:me.tag_discipline_name))))}))},sn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],hn=function(me){var Fe,gt=[];me==null||((Fe=me.questions)===null||Fe===void 0)||Fe.map(function(ct){var St;return ct==null||((St=ct.sub_item_banks)===null||St===void 0)?void 0:St.map(function(er){gt.push(er)})});var at=0;me.type==="COMBINATION"?at=me.questions_score/gt.length:at=me.questions_score/me.questions_count,d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{className:f.a.modalRow,style:{justifyContent:"flex-start"}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",null,me==null?void 0:me.name,(me==null?void 0:me.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),l.a.createElement(c.a,{min:1,parser:dt,defaultValue:at,onChange:function(St){at=St}}),l.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var ct=Object(w.a)(g.a.mark(function er(){var tr,or;return g.a.wrap(function(dr){for(;;)switch(dr.prev=dr.next){case 0:if(at){dr.next=3;break}return S.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),dr.abrupt("return",Promise.reject());case 3:me.type==="COMBINATION"?(tr={type:me==null?void 0:me.type,score:at,scoreTotal:at*(gt==null?void 0:gt.length)},Lt(tr)):(or={type:me==null?void 0:me.type,score:at,scoreTotal:at*me.questions_count},Lt(or));case 4:case"end":return dr.stop()}},er)}));function St(){return ct.apply(this,arguments)}return St}()})},Gr=function(){var me="";d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},l.a.createElement("img",{style:{marginRight:5},src:X.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),l.a.createElement("div",{className:f.a.modalRow,style:{marginTop:20}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),l.a.createElement(C.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:me,onChange:function(gt){me=gt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Fe=Object(w.a)(g.a.mark(function at(){var ct,St,er,tr,or;return g.a.wrap(function(dr){for(;;)switch(dr.prev=dr.next){case 0:if(me){dr.next=3;break}return S.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),dr.abrupt("return",Promise.reject());case 3:return St=[],er=[],tr=[],Ge==null||((ct=Ge.questionList)===null||ct===void 0)||ct.forEach(function(Pr){var fr;(fr=Pr.questions)===null||fr===void 0||fr.forEach(function(Zr){St.push(Zr.id),er.push(Pr.questions_score/Pr.questions_count),Pr.type==="COMBINATION"&&tr.push({id:Zr.id,sub_item_bank_ids:Zr.sub_item_banks.map(function(Sr){return Sr.id})})})}),console.log("-----",tr),or={item_bank_ids:St,item_bank_scores:er,name:me,combination_item_banks:tr},dr.next=11,lt(or);case 11:case"end":return dr.stop()}},at)}));function gt(){return Fe.apply(this,arguments)}return gt}()})},Ln=function(me,Fe,gt,at){var ct,St="".concat(location.pathname).concat(location.search),er=(ct=at.questions)===null||ct===void 0?void 0:ct.map(function(or){return or.id});if(St.includes("exercise"))Et.current={id:me,ids:er,type:Fe,index:gt},Vt(!0);else var tr=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!0,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var or=Object(w.a)(g.a.mark(function dr(){return g.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return tr.update({cancelButtonProps:{disabled:!0}}),fr.next=3,Bt({single_question_id:me,seleted_item_bank_ids:er},{type:Fe,index:gt});case 3:tr.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return fr.stop()}},dr)}));function Lr(){return or.apply(this,arguments)}return Lr}()})},Dn=function(me){var Fe,gt=(Fe=me.questions)===null||Fe===void 0?void 0:Fe.map(function(St){return St.id}),at=me.name,ct=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(at,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var St=Object(w.a)(g.a.mark(function tr(){return g.a.wrap(function(Lr){for(;;)switch(Lr.prev=Lr.next){case 0:return ct.update({cancelButtonProps:{disabled:!0}}),Lr.next=3,Bt({seleted_item_bank_ids:gt},{type:me.type});case 3:ct.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(at,"\u8BD5\u9898"));case 5:case"end":return Lr.stop()}},tr)}));function er(){return St.apply(this,arguments)}return er}()})},zr=function(){var me=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Fe=Object(w.a)(g.a.mark(function at(){return g.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return me.update({cancelButtonProps:{disabled:!0}}),St.next=3,Bt();case 3:me.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return St.stop()}},at)}));function gt(){return Fe.apply(this,arguments)}return gt}()})},ln=function(me){console.log(me,"key"),zt(me-1)},Rn=function(){return l.a.createElement(l.a.Fragment,null,l.a.createElement(I.a,{color:"#55575D",overlayClassName:f.a.popover,visible:Xt,getPopupContainer:function(Fe){return Fe==null?void 0:Fe.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},l.a.createElement(O.a,{onMouseEnter:function(){return Ut(!0)},onMouseLeave:function(){return Ut(!1)},onClick:function(){Gr()}},"\u4FDD\u5B58")),l.a.createElement(O.a,{onClick:function(){document.body.scrollIntoView(),Ct()}},"\u8FD4\u56DE"),l.a.createElement(O.a,{loading:ht,onClick:function(){return lt()},type:"primary"},"\u63D0\u4EA4"))},yn=function(){var me;return l.a.createElement(l.a.Fragment,null,l.a.createElement(O.a,{onClick:Ct},"\u8FD4\u56DE"),Wt>0&&l.a.createElement(O.a,{onClick:function(){return ln(Wt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Wt<(Ge==null||((me=Ge.exam)===null||me===void 0)?void 0:me.total_num)-1&&l.a.createElement(O.a,{onClick:function(){return ln(Wt+2)}},"\u4E0B\u4E00\u4EFD"))},Vr=function(me,Fe){if(Fe==="SINGLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Qe,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="MULTIPLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(De,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="JUDGMENT")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Me,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="COMPLETION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Ne,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="SUBJECTIVE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(ut,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="COMBINATION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(nt,{ref:kt,editData:me,isEdit:!0}),l.a.createElement(P.a,null));if(Fe==="PROGRAM"){var gt;p.d.push("/problems/".concat(me==null||((gt=me.program_attr)===null||gt===void 0)?void 0:gt.identifier,"/edit?type=exercises&express_id=").concat(Le.categoryId,"&question_id=").concat(me==null?void 0:me.id,"&score=").concat(me==null?void 0:me.score,"&callback_url=").concat(location.pathname,"&select=").concat(Wt,"&exercise=true"))}},Kn=function(){var Ze=Object(w.a)(g.a.mark(function me(Fe,gt){var at,ct,St,er,tr,or,Lr,dr,Pr,fr;return g.a.wrap(function(Sr){for(;;)switch(Sr.prev=Sr.next){case 0:return Sr.next=2,(at=kt.current)===null||at===void 0?void 0:at.onSave();case 2:if(ct=Sr.sent,ct){Sr.next=5;break}return Sr.abrupt("return");case 5:return St={question_score:gt.score,analysis:ct.analysis},(Fe==="SINGLE"||Fe==="MULTIPLE"||Fe==="JUDGMENT")&&(tr=[],or=[],St.question_type=Fe==="JUDGMENT"?2:1,St.question_title=ct==null?void 0:ct.name,ct==null||((er=ct.choices)===null||er===void 0)||er.forEach(function(sr,Xr){tr.push(sr.choice_text),sr!=null&&sr.is_answer&&or.push(Xr+1)}),St.question_choices=tr,St.standard_answers=or),Fe==="COMPLETION"&&(St.is_ordered=ct.is_ordered,St.question_title=ct==null?void 0:ct.name,St.question_type=3,dr=[],ct==null||((Lr=ct.standard_answers)===null||Lr===void 0)||Lr.forEach(function(sr,Xr){dr.push({choice_id:sr.position,answer_text:sr.answer_text})}),St.standard_answers=dr),Fe==="SUBJECTIVE"&&(St.question_title=ct==null?void 0:ct.name,St.question_type=3,St.standard_answers=ct==null?void 0:ct.answer_texts),Fe==="COMBINATION"&&(St.question_title=ct==null?void 0:ct.name,St.question_type=7,St.sub_questions=ct==null||((Pr=ct.sub_item_banks)===null||Pr===void 0)?void 0:Pr.map(function(sr,Xr){return{id:sr.id,question_title:sr.name,question_type:1,question_choices:sr.choices.map(function(Yr){return Yr.choice_text}),standard_answers:[sr.choices.findIndex(function(Yr){return Yr.is_answer})+1],analysis:sr.analysis}}),delete St.analysis),Sr.next=12,Object(E.a)("/api/exercise_questions/".concat(gt.id,".json"),{method:"put",body:St});case 12:fr=Sr.sent,(fr==null?void 0:fr.status)===0&&(S.b.success("\u7F16\u8F91\u6210\u529F"),ln(Wt+1)),mt(null);case 15:case"end":return Sr.stop()}},me)}));return function(Fe,gt){return Ze.apply(this,arguments)}}(),Ni=function(){for(var me=[],Fe=0;Fe<(Ge==null||((gt=Ge.exam)===null||gt===void 0)?void 0:gt.total_num);Fe++){var gt;me.push({})}return me},On=Ge==null||((ee=Ge.questionList)===null||ee===void 0)?void 0:ee.reduce(function(Ze,me){return Ze+me.questions_score},0),yr=bt&&(Ge==null||((re=Ge.exam)===null||re===void 0)?void 0:re.exercise_status)!==1;return l.a.createElement("section",{className:f.a.wrap},l.a.createElement("div",{id:"id_left_preview",className:f.a.left,onMouseEnter:function(me){var Fe=document.getElementById("id_left_preview");Fe.style.overflowY="auto"},onMouseLeave:function(me){var Fe=document.getElementById("id_left_preview");Fe.style.overflowY="hidden"}},l.a.createElement("div",{className:f.a.title},l.a.createElement("div",null,l.a.createElement("b",null),l.a.createElement("span",null,"\u7B54\u9898\u5361"))),l.a.createElement("div",{className:f.a.total},l.a.createElement("div",null,l.a.createElement("img",{src:N.a}),l.a.createElement("span",null,"\u9898\u6570(\u9053)"),l.a.createElement("aside",null,Ge==null?void 0:Ge.all_questions_count)),l.a.createElement("div",{className:"mr30 ml30"},l.a.createElement("img",{src:z.a}),l.a.createElement("span",null,"\u603B\u5206(\u5206)"),l.a.createElement("aside",null,On)),l.a.createElement("div",null,l.a.createElement("img",{src:s.a}),l.a.createElement("span",null,"\u65F6\u957F(\u5206)"),l.a.createElement("aside",null,Ge==null||((ye=Ge.exam)===null||ye===void 0)?void 0:ye.time))),Ge==null||((_e=Ge.questionList)===null||_e===void 0)?void 0:_e.map(function(Ze,me){var Fe;return l.a.createElement("div",{className:f.a.list,key:me},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,Ze.name)),l.a.createElement("aside",null,l.a.createElement("div",null,"\u5171",l.a.createElement("span",{className:f.a.b},Ze.questions_count),"\u9898 ",l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},Ze.questions_score),"\u5206"),l.a.createElement("div",{className:f.a.answerSheet},Ze==null||((Fe=Ze.questions)===null||Fe===void 0)?void 0:Fe.map(function(gt,at){return l.a.createElement("div",{onClick:function(){var St="Anchor_".concat(gt.id),er=document.getElementById(St);er&&setTimeout(function(){return er.scrollIntoView({block:"center",behavior:"smooth"})})},key:gt.id,className:f.a.tag},at+1)}))))})),l.a.createElement("div",{className:f.a.right},l.a.createElement("div",{className:f.a.examName,id:"examName"},l.a.createElement("div",{className:f.a.name},l.a.createElement(H.a,{title:Ge==null||((je=Ge.exam)===null||je===void 0)?void 0:je.name,getPopupContainer:function(me){return me.parentNode}},l.a.createElement("span",{className:f.a.t},Ge==null||((Ke=Ge.exam)===null||Ke===void 0)?void 0:Ke.name))),bt?l.a.createElement(G.a,{showTotal:function(me){return l.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",l.a.createElement("span",{className:"c-light-primary"},me),"\u4EFD\u8BD5\u5377")},total:Ge==null||((st=Ge.exam)===null||st===void 0)?void 0:st.total_num,pageSize:1,current:Wt+1,showSizeChanger:!1,onChange:ln,showQuickJumper:!0,hideOnSinglePage:!1}):l.a.createElement(O.a,{onClick:zr,type:"primary"},"\u968F\u673A\u66F4\u6362")),l.a.createElement("div",{className:f.a.topWarp},Ge==null||((Dt=Ge.questionList)===null||Dt===void 0)?void 0:Dt.map(function(Ze,me){var Fe,gt;return l.a.createElement(l.a.Fragment,{key:me},l.a.createElement("div",{className:f.a.head,style:me===0?{border:0,marginTop:-16}:{}},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,Ze.name)),l.a.createElement("div",{className:f.a.so},"\u5171",l.a.createElement("span",{className:f.a.b},Ze.questions_count," "),"\u9898 ",Ze.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(Ze==null||((Fe=Ze.questions)===null||Fe===void 0)?void 0:Fe.map(function(at){var ct;return at==null||((ct=at.sub_item_banks)===null||ct===void 0)?void 0:ct.length}).reduce(function(at,ct){return at+ct}),"\u5C0F\u9898\uFF09"),l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},Ze.questions_score),"\u5206"),!bt&&l.a.createElement("div",{className:f.a.btn},l.a.createElement(O.a,{onClick:function(){hn(Ze)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),l.a.createElement(O.a,{onClick:function(){return Dn(Ze)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),Ze==null||((gt=Ze.questions)===null||gt===void 0)?void 0:gt.map(function(at,ct){return Tt===at.id?l.a.createElement("div",{id:"Anchor_".concat(at.id),className:f.a.content,style:{padding:0,marginTop:10},key:at.id},l.a.createElement("div",{style:{float:"right",marginTop:-6}},l.a.createElement(O.a,{onClick:function(){return mt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),l.a.createElement(O.a,{onClick:function(){return Kn(Ze==null?void 0:Ze.type,at)},type:"primary"},"\u4FDD\u5B58")),Vr(at,Ze.type)):l.a.createElement("div",{id:"Anchor_".concat(at.id),className:f.a.content,key:at.id},l.a.createElement("div",{className:f.a.titleWrap},l.a.createElement(a.a,{style:{paddingRight:10},className:f.a.titleHtml,value:ct+1+"\u3001"+"".concat((at==null?void 0:at.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+at.name}),bt&&l.a.createElement(O.a,{disabled:yr,onClick:function(){if(Tt){S.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}mt(at.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),l.a.createElement(O.a,{disabled:yr,onClick:function(){return Ln(at.id,Ze.type,ct,Ze)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(Ze.type==="SINGLE"||Ze.type==="JUDGMENT"||Ze.type==="MULTIPLE")&&pt(at),Ze.type==="COMPLETION"&&nr(at),Ze.type==="SUBJECTIVE"&&ke(at),Ze.type==="PROGRAM"&&ur(at),Ze.type==="COMBINATION"&&Tr(at,ct),l.a.createElement("div",null))}))})),l.a.createElement("div",{className:f.a.btnsElse,id:"preview_btns_else"},bt?yn():Rn()),l.a.createElement("div",{className:f.a.btnsWrap,id:"preview_btns"},l.a.createElement("div",{className:f.a.btns},bt?yn():Rn()))),l.a.createElement(ie,{visible:pr,onRandomExchange:Object(w.a)(g.a.mark(function Ze(){var me;return g.a.wrap(function(gt){for(;;)switch(gt.prev=gt.next){case 0:return me=Et.current,gt.next=3,Bt({single_question_id:me.id,seleted_item_bank_ids:me.ids},{type:me.type,index:me.index});case 3:Vt(!1);case 4:case"end":return gt.stop()}},Ze)})),selectFromProblemSet:function(){var me=Et.current,Fe="".concat(location.pathname).concat(location.search);Fe.includes("exercise")&&p.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(me.id,"&qtype=").concat(me.type,"&exerciseid=").concat(Le.categoryId,"&from=").concat(Fe))},onCancel:function(){Vt(!1)}}))},Y=it.a=se},ulZh:function(yt,it,Q){typeof window!="undefined"&&function(G,A){yt.exports=A()}(this,function(){return function(q){var G={};function A(H){if(G[H])return G[H].exports;var M=G[H]={i:H,l:!1,exports:{}};return q[H].call(M.exports,M,M.exports,A),M.l=!0,M.exports}return A.m=q,A.c=G,A.d=function(H,M,P){A.o(H,M)||Object.defineProperty(H,M,{enumerable:!0,get:P})},A.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},A.t=function(H,M){if(M&1&&(H=A(H)),M&8)return H;if(M&4&&typeof H=="object"&&H&&H.__esModule)return H;var P=Object.create(null);if(A.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:H}),M&2&&typeof H!="string")for(var F in H)A.d(P,F,function(I){return H[I]}.bind(null,F));return P},A.n=function(H){var M=H&&H.__esModule?function(){return H.default}:function(){return H};return A.d(M,"a",M),M},A.o=function(H,M){return Object.prototype.hasOwnProperty.call(H,M)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,G,A){"use strict";var H=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function F(b,C,L){this.fn=b,this.context=C,this.once=L||!1}function I(b,C,L,S,w){if(typeof L!="function")throw new TypeError("The listener must be a function");var T=new F(L,S||b,w),c=M?M+C:C;return b._events[c]?b._events[c].fn?b._events[c]=[b._events[c],T]:b._events[c].push(T):(b._events[c]=T,b._eventsCount++),b}function R(b,C){--b._eventsCount===0?b._events=new P:delete b._events[C]}function O(){this._events=new P,this._eventsCount=0}O.prototype.eventNames=function(){var C=[],L,S;if(this._eventsCount===0)return C;for(S in L=this._events)H.call(L,S)&&C.push(M?S.slice(1):S);return Object.getOwnPropertySymbols?C.concat(Object.getOwnPropertySymbols(L)):C},O.prototype.listeners=function(C){var L=M?M+C:C,S=this._events[L];if(!S)return[];if(S.fn)return[S.fn];for(var w=0,T=S.length,c=new Array(T);w<T;w++)c[w]=S[w].fn;return c},O.prototype.listenerCount=function(C){var L=M?M+C:C,S=this._events[L];return S?S.fn?1:S.length:0},O.prototype.emit=function(C,L,S,w,T,c){var o=M?M+C:C;if(!this._events[o])return!1;var d=this._events[o],u=arguments.length,x,g;if(d.fn){d.once&&this.removeListener(C,d.fn,void 0,!0);switch(u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,L),!0;case 3:return d.fn.call(d.context,L,S),!0;case 4:return d.fn.call(d.context,L,S,w),!0;case 5:return d.fn.call(d.context,L,S,w,T),!0;case 6:return d.fn.call(d.context,L,S,w,T,c),!0}for(g=1,x=new Array(u-1);g<u;g++)x[g-1]=arguments[g];d.fn.apply(d.context,x)}else{var m=d.length,l;for(g=0;g<m;g++){d[g].once&&this.removeListener(C,d[g].fn,void 0,!0);switch(u){case 1:d[g].fn.call(d[g].context);break;case 2:d[g].fn.call(d[g].context,L);break;case 3:d[g].fn.call(d[g].context,L,S);break;case 4:d[g].fn.call(d[g].context,L,S,w);break;default:if(!x)for(l=1,x=new Array(u-1);l<u;l++)x[l-1]=arguments[l];d[g].fn.apply(d[g].context,x)}}}return!0},O.prototype.on=function(C,L,S){return I(this,C,L,S,!1)},O.prototype.once=function(C,L,S){return I(this,C,L,S,!0)},O.prototype.removeListener=function(C,L,S,w){var T=M?M+C:C;if(!this._events[T])return this;if(!L)return R(this,T),this;var c=this._events[T];if(c.fn)c.fn===L&&(!w||c.once)&&(!S||c.context===S)&&R(this,T);else{for(var o=0,d=[],u=c.length;o<u;o++)(c[o].fn!==L||w&&!c[o].once||S&&c[o].context!==S)&&d.push(c[o]);d.length?this._events[T]=d.length===1?d[0]:d:R(this,T)}return this},O.prototype.removeAllListeners=function(C){var L;return C?(L=M?M+C:C,this._events[L]&&R(this,L)):(this._events=new P,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=M,O.EventEmitter=O,q.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,G,A){(function(H){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(O,b,C){if(C=C||{},O=O.trim(),b=b.trim(),!b){if(!C.alwaysNormalize)return O;var L=R.parseURL(O);if(!L)throw new Error("Error trying to parse base URL.");return L.path=R.normalizePath(L.path),R.buildURLFromParts(L)}var S=R.parseURL(b);if(!S)throw new Error("Error trying to parse relative URL.");if(S.scheme)return C.alwaysNormalize?(S.path=R.normalizePath(S.path),R.buildURLFromParts(S)):b;var w=R.parseURL(O);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var T=P.exec(w.path);w.netLoc=T[1],w.path=T[2]}w.netLoc&&!w.path&&(w.path="/");var c={scheme:w.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(c.netLoc=w.netLoc,S.path[0]!=="/"))if(!S.path)c.path=w.path,S.params||(c.params=w.params,S.query||(c.query=w.query));else{var o=w.path,d=o.substring(0,o.lastIndexOf("/")+1)+S.path;c.path=R.normalizePath(d)}return c.path===null&&(c.path=C.alwaysNormalize?R.normalizePath(S.path):S.path),R.buildURLFromParts(c)},parseURL:function(O){var b=M.exec(O);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(F,"");O.length!==(O=O.replace(I,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};q.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(q,G,A){function H(C){var L={};function S(T){if(L[T])return L[T].exports;var c=L[T]={i:T,l:!1,exports:{}};return C[T].call(c.exports,c,c.exports,S),c.l=!0,c.exports}S.m=C,S.c=L,S.i=function(T){return T},S.d=function(T,c,o){S.o(T,c)||Object.defineProperty(T,c,{configurable:!1,enumerable:!0,get:o})},S.r=function(T){Object.defineProperty(T,"__esModule",{value:!0})},S.n=function(T){var c=T&&T.__esModule?function(){return T.default}:function(){return T};return S.d(c,"a",c),c},S.o=function(T,c){return Object.prototype.hasOwnProperty.call(T,c)},S.p="/",S.oe=function(T){throw console.error(T),T};var w=S(S.s=ENTRY_MODULE);return w.default||w}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function F(C){return(C+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(C){return!isNaN(1*C)}function R(C,L,S){var w={};w[S]=[];var T=L.toString(),c=T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return w;for(var o=c[1],d=new RegExp("(\\\\n|\\W)"+F(o)+P,"g"),u;u=d.exec(T);){if(u[3]==="dll-reference")continue;w[S].push(u[3])}for(d=new RegExp("\\("+F(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");u=d.exec(T);)C[u[2]]||(w[S].push(u[1]),C[u[2]]=A(u[1]).m),w[u[2]]=w[u[2]]||[],w[u[2]].push(u[4]);for(var x=Object.keys(w),g=0;g<x.length;g++)for(var m=0;m<w[x[g]].length;m++)I(w[x[g]][m])&&(w[x[g]][m]=1*w[x[g]][m]);return w}function O(C){var L=Object.keys(C);return L.reduce(function(S,w){return S||C[w].length>0},!1)}function b(C,L){for(var S={main:[L]},w={main:[]},T={main:{}};O(S);)for(var c=Object.keys(S),o=0;o<c.length;o++){var d=c[o],u=S[d],x=u.pop();if(T[d]=T[d]||{},T[d][x]||!C[d][x])continue;T[d][x]=!0,w[d]=w[d]||[],w[d].push(x);for(var g=R(C,C[d][x],d),m=Object.keys(g),l=0;l<m.length;l++)S[m[l]]=S[m[l]]||[],S[m[l]]=S[m[l]].concat(g[m[l]])}return w}q.exports=function(C,L){L=L||{};var S={main:A.m},w=L.all?{main:Object.keys(S.main)}:b(S,C),T="";Object.keys(w).filter(function(x){return x!=="main"}).forEach(function(x){for(var g=0;w[x][g];)g++;w[x].push(g),S[x][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",T=T+"var "+x+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+w[x].map(function(m){return""+JSON.stringify(m)+": "+S[x][m].toString()}).join(",")+`});
|
|
`}),T=T+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(C))+")({"+w.main.map(function(x){return""+JSON.stringify(x)+": "+S.main[x].toString()}).join(",")+"}))(self);";var c=new window.Blob([T],{type:"text/javascript"});if(L.bare)return c;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,d=o.createObjectURL(c),u=new window.Worker(d);return u.objectURL=d,u}},"./src/config.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"hlsDefaultConfig",function(){return l}),A.d(G,"mergeConfig",function(){return f}),A.d(G,"enableStreamingMode",function(){return h});var H=A("./src/controller/abr-controller.ts"),M=A("./src/controller/audio-stream-controller.ts"),P=A("./src/controller/audio-track-controller.ts"),F=A("./src/controller/subtitle-stream-controller.ts"),I=A("./src/controller/subtitle-track-controller.ts"),R=A("./src/controller/buffer-controller.ts"),O=A("./src/controller/timeline-controller.ts"),b=A("./src/controller/cap-level-controller.ts"),C=A("./src/controller/fps-controller.ts"),L=A("./src/controller/eme-controller.ts"),S=A("./src/controller/cmcd-controller.ts"),w=A("./src/utils/xhr-loader.ts"),T=A("./src/utils/fetch-loader.ts"),c=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),d=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(s[p]=v[p])}return s},u.apply(this,arguments)}function x(s,a){var v=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(s,E).enumerable})),v.push.apply(v,p)}return v}function g(s){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?x(Object(v),!0).forEach(function(p){m(s,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(v)):x(Object(v)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(v,p))})}return s}function m(s,a,v){return a in s?Object.defineProperty(s,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):s[a]=v,s}var l=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:R.default,capLevelController:b.default,fpsController:C.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:I.default,timelineController:O.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:L.default,cmcdController:S.default});function y(){return{cueHandler:c.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},s,a)}function h(s){var a=s.loader;if(a!==T.default&&a!==w.default)d.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var v=Object(T.fetchSupported)();v&&(s.loader=T.default,s.progressive=!0,s.enableSoftwareAES=!0,d.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/polyfills/number.ts"),M=A("./src/utils/ewma-bandwidth-estimator.ts"),P=A("./src/events.ts"),F=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/types/loader.ts"),O=A("./src/utils/logger.ts");function b(S,w){for(var T=0;T<w.length;T++){var c=w[T];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(S,c.key,c)}}function C(S,w,T){return w&&b(S.prototype,w),T&&b(S,T),S}var L=function(){function S(T){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=T;var c=T.config;this.bwEstimator=new M.default(c.abrEwmaSlowVoD,c.abrEwmaFastVoD,c.abrEwmaDefaultEstimate),this.registerListeners()}var w=S.prototype;return w.registerListeners=function(){var c=this.hls;c.on(P.Events.FRAG_LOADING,this.onFragLoading,this),c.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(P.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var c=this.hls;c.off(P.Events.FRAG_LOADING,this.onFragLoading,this),c.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(P.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(c,o){var d=o.frag;if(d.type===R.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=d,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(c,o){var d=this.hls.config;o.details.live?this.bwEstimator.update(d.abrEwmaSlowLive,d.abrEwmaFastLive):this.bwEstimator.update(d.abrEwmaSlowVoD,d.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var c=this.fragCurrent,o=this.partCurrent,d=this.hls,u=d.autoLevelEnabled,x=d.config,g=d.media;if(!c||!g)return;var m=o?o.stats:c.stats,l=o?o.duration:c.duration;if(m.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||g.paused||!g.playbackRate||!g.readyState)return;var y=performance.now()-m.loading.start,f=Math.abs(g.playbackRate);if(y<=500*l/f)return;var h=d.levels,s=d.minAutoLevel,a=h[c.level],v=m.total||Math.max(m.loaded,Math.round(l*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),E=(v-m.loaded)/p,D=g.currentTime,N=(F.BufferHelper.bufferInfo(g,D,x.maxBufferHole).end-D)/f;if(N>=2*l/f||E<=N)return;var W=Number.POSITIVE_INFINITY,z;for(z=c.level-1;z>s;z--){var B=h[z].maxBitrate;if(W=l*B/(8*.8*p),W<N)break}if(W>=E)return;var U=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+c.sn+(o?" part "+o.index:"")+" of level "+c.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(U)?(U/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+E.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),d.nextLoadLevel=z,this.bwEstimator.sample(y,m.loaded),this.clearTimer(),c.loader&&(this.fragCurrent=this.partCurrent=null,c.loader.abort()),d.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:c,part:o,stats:m})},w.onFragLoaded=function(c,o){var d=o.frag,u=o.part;if(d.type===R.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(d.sn)){var x=u?u.stats:d.stats,g=u?u.duration:d.duration;if(this.clearTimer(),this.lastLoadedFragLevel=d.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[d.level],l=(m.loaded?m.loaded.bytes:0)+x.loaded,y=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:l,duration:y},m.realBitrate=Math.round(8*l/y)}if(d.bitrateTest){var f={stats:x,frag:d,part:u,id:d.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),d.bitrateTest=!1}}},w.onFragBuffered=function(c,o){var d=o.frag,u=o.part,x=u?u.stats:d.stats;if(x.aborted)return;if(d.type!==R.PlaylistLevelType.MAIN||d.sn==="initSegment")return;var g=x.parsing.end-x.loading.start;this.bwEstimator.sample(g,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),d.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},w.onError=function(c,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var c=this.fragCurrent,o=this.partCurrent,d=this.hls,u=d.maxAutoLevel,x=d.config,g=d.minAutoLevel,m=d.media,l=o?o.duration:c?c.duration:0,y=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,s=(F.BufferHelper.bufferInfo(m,y,x.maxBufferHole).end-y)/f,a=this.findBestLevel(h,g,u,s,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=l?Math.min(l,x.maxStarvationDelay):x.maxStarvationDelay,p=x.abrBandWidthFactor,E=x.abrBandWidthUpFactor;if(!s){var D=this.bitrateTestDelay;if(D){var N=l?Math.min(l,x.maxLoadingDelay):x.maxLoadingDelay;v=N-D,O.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=E=1}}return a=this.findBestLevel(h,g,u,s+v,p,E),Math.max(a,0)},w.findBestLevel=function(c,o,d,u,x,g){for(var m,l=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,s=h[f],a=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),v=s==null?void 0:s.codecSet,p=y?y.duration:l?l.duration:0,E=d;E>=o;E--){var D=h[E];if(!D||v&&D.codecSet!==v)continue;var N=D.details,W=(y?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||p,z=void 0;E<=f?z=x*c:z=g*c;var B=h[E].maxBitrate,U=B*W/z;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(z)+"/"+B+"/"+W+"/"+u+"/"+U),z>B&&(!U||a&&!this.bitrateTestDelay||U<u))return E}return-1},C(S,[{key:"nextAutoLevel",get:function(){var c=this._nextAutoLevel,o=this.bwEstimator;if(c!==-1&&(!o||!o.canEstimate()))return c;var d=this.getNextABRAutoLevel();return c!==-1&&(d=Math.min(c,d)),d},set:function(c){this._nextAutoLevel=c}}]),S}();G.default=L},"./src/controller/audio-stream-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/events.ts"),F=A("./src/utils/buffer-helper.ts"),I=A("./src/controller/fragment-tracker.ts"),R=A("./src/types/level.ts"),O=A("./src/types/loader.ts"),b=A("./src/loader/fragment.ts"),C=A("./src/demux/chunk-cache.ts"),L=A("./src/demux/transmuxer-interface.ts"),S=A("./src/types/transmuxer.ts"),w=A("./src/controller/fragment-finders.ts"),T=A("./src/utils/discontinuities.ts"),c=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function d(){return d=Object.assign||function(l){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(l[h]=f[h])}return l},d.apply(this,arguments)}function u(l,y){l.prototype=Object.create(y.prototype),l.prototype.constructor=l,x(l,y)}function x(l,y){return x=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},x(l,y)}var g=100,m=function(l){u(y,l);function y(h,s){var a;return a=l.call(this,h,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var s=this.hls;s.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(P.Events.ERROR,this.onError,this),s.on(P.Events.BUFFER_RESET,this.onBufferReset,this),s.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var s=this.hls;s.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(P.Events.ERROR,this.onError,this),s.off(P.Events.BUFFER_RESET,this.onBufferReset,this),s.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(s,a){var v=a.frag,p=a.id,E=a.initPTS;if(p==="main"){var D=v.cc;this.initPTS[v.cc]=E,this.log("InitPTS for cc: "+D+" found from main: "+E),this.videoTrackCC=D,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},f.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var s,a=this.levels,v=this.trackId,p=a==null||((s=a[v])===null||s===void 0)?void 0:s.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var E,D=performance.now(),N=this.retryDate;(!N||D>=N||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var z=W.frag,B=W.part,U=W.cache,X=W.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var ne=U.flush(),le={frag:z,part:B,payload:ne,networkDetails:null};this._handleFragmentLoadProgress(le),X&&l.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),we=F.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),ge=Object(w.fragmentWithinToleranceTest)(we.end,this.config.maxFragLookUpTolerance,z);ge<0&&(o.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+we.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},f.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},f.doTickIdle=function(){var s,a,v=this.hls,p=this.levels,E=this.media,D=this.trackId,N=v.config;if(!p||!p[D])return;if(!E&&(this.startFragRequested||!N.startFragPrefetch))return;var W=p[D],z=W.details;if(!z||z.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(z)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(B===null)return;var U=B.len,X=this.getMaxBufferLength(),ne=this.audioSwitch;if(U>=X&&!ne)return;if(!ne&&this._streamEnded(B,z)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var le=z.fragments,de=le[0].start,we=B.end;if(ne){var ge=this.getLoadPosition();we=ge,z.PTSKnown&&ge<de&&((B.end>de||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=de+.05))}var ve=this.getNextFragment(we,z);if(!ve){this.bufferFlushed=!0;return}((s=ve.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=ve.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ve,z):this.loadFragment(ve,z,we)},f.getMaxBufferLength=function(){var s=l.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,l.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(s,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(p){return new R.Level(p)})},f.onAudioTrackSwitching=function(s,a){var v=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(g):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(s,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(s,a){var v,p=this.levels,E=a.details,D=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var N=p[D],W=0;if(E.live||(v=N.details)!==null&&v!==void 0&&v.live){var z=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!z)return;!N.details&&E.hasProgramDateTime&&z.hasProgramDateTime?(Object(T.alignMediaPlaylistByPDT)(E,z),W=E.fragments[0].start):W=this.alignPlaylists(E,N.details)}N.details=E,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(N.details,W),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=M.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(s){var a,v=s.frag,p=s.part,E=s.payload,D=this.config,N=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var z=W[N];console.assert(z,"Audio track is defined on fragment load progress");var B=z.details;console.assert(B,"Audio track details are defined on fragment load progress");var U=D.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new L.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ne=this.initPTS[v.cc],le=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(ne!==void 0){var de=!1,we=p?p.index:-1,ge=we!==-1,ve=new S.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,E.byteLength,we,ge);X.push(E,le,U,"",v,p,B.totalduration,de,ve,ne)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+N);var he=this.waitingData=this.waitingData||{frag:v,part:p,cache:new C.default,complete:!1},fe=he.cache;fe.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}l.prototype._handleFragmentLoadComplete.call(this,s)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(s,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(s,a){var v=a.frag,p=a.part;if(v.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(p?" p: "+p.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,p)},f.onError=function(s,a){switch(a.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(O.PlaylistLevelType.AUDIO,a);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=a.fatal?M.State.ERROR:M.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var v=!0,p=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);p&&p.len>.5&&(v=!this.reduceMaxBufferLength(p.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(s,a){var v=a.type;v===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(s){var a,v="audio",p=this.hls,E=s.remuxResult,D=s.chunkMeta,N=this.getCurrentContext(D);if(!N){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var W=N.frag,z=N.part,B=E.audio,U=E.text,X=E.id3,ne=E.initSegment;if(this.fragContextChanged(W))return;if(this.state=M.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),ne!=null&&ne.tracks&&(this._bufferInitSegment(ne.tracks,W,D),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:v,tracks:ne.tracks})),B){var le=B.startPTS,de=B.endPTS,we=B.startDTS,ge=B.endDTS;z&&(z.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:de,startDTS:we,endDTS:ge}),W.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,le,de,we,ge),this.bufferFragmentData(B,W,z,D)}if(X!=null&&(a=X.samples)!==null&&a!==void 0&&a.length){var ve=d({frag:W,id:v},X);p.trigger(P.Events.FRAG_PARSING_METADATA,ve)}if(U){var he=d({frag:W,id:v},U);p.trigger(P.Events.FRAG_PARSING_USERDATA,he)}},f._bufferInitSegment=function(s,a,v){if(this.state!==M.State.PARSING)return;s.video&&delete s.video;var p=s.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,s);var E=p.initSegment;if(E!=null&&E.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,D)}this.tick()},f.loadFragment=function(s,a,v){var p=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||p===I.FragmentState.NOT_LOADED||p===I.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(H.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,s,a,v)))},f.completeAudioSwitch=function(){var s=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},y}(M.default);G.default=m},"./src/controller/audio-track-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/controller/base-playlist-controller.ts"),F=A("./src/types/loader.ts");function I(L,S){for(var w=0;w<S.length;w++){var T=S[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(L,T.key,T)}}function R(L,S,w){return S&&I(L.prototype,S),w&&I(L,w),L}function O(L,S){L.prototype=Object.create(S.prototype),L.prototype.constructor=L,b(L,S)}function b(L,S){return b=Object.setPrototypeOf||function(T,c){return T.__proto__=c,T},b(L,S)}var C=function(L){O(S,L);function S(T){var c;return c=L.call(this,T,"[audio-track-controller]")||this,c.tracks=[],c.groupId=null,c.tracksInGroup=[],c.trackId=-1,c.trackName="",c.selectDefaultTrack=!0,c.registerListeners(),c}var w=S.prototype;return w.registerListeners=function(){var c=this.hls;c.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(H.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var c=this.hls;c.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),c.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(H.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,L.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(c,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(c,o){var d=o.id,u=o.details,x=this.tracksInGroup[d];if(!x){this.warn("Invalid audio track id "+d);return}var g=x.details;x.details=o.details,this.log("audioTrack "+d+" loaded ["+u.startSN+"-"+u.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,o,g))},w.onLevelLoading=function(c,o){this.switchLevel(o.level)},w.onLevelSwitching=function(c,o){this.switchLevel(o.level)},w.switchLevel=function(c){var o=this.hls.levels[c];if(!(o!=null&&o.audioGroupIds))return;var d=o.audioGroupIds[o.urlId];if(this.groupId!==d){this.groupId=d;var u=this.tracks.filter(function(g){return!d||g.groupId===d});this.selectDefaultTrack&&!u.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var x={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},w.onError=function(c,o){if(L.prototype.onError.call(this,c,o),o.fatal||!o.context)return;o.context.type===F.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(c){var o=this.tracksInGroup;if(c<0||c>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var d=o[this.trackId];this.log("Now switching to audio-track index "+c);var u=o[c],x=u.id,g=u.groupId,m=g===void 0?"":g,l=u.name,y=u.type,f=u.url;if(this.trackId=c,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:m,name:l,type:y,url:f}),u.details&&!u.details.live)return;var h=this.switchParams(u.url,d==null?void 0:d.details);this.loadPlaylist(h)},w.selectInitialTrack=function(){var c=this.tracksInGroup;console.assert(c.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,d=this.findTrackId(o)||this.findTrackId();d!==-1?this.setAudioTrack(d):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(c){for(var o=this.tracksInGroup,d=0;d<o.length;d++){var u=o[d];if((!this.selectDefaultTrack||u.default)&&(!c||c===u.name))return u.id}return-1},w.loadPlaylist=function(c){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var d=o.id,u=o.groupId,x=o.url;if(c)try{x=c.addDirectives(x)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+d),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:x,id:d,groupId:u,deliveryDirectives:c||null})}},R(S,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(c){this.selectDefaultTrack=!1,this.setAudioTrack(c)}}]),S}(P.default);G.default=C},"./src/controller/base-playlist-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return R});var H=A("./src/polyfills/number.ts"),M=A("./src/types/level.ts"),P=A("./src/controller/level-helper.ts"),F=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),R=function(){function O(C,L){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,L+":"),this.warn=F.logger.warn.bind(F.logger,L+":"),this.hls=C}var b=O.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(L,S){S.fatal&&S.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(L,S){var w=S==null?void 0:S.renditionReports;if(w)for(var T=0;T<w.length;T++){var c=w[T],o=""+c.URI;if(o===L.substr(-o.length)){var d=parseInt(c["LAST-MSN"]),u=parseInt(c["LAST-PART"]);if(S&&this.hls.config.lowLatencyMode){var x=Math.min(S.age-S.partTarget,S.targetduration);u!==void 0&&x>S.partTarget&&(u+=1)}if(Object(H.isFiniteNumber)(d))return new M.HlsUrlParameters(d,Object(H.isFiniteNumber)(u)?u:void 0,M.HlsSkip.No)}}},b.loadPlaylist=function(L){},b.shouldLoadTrack=function(L){return this.canLoad&&L&&!!L.url&&(!L.details||L.details.live)},b.playlistLoaded=function(L,S,w){var T=this,c=S.details,o=S.stats,d=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(c.advancedDateTime=Date.now()-d,c.live||w!=null&&w.live){if(c.reloaded(w),w&&this.log("live playlist "+L+" "+(c.advanced?"REFRESHED "+c.lastPartSn+"-"+c.lastPartIndex:"MISSED")),w&&c.fragments.length>0&&Object(P.mergeDetails)(w,c),!this.canLoad||!c.live)return;var u,x=void 0,g=void 0;if(c.canBlockReload&&c.endSN&&c.advanced){var m=this.hls.config.lowLatencyMode,l=c.lastPartSn,y=c.endSN,f=c.lastPartIndex,h=f!==-1,s=l===y,a=m?0:f;h?(x=s?y+1:l,g=s?a:f+1):x=y+1;var v=c.age,p=v+c.ageHeader,E=Math.min(p-c.partTarget,c.targetduration*1.5);if(E>0){if(w&&E>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+E+" with playlist age: "+c.age),E=0;else{var D=Math.floor(E/c.targetduration);if(x+=D,g!==void 0){var N=Math.round(E%c.targetduration/c.partTarget);g+=N}this.log("CDN Tune-in age: "+c.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+E+" skip sn "+D+" to part "+g)}c.tuneInGoal=E}if(u=this.getDeliveryDirectives(c,S.deliveryDirectives,x,g),m||!s){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(c,S.deliveryDirectives,x,g);var W=Object(P.computeReloadInterval)(c,o);x!==void 0&&c.canBlockReload&&(W-=c.partTarget||1),this.log("reload live playlist "+L+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return T.loadPlaylist(u)},W)}else this.clearTimer()},b.getDeliveryDirectives=function(L,S,w,T){var c=Object(M.getSkipValue)(L,w);return S!=null&&S.skip&&L.deltaUpdateFailed&&(w=S.msn,T=S.part,c=M.HlsSkip.No),new M.HlsUrlParameters(w,T,c)},b.retryLoadingOrFail=function(L){var S=this,w=this.hls.config,T=this.retryCount<w.levelLoadingMaxRetry;if(T){var c;if(this.retryCount++,L.details.indexOf("LoadTimeOut")>-1&&(c=L.context)!==null&&c!==void 0&&c.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+L.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return S.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+L.details+'"')}}else this.warn('cannot recover from error "'+L.details+'"'),this.clearTimer(),L.fatal=!0;return T},O}()},"./src/controller/base-stream-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"State",function(){return y}),A.d(G,"default",function(){return f});var H=A("./src/polyfills/number.ts"),M=A("./src/task-loop.ts"),P=A("./src/controller/fragment-tracker.ts"),F=A("./src/utils/buffer-helper.ts"),I=A("./src/utils/logger.ts"),R=A("./src/events.ts"),O=A("./src/errors.ts"),b=A("./src/types/transmuxer.ts"),C=A("./src/utils/mp4-tools.ts"),L=A("./src/utils/discontinuities.ts"),S=A("./src/controller/fragment-finders.ts"),w=A("./src/controller/level-helper.ts"),T=A("./src/loader/fragment-loader.ts"),c=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),d=A("./src/types/loader.ts");function u(h,s){for(var a=0;a<s.length;a++){var v=s[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(h,v.key,v)}}function x(h,s,a){return s&&u(h.prototype,s),a&&u(h,a),h}function g(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function m(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,l(h,s)}function l(h,s){return l=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},l(h,s)}var y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(h){m(s,h);function s(v,p,E){var D;return D=h.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=y.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=E,D.log=I.logger.log.bind(I.logger,E+":"),D.warn=I.logger.warn.bind(I.logger,E+":"),D.hls=v,D.fragmentLoader=new T.default(v.config),D.fragmentTracker=p,D.config=v.config,D.decrypter=new c.default(v,v.config),v.on(R.Events.KEY_LOADED,D.onKeyLoaded,g(D)),D}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(p,E){var D=this.fragCurrent,N=this.fragmentTracker;if(!E.live&&D&&D.sn===E.endSN&&!p.nextStart){var W=N.getState(D);return W===P.FragmentState.PARTIAL||W===P.FragmentState.OK}return!1},a.onMediaAttached=function(p,E){var D=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(N.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var p=this.config,E=this.fragCurrent,D=this.media,N=this.mediaBuffer,W=this.state,z=D?D.currentTime:0,B=F.BufferHelper.bufferInfo(N||D,z,p.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+W),W===y.ENDED)this.resetLoadingState();else if(E&&!B.len){var U=p.maxFragLookUpTolerance,X=E.start-U,ne=E.start+E.duration+U,le=z>ne;(z<X||le)&&(le&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=z),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,E){if(this.state!==y.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var D=this.levels[E.frag.level].details;D&&this.loadFragment(E.frag,D,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.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,h.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,E){this.log("Loading key for "+p.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(R.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,E,D){this._loadFragForPlayback(p,E,D)},a._loadFragForPlayback=function(p,E,D){var N=this,W=function(B){if(N.fragContextChanged(p)){N.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),N.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,N._handleFragmentLoadProgress(B)};this._doFragLoad(p,E,D,W).then(function(z){if(!z)return;N.fragLoadError=0;var B=N.state;if(N.fragContextChanged(p)){(B===y.FRAG_LOADING||B===y.BACKTRACKING||!N.fragCurrent&&B===y.PARSING)&&(N.fragmentTracker.removeFragment(p),N.state=y.IDLE);return}if("payload"in z&&(N.log("Loaded fragment "+p.sn+" of level "+p.level),N.hls.trigger(R.Events.FRAG_LOADED,z),N.state===y.BACKTRACKING)){N.fragmentTracker.backtrack(p,z),N.resetFragmentLoading(p);return}N._handleFragmentLoadComplete(z)}).catch(function(z){N.warn(z),N.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,E,D){if(D===void 0&&(D=null),!(p-E))return;var N={startOffset:p,endOffset:E,type:D};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,N)},a._loadInitSegment=function(p){var E=this;this._doFragLoad(p).then(function(D){if(!D||E.fragContextChanged(p)||!E.levels)throw new Error("init load aborted");return D}).then(function(D){var N=E.hls,W=D.payload,z=p.decryptdata;if(W&&W.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var B=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(W),z.key.buffer,z.iv.buffer).then(function(U){var X=self.performance.now();return N.trigger(R.Events.FRAG_DECRYPTED,{frag:p,payload:U,stats:{tstart:B,tdecrypt:X}}),D.payload=U,D})}return D}).then(function(D){var N=E.fragCurrent,W=E.hls,z=E.levels;if(!z)throw new Error("init load aborted, missing levels");var B=z[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var U=p.stats;E.state=y.IDLE,E.fragLoadError=0,p.data=new Uint8Array(D.payload),U.parsing.start=U.buffering.start=self.performance.now(),U.parsing.end=U.buffering.end=self.performance.now(),D.frag===N&&W.trigger(R.Events.FRAG_BUFFERED,{stats:U,frag:N,part:null,id:p.type}),E.tick()}).catch(function(D){E.warn(D),E.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var E=this.fragCurrent;return!p||!E||p.level!==E.level||p.sn!==E.sn||p.urlId!==E.urlId},a.fragBufferedComplete=function(p,E){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(F.BufferHelper.getBuffered(D))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var E=this.transmuxer;if(!E)return;var D=p.frag,N=p.part,W=p.partsLoaded,z=!W||W.length===0||W.some(function(U){return!U}),B=new b.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,N?N.index:-1,!z);E.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,E,D,N){var W=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(p.start,D||0),this.config.lowLatencyMode&&E){var z=E.partList;if(z&&N){D>p.end&&E.fragmentHint&&(p=E.fragmentHint);var B=this.getNextPart(z,p,D);if(B>-1){var U=z[B];return this.log("Loading part sn: "+p.sn+" p: "+U.index+" cc: "+p.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+B+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=U.start+U.duration,this.state=y.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,part:z[B],targetBufferTime:D}),this.doFragPartsLoad(p,z,B,N).catch(function(X){return W.handleFragLoadError(X)})}else if(!p.url||this.loadedEndOfParts(z,D))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(D.toFixed(3))),Object(H.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,targetBufferTime:D}),this.fragmentLoader.load(p,N).catch(function(X){return W.handleFragLoadError(X)})},a.doFragPartsLoad=function(p,E,D,N){var W=this;return new Promise(function(z,B){var U=[],X=function ne(le){var de=E[le];W.fragmentLoader.loadPart(p,de,N).then(function(we){U[de.index]=we;var ge=we.part;W.hls.trigger(R.Events.FRAG_LOADED,we);var ve=E[le+1];if(ve&&ve.fragment===p)ne(le+1);else return z({frag:p,part:ge,partsLoaded:U})}).catch(B)};X(D)})},a.handleFragLoadError=function(p){var E=p.data;return E&&E.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(R.Events.ERROR,E),null},a._handleTransmuxerFlush=function(p){var E=this.getCurrentContext(p);if(!E||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var D=E.frag,N=E.part,W=E.level,z=self.performance.now();D.stats.parsing.end=z,N&&(N.stats.parsing.end=z),this.updateLevelTiming(D,N,W,p.partial)},a.getCurrentContext=function(p){var E=this.levels,D=p.level,N=p.sn,W=p.part;if(!E||!E[D])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+D+". The current chunk will not be buffered."),null;var z=E[D],B=W>-1?Object(w.getPartWith)(z,N,W):null,U=B?B.fragment:Object(w.getFragmentWithSN)(z,N,this.fragCurrent);return U?{frag:U,part:B,level:z}:null},a.bufferFragmentData=function(p,E,D,N){if(!p||this.state!==y.PARSING)return;var W=p.data1,z=p.data2,B=W;if(W&&z&&(B=Object(C.appendUint8Array)(W,z)),!B||!B.length)return;var U={type:p.type,frag:E,part:D,chunkMeta:N,parent:E.type,data:B};this.hls.trigger(R.Events.BUFFER_APPENDING,U),p.dropped&&p.independent&&!D&&this.flushBufferGap(E)},a.flushBufferGap=function(p){var E=this.media;if(!E)return;if(!F.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,p.start);return}var D=E.currentTime,N=F.BufferHelper.bufferInfo(E,D,0),W=p.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),B=Math.max(Math.min(p.start-z,N.end-z),D+z);p.start-B>z&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,E){var D=this.config,N=this.getLoadPosition();if(!Object(H.isFiniteNumber)(N))return null;var W=F.BufferHelper.bufferInfo(p,N,D.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(N,E);if(z&&W.nextStart<z.end)return F.BufferHelper.bufferInfo(p,N,Math.max(W.nextStart,D.maxBufferHole))}return W},a.getMaxBufferLength=function(p){var E=this.config,D;return p?D=Math.max(8*E.maxBufferSize/p,E.maxBufferLength):D=E.maxBufferLength,Math.min(D,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var E=this.config,D=p||E.maxBufferLength;return E.maxMaxBufferLength>=D?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,E){var D,N,W=E.fragments,z=W.length;if(!z)return null;var B=this.config,U=W[0].start,X;if(E.live){var ne=B.initialLiveManifestSize;if(z<ne)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+ne+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(E,W),this.startPosition=X?this.hls.liveSyncPosition||X.start:p)}else p<=U&&(X=W[0]);if(!X){var le=B.lowLatencyMode?E.partEnd:E.fragmentEnd;X=this.getFragmentAtPosition(p,le,E)}return(D=X)!==null&&D!==void 0&&D.initSegment&&!((N=X)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},a.getNextPart=function(p,E,D){for(var N=-1,W=!1,z=!0,B=0,U=p.length;B<U;B++){var X=p[B];if(z=z&&!X.independent,N>-1&&D<X.start)break;var ne=X.loaded;!ne&&(W||X.independent||z)&&X.fragment===E&&(N=B),W=ne}return N},a.loadedEndOfParts=function(p,E){var D=p[p.length-1];return D&&E>D.start&&D.loaded},a.getInitialLiveFragment=function(p,E){var D=this.fragPrevious,N=null;if(D){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),N=Object(S.findFragmentByPDT)(E,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var W=D.sn+1;if(W>=p.startSN&&W<=p.endSN){var z=E[W-p.startSN];D.cc===z.cc&&(N=z,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(S.findFragWithCC)(E,D.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(N=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return N},a.getFragmentAtPosition=function(p,E,D){var N=this.config,W=this.fragPrevious,z=D.fragments,B=D.endSN,U=D.fragmentHint,X=N.maxFragLookUpTolerance,ne=!!(N.lowLatencyMode&&D.partList&&U);ne&&U&&!this.bitrateTest&&(z=z.concat(U),B=U.sn);var le;if(p<E){var de=p>E-X?0:X;le=Object(S.findFragmentByPTS)(W,z,p,de)}else le=z[z.length-1];if(le){var we=le.sn-D.startSN,ge=W&&le.level===W.level,ve=z[we+1],he=this.fragmentTracker.getState(le);if(he===P.FragmentState.BACKTRACKED){le=null;for(var fe=we;z[fe]&&this.fragmentTracker.getState(z[fe])===P.FragmentState.BACKTRACKED;)W?le=z[fe--]:le=z[--fe];le||(le=ve)}else W&&le.sn===W.sn&&!ne&&(ge&&(le.sn<B&&this.fragmentTracker.getState(ve)!==P.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+ve.sn),le=ve):le=null))}return le},a.synchronizeToLiveEdge=function(p){var E=this.config,D=this.media;if(!D)return;var N=this.hls.liveSyncPosition,W=D.currentTime,z=p.fragments[0].start,B=p.edge,U=W>=z-E.maxFragLookUpTolerance&&W<=B;if(N!==null&&D.duration>N&&(W<N||!U)){var X=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*p.targetduration;(!U&&D.readyState<4||W<B-X)&&(this.loadedmetadata||(this.nextLoadPosition=N),D.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+N.toFixed(3)),D.currentTime=N))}},a.alignPlaylists=function(p,E){var D=this.levels,N=this.levelLastLoaded,W=this.fragPrevious,z=N!==null?D[N]:null,B=p.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var U=p.fragments[0].start,X=!E,ne=p.alignedSliding&&Object(H.isFiniteNumber)(U);if(X||!ne&&!U){Object(L.alignStream)(W,z,p);var le=p.fragments[0].start;return this.log("Live playlist sliding: "+le.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+p.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+B),le}return U},a.waitForCdnTuneIn=function(p){var E=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*E)},a.setStartPosition=function(p,E){var D=this.startPosition;if(D<E&&(D=-1),D===-1||this.lastCurrentTime===-1){var N=p.startTimeOffset;Object(H.isFiniteNumber)(N)?(D=E+N,N<0&&(D+=p.totalduration),D=Math.min(Math.max(E,D),E+p.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+D),this.startPosition=D):p.live?D=this.hls.liveSyncPosition||E:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var p=this.media,E=0;return this.loadedmetadata&&p?E=p.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(p,E){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(E?" part"+E.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(p,E){if(E.fatal)return;var D=E.frag;if(!D||D.type!==p)return;var N=this.fragCurrent;console.assert(N&&D.sn===N.sn&&D.level===N.level&&D.urlId===N.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+p+" "+D.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(p===d.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(I.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(p,E,D){if(!p)return;var N=F.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(E,N,D),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[p].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,E,D,N){var W=this,z=D.details;console.assert(!!z,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(U,X){var ne=p.elementaryStreams[X];if(ne){var le=ne.endPTS-ne.startPTS;if(le<=0)return W.warn("Could not parse fragment "+p.sn+" "+X+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),U||!1;var de=N?0:Object(w.updateFragPTSDTS)(z,p,ne.startPTS,ne.endPTS,ne.startDTS,ne.endDTS);return W.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:z,level:D,drift:de,type:X,frag:p,start:ne.startPTS,end:ne.endPTS}),!0}return U},!1);B?(this.state=y.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:p,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(s,[{key:"state",get:function(){return this._state},set:function(p){var E=this._state;E!==p&&(this._state=p,this.log(E+"->"+p))}}]),s}(M.default)},"./src/controller/buffer-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return S});var H=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),F=A("./src/errors.ts"),I=A("./src/utils/buffer-helper.ts"),R=A("./src/utils/mediasource-helper.ts"),O=A("./src/loader/fragment.ts"),b=A("./src/controller/buffer-operation-queue.ts"),C=Object(R.getMediaSource)(),L=/([ha]vc.)(?:\.[^.,]+)+/,S=function(){function w(c){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var d=o.hls,u=o.media,x=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),d.trigger(M.Events.MEDIA_ATTACHED,{media:u})),x&&x.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=c,this._initSourceBuffer(),this.registerListeners()}var T=w.prototype;return T.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},T.destroy=function(){this.unregisterListeners(),this.details=null},T.registerListeners=function(){var o=this.hls;o.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(M.Events.BUFFER_RESET,this.onBufferReset,this),o.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(M.Events.BUFFER_EOS,this.onBufferEos,this),o.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(M.Events.FRAG_PARSED,this.onFragParsed,this),o.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},T.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(M.Events.BUFFER_RESET,this.onBufferReset,this),o.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(M.Events.BUFFER_EOS,this.onBufferEos,this),o.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(M.Events.FRAG_PARSED,this.onFragParsed,this),o.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},T._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},T.onManifestParsed=function(o,d){var u=2;(d.audio&&!d.video||!d.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},T.onMediaAttaching=function(o,d){var u=this.media=d.media;if(u&&C){var x=this.mediaSource=new C;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(x),this._objectUrl=u.src}},T.onMediaDetaching=function(){var o=this.media,d=this.mediaSource,u=this._objectUrl;if(d){if(P.logger.log("[buffer-controller]: media source detaching"),d.readyState==="open")try{d.endOfStream()}catch(x){P.logger.warn("[buffer-controller]: onMediaDetaching: "+x.message+" while calling endOfStream")}this.onBufferReset(),d.removeEventListener("sourceopen",this._onMediaSourceOpen),d.removeEventListener("sourceended",this._onMediaSourceEnded),d.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):P.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(M.Events.MEDIA_DETACHED,void 0)},T.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(d){var u=o.sourceBuffer[d];try{u&&(o.removeBufferListeners(d),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[d]=void 0)}catch(x){P.logger.warn("[buffer-controller]: Failed to reset the "+d+" buffer",x)}}),this._initSourceBuffer()},T.onBufferCodecs=function(o,d){var u=this,x=this.getSourceBufferTypes().length;if(Object.keys(d).forEach(function(g){if(x){var m=u.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var l=d[g],y=l.codec,f=l.levelCodec,h=l.container,s=(m.levelCodec||m.codec).replace(L,"$1"),a=(f||y).replace(L,"$1");if(s!==a){var v=h+";codecs="+(f||y);u.appendChangeType(g,v)}}}else u.pendingTracks[g]=d[g]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},T.appendChangeType=function(o,d){var u=this,x=this.operationQueue,g={execute:function(){var l=u.sourceBuffer[o];l&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+d),l.changeType(d)),x.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(l){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",l)}};x.append(g,o)},T.onBufferAppending=function(o,d){var u=this,x=this.hls,g=this.operationQueue,m=this.tracks,l=d.data,y=d.type,f=d.frag,h=d.part,s=d.chunkMeta,a=s.buffering[y],v=self.performance.now();a.start=v;var p=f.stats.buffering,E=h?h.stats.buffering:null;p.start===0&&(p.start=v),E&&E.start===0&&(E.start=v);var D=m.audio,N=y==="audio"&&s.id===1&&(D==null?void 0:D.container)==="audio/mpeg",W={execute:function(){if(a.executeStart=self.performance.now(),N){var B=u.sourceBuffer[y];if(B){var U=f.start-B.timestampOffset;Math.abs(U)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+U+") sn: "+f.sn+")"),B.timestampOffset=f.start)}}u.appendExecutor(l,y)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,p.first===0&&(p.first=B),E&&E.first===0&&(E.first=B);var U=u.sourceBuffer,X={};for(var ne in U)X[ne]=I.BufferHelper.getBuffered(U[ne]);u.appendError=0,u.hls.trigger(M.Events.BUFFER_APPENDED,{type:y,frag:f,part:h,chunkMeta:s,parent:f.type,timeRanges:X})},onError:function(B){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",B);var U={type:F.ErrorTypes.MEDIA_ERROR,parent:f.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?U.details=F.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,U.details=F.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>x.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),U.fatal=!0)),x.trigger(M.Events.ERROR,U)}};g.append(W,y)},T.onBufferFlushing=function(o,d){var u=this,x=this.operationQueue,g=function(l){return{execute:u.removeExecutor.bind(u,l,d.startOffset,d.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(M.Events.BUFFER_FLUSHED,{type:l})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+l+" SourceBuffer",f)}}};d.type?x.append(g(d.type),d.type):this.getSourceBufferTypes().forEach(function(m){x.append(g(m),m)})},T.onFragParsed=function(o,d){var u=this,x=d.frag,g=d.part,m=[],l=g?g.elementaryStreams:x.elementaryStreams;l[O.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(l[O.ElementaryStreamTypes.AUDIO]&&m.push("audio"),l[O.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var h=self.performance.now();x.stats.buffering.end=h,g&&(g.stats.buffering.end=h);var s=g?g.stats:x.stats;u.hls.trigger(M.Events.FRAG_BUFFERED,{frag:x,part:g,stats:s,id:x.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(y,m)},T.onFragChanged=function(o,d){this.flushBackBuffer()},T.onBufferEos=function(o,d){var u=this,x=this.getSourceBufferTypes().reduce(function(g,m){var l=u.sourceBuffer[m];return(!d.type||d.type===m)&&(l&&!l.ended&&(l.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!l||l.ended)},!0);x&&this.blockBuffers(function(){var g=u.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},T.onLevelUpdated=function(o,d){var u=d.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},T.flushBackBuffer=function(){var o=this.hls,d=this.details,u=this.media,x=this.sourceBuffer;if(!u||d===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var m=d.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(H.isFiniteNumber)(m)||m<0)return;var l=u.currentTime,y=d.levelTargetDuration,f=Math.max(m,y),h=Math.floor(l/y)*y-f;g.forEach(function(s){var a=x[s];if(a){var v=I.BufferHelper.getBuffered(a);v.length>0&&h>v.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),d.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:s}))}})},T.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,d=this.hls,u=this.media,x=this.mediaSource,g=o.fragments[0].start+o.totalduration,m=u.duration,l=Object(H.isFiniteNumber)(x.duration)?x.duration:0;o.live&&d.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(o)):(g>l&&g>m||!Object(H.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),x.duration=g)},T.updateSeekableRange=function(o){var d=this.mediaSource,u=o.fragments,x=u.length;if(x&&o.live&&d!==null&&d!==void 0&&d.setLiveSeekableRange){var g=Math.max(0,u[0].start),m=Math.max(g,g+o.totalduration);d.setLiveSeekableRange(g,m)}},T.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,d=this.operationQueue,u=this.pendingTracks,x=Object.keys(u).length;if(x&&!o||x===2){this.createSourceBuffers(u),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(m){d.executeNext(m)})}},T.createSourceBuffers=function(o){var d=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var g in o)if(!d[g]){var m=o[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var l=m.levelCodec||m.codec,y=m.container+";codecs="+l;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var f=d[g]=u.addSourceBuffer(y),h=g;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[g]={buffer:f,codec:l,container:m.container,levelCodec:m.levelCodec,id:m.id},x++}catch(s){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:y})}}x&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},T._onSBUpdateStart=function(o){var d=this.operationQueue,u=d.current(o);u.onStart()},T._onSBUpdateEnd=function(o){var d=this.operationQueue,u=d.current(o);u.onComplete(),d.shiftAndExecuteNext(o)},T._onSBUpdateError=function(o,d){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",d),this.hls.trigger(M.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(d)},T.removeExecutor=function(o,d,u){var x=this.media,g=this.mediaSource,m=this.operationQueue,l=this.sourceBuffer,y=l[o];if(!x||!g||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var f=Object(H.isFiniteNumber)(x.duration)?x.duration:Infinity,h=Object(H.isFiniteNumber)(g.duration)?g.duration:Infinity,s=Math.max(0,d),a=Math.min(u,f,h);a>s?(P.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(s,a)):m.shiftAndExecuteNext(o)},T.appendExecutor=function(o,d){var u=this.operationQueue,x=this.sourceBuffer,g=x[d];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+d+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(d);return}g.ended=!1,console.assert(!g.updating,d+" sourceBuffer must not be updating"),g.appendBuffer(o)},T.blockBuffers=function(o,d){var u=this;if(d===void 0&&(d=this.getSourceBufferTypes()),!d.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var x=this.operationQueue,g=d.map(function(m){return x.appendBlocker(m)});Promise.all(g).then(function(){o(),d.forEach(function(m){var l=u.sourceBuffer[m];(!l||!l.updating)&&x.shiftAndExecuteNext(m)})})},T.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},T.addBufferListener=function(o,d,u){var x=this.sourceBuffer[o];if(!x)return;var g=u.bind(this,o);this.listeners[o].push({event:d,listener:g}),x.addEventListener(d,g)},T.removeBufferListeners=function(o){var d=this.sourceBuffer[o];if(!d)return;this.listeners[o].forEach(function(u){d.removeEventListener(u.event,u.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return M});var H=A("./src/utils/logger.ts"),M=function(){function P(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var F=P.prototype;return F.append=function(R,O){var b=this.queues[O];b.push(R),b.length===1&&this.buffers[O]&&this.executeNext(O)},F.insertAbort=function(R,O){var b=this.queues[O];b.unshift(R),this.executeNext(O)},F.appendBlocker=function(R){var O,b=new Promise(function(L){O=L}),C={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(C,R),b},F.executeNext=function(R){var O=this.buffers,b=this.queues,C=O[R],L=b[R];if(L.length){var S=L[0];try{S.execute()}catch(w){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),S.onError(w),(!C||!C.updating)&&(L.shift(),this.executeNext(R))}}},F.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},F.current=function(R){return this.queues[R][0]},P}()},"./src/controller/cap-level-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts");function M(I,R){for(var O=0;O<R.length;O++){var b=R[O];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(I,b.key,b)}}function P(I,R,O){return R&&M(I.prototype,R),O&&M(I,O),I}var F=function(){function I(O){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=O,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(b){this.streamController=b},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 b=this.hls;b.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var b=this.hls;b.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(b,C){I.isLevelAllowed(C.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(C.droppedLevel)},R.onMediaAttaching=function(b,C){this.media=C.media instanceof HTMLVideoElement?C.media:null},R.onManifestParsed=function(b,C){var L=this.hls;this.restrictedLevels=[],this.firstLevel=C.firstLevel,L.config.capLevelToPlayerSize&&C.video&&this.startCapping()},R.onBufferCodecs=function(b,C){var L=this.hls;L.config.capLevelToPlayerSize&&C.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var C=this.hls;C.autoLevelCapping=this.getMaxLevel(b.length-1),C.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=C.autoLevelCapping}}},R.getMaxLevel=function(b){var C=this,L=this.hls.levels;if(!L.length)return-1;var S=L.filter(function(w,T){return I.isLevelAllowed(T,C.restrictedLevels)&&T<=b});return this.clientRect=null,I.getMaxLevelByMediaSize(S,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 b=this.media,C={width:0,height:0};if(b){var L=b.getBoundingClientRect();C.width=L.width,C.height=L.height,!C.width&&!C.height&&(C.width=L.right-L.left||b.width||0,C.height=L.bottom-L.top||b.height||0)}return this.clientRect=C,C},I.isLevelAllowed=function(b,C){return C===void 0&&(C=[]),C.indexOf(b)===-1},I.getMaxLevelByMediaSize=function(b,C,L){if(!b||!b.length)return-1;for(var S=function(d,u){return u?d.width!==u.width||d.height!==u.height:!0},w=b.length-1,T=0;T<b.length;T+=1){var c=b[T];if((c.width>=C||c.height>=L)&&S(c,b[T+1])){w=T;break}}return w},P(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 b=1;try{b=self.devicePixelRatio}catch(C){}return b}}]),I}();G.default=F},"./src/controller/cmcd-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return S});var H=A("./src/events.ts"),M=A("./src/types/cmcd.ts"),P=A("./src/utils/buffer-helper.ts"),F=A("./src/utils/logger.ts");function I(w,T){for(var c=0;c<T.length;c++){var o=T[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function R(w,T,c){return T&&I(w.prototype,T),c&&I(w,c),w}function O(w,T){var c=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(c)return(c=c.call(w)).next.bind(c);if(Array.isArray(w)||(c=b(w))||T&&w&&typeof w.length=="number"){c&&(w=c);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(w,T){if(!w)return;if(typeof w=="string")return C(w,T);var c=Object.prototype.toString.call(w).slice(8,-1);if(c==="Object"&&w.constructor&&(c=w.constructor.name),c==="Map"||c==="Set")return Array.from(w);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return C(w,T)}function C(w,T){(T==null||T>w.length)&&(T=w.length);for(var c=0,o=new Array(T);c<T;c++)o[c]=w[c];return o}function L(){return L=Object.assign||function(w){for(var T=1;T<arguments.length;T++){var c=arguments[T];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(w[o]=c[o])}return w},L.apply(this,arguments)}var S=function(){function w(c){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(x){try{o.apply(x,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(g){F.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(x){try{var g=x.frag,m=o.hls.levels[g.level],l=o.getObjectType(g),y={d:g.duration*1e3,ot:l};(l===M.CMCDObjectType.VIDEO||l===M.CMCDObjectType.AUDIO||l==M.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=o.getTopBandwidth(l),y.bl=o.getBufferLength(l)),o.apply(x,y)}catch(f){F.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=c;var d=this.config=c.config,u=d.cmcd;u!=null&&(d.pLoader=this.createPlaylistLoader(),d.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||w.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var T=w.prototype;return T.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},T.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},T.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},T.onMediaAttached=function(o,d){this.media=d.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},T.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},T.onBufferCreated=function(o,d){var u,x;this.audioBuffer=(u=d.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(x=d.tracks.video)===null||x===void 0?void 0:x.buffer},T.createData=function(){var o;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},T.apply=function(o,d){d===void 0&&(d={}),L(d,this.createData());var u=d.ot===M.CMCDObjectType.INIT||d.ot===M.CMCDObjectType.VIDEO||d.ot===M.CMCDObjectType.MUXED;if(this.starved&&u&&(d.bs=!0,d.su=!0,this.starved=!1),d.su==null&&(d.su=this.buffering),this.useHeaders){var x=w.toHeaders(d);if(!Object.keys(x).length)return;o.headers||(o.headers={}),L(o.headers,x)}else{var g=w.toQuery(d);if(!g)return;o.url=w.appendQueryToUri(o.url,g)}},T.getObjectType=function(o){var d=o.type;return d==="subtitle"?M.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?M.CMCDObjectType.INIT:d==="audio"?M.CMCDObjectType.AUDIO:d==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},T.getTopBandwidth=function(o){for(var d=0,u=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=O(u),g;!(g=x()).done;){var m=g.value;m.bitrate>d&&(d=m.bitrate)}return d>0?d:NaN},T.getBufferLength=function(o){var d=this.hls.media,u=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!d)return NaN;var x=P.BufferHelper.bufferInfo(u,d.currentTime,this.config.maxBufferHole);return x.len*1e3},T.createPlaylistLoader=function(){var o=this.config.pLoader,d=this.applyPlaylistData,u=o||this.config.loader;return function(){function x(m){this.loader=void 0,this.loader=new u(m)}var g=x.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(l,y,f){d(l),this.loader.load(l,y,f)},R(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},T.createFragmentLoader=function(){var o=this.config.fLoader,d=this.applyFragmentData,u=o||this.config.loader;return function(){function x(m){this.loader=void 0,this.loader=new u(m)}var g=x.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(l,y,f){d(l),this.loader.load(l,y,f)},R(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),d=o.toString();return URL.revokeObjectURL(o),d.substr(d.lastIndexOf("/")+1)},w.serialize=function(o){for(var d=[],u=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},x=function(N){return Math.round(N)},g=function(N){return x(N/100)*100},m=function(N){return encodeURIComponent(N)},l={br:x,d:x,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:x},y=Object.keys(o||{}).sort(),f=O(y),h;!(h=f()).done;){var s=h.value,a=o[s];if(!u(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var v=l[s];v&&(a=v(a));var p=typeof a,E=void 0;s==="ot"||s==="sf"||s==="st"?E=s+"="+a:p==="boolean"?E=s:p==="number"?E=s+"="+a:E=s+"="+JSON.stringify(a),d.push(E)}return d.join(",")},w.toHeaders=function(o){for(var d=Object.keys(o),u={},x=["Object","Request","Session","Status"],g=[{},{},{},{}],m={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},l=0,y=d;l<y.length;l++){var f=y[l],h=m[f]!=null?m[f]:1;g[h][f]=o[f]}for(var s=0;s<g.length;s++){var a=w.serialize(g[s]);a&&(u["CMCD-"+x[s]]=a)}return u},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,d){if(!d)return o;var u=o.includes("?")?"&":"?";return""+o+u+d},w}()},"./src/controller/eme-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),F=A("./src/utils/mediakeys-helper.ts");function I(S,w){for(var T=0;T<w.length;T++){var c=w[T];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(S,c.key,c)}}function R(S,w,T){return w&&I(S.prototype,w),T&&I(S,T),S}var O=3,b=function(w,T,c){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(d){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+d+'"',robustness:c.audioRobustness||""})}),T.forEach(function(d){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+d+'"',robustness:c.videoRobustness||""})}),[o]},C=function(w,T,c,o){switch(w){case F.KeySystems.WIDEVINE:return b(T,c,o);default:throw new Error("Unknown key-system: "+w)}},L=function(){function S(T){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=T,this._config=T.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var w=S.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(c){switch(c){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+c+'"')},w._attemptKeySystemAccess=function(c,o,d){var u=this,x=C(c,o,d,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(c,x);this.mediaKeysPromise=g.then(function(m){return u._onMediaKeySystemAccessObtained(c,m)}),g.catch(function(m){P.logger.error('Failed to obtain key-system "'+c+'" access:',m)})},w._onMediaKeySystemAccessObtained=function(c,o){var d=this;P.logger.log('Access for key-system "'+c+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:c};this._mediaKeysList.push(u);var x=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(g){return u.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+c+'"'),d._onMediaKeysCreated(),g});return x.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),x},w._onMediaKeysCreated=function(){var c=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),c._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(c){var o=this;P.logger.log("New key-system session "+c.sessionId),c.addEventListener("message",function(d){o._onKeySessionMessage(c,d.message)},!1)},w._onKeySessionMessage=function(c,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(d){P.logger.log("Received license data (length: "+(d&&d.byteLength)+"), updating key-session"),c.update(d)})},w.onMediaEncrypted=function(c){var o=this;if(P.logger.log('Media is encrypted using "'+c.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var d=function(x){if(!o._media)return;o._attemptSetMediaKeys(x),o._generateRequestWithPreferredKeySession(c.initDataType,c.initData)};this.mediaKeysPromise.then(d).catch(d)},w._attemptSetMediaKeys=function(c){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(c,o){var d=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var x=u.mediaKeysSession;if(!x){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+c+'" init data type'),u.mediaKeysSessionInitialized=!0,x.generateRequest(c,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),d.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(c,o,d){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,c,o,d);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,u,c),x=void 0}catch(g){P.logger.error(g)}try{u.readyState||u.open("POST",c,!0),x&&x.call(this.hls,u,c)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return u},w._onLicenseRequestReadyStageChange=function(c,o,d,u){switch(c.readyState){case 4:if(c.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var x=c.response,g=this._licenseResponseCallback;if(g)try{x=g.call(this.hls,c,o)}catch(l){P.logger.error(l)}u(x)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+c.status+" ("+c.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=O-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(d,u)}break}},w._generateLicenseRequestChallenge=function(c,o){switch(c.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+c.mediaKeySystemDomain)},w._requestLicense=function(c,o){P.logger.log("Requesting content license for key-system");var d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(d.mediaKeySystemDomain),x=this._createLicenseXhr(u,c,o);P.logger.log("Sending license request to URL: "+u);var g=this._generateLicenseRequestChallenge(d,c);x.send(g)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(c,o){if(!this._emeEnabled)return;var d=o.media;this._media=d,d.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var c=this._media,o=this._mediaKeysList;if(!c)return;c.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(d){if(d.mediaKeysSession)return d.mediaKeysSession.close().catch(function(){})})).then(function(){return c.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(c,o){if(!this._emeEnabled)return;var d=o.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),u=o.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,d,u)},R(S,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),S}();G.default=L},"./src/controller/fps-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=function(){function F(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=F.prototype;return I.setStreamController=function(O){this.streamController=O},I.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(O,b){var C=this.hls.config;if(C.capLevelOnFPSDrop){var L=b.media instanceof self.HTMLVideoElement?b.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),C.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(O,b,C){var L=performance.now();if(b){if(this.lastTime){var S=L-this.lastTime,w=C-this.lastDroppedFrames,T=b-this.lastDecodedFrames,c=1e3*w/S,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:w,currentDecoded:T,totalDroppedFrames:C}),c>0&&w>o.config.fpsDroppedMonitoringThreshold*T){var d=o.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=d)&&(d=d-1,o.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:o.currentLevel}),o.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=L,this.lastDroppedFrames=C,this.lastDecodedFrames=b}},I.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var b=O.getVideoPlaybackQuality();this.checkFPS(O,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},F}();G.default=P},"./src/controller/fragment-finders.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"findFragmentByPDT",function(){return P}),A.d(G,"findFragmentByPTS",function(){return F}),A.d(G,"fragmentWithinToleranceTest",function(){return I}),A.d(G,"pdtWithinToleranceTest",function(){return R}),A.d(G,"findFragWithCC",function(){return O});var H=A("./src/polyfills/number.ts"),M=A("./src/utils/binary-search.ts");function P(b,C,L){if(C===null||!Array.isArray(b)||!b.length||!Object(H.isFiniteNumber)(C))return null;var S=b[0].programDateTime;if(C<(S||0))return null;var w=b[b.length-1].endProgramDateTime;if(C>=(w||0))return null;L=L||0;for(var T=0;T<b.length;++T){var c=b[T];if(R(C,L,c))return c}return null}function F(b,C,L,S){L===void 0&&(L=0),S===void 0&&(S=0);var w=null;if(b?w=C[b.sn-C[0].sn+1]||null:L===0&&C[0].start===0&&(w=C[0]),w&&I(L,S,w)===0)return w;var T=M.default.search(C,I.bind(null,L,S));return T||w}function I(b,C,L){b===void 0&&(b=0),C===void 0&&(C=0);var S=Math.min(C,L.duration+(L.deltaPTS?L.deltaPTS:0));return L.start+L.duration-S<=b?1:L.start-S>b&&L.start?-1:0}function R(b,C,L){var S=Math.min(C,L.duration+(L.deltaPTS?L.deltaPTS:0))*1e3,w=L.endProgramDateTime||0;return w-S>b}function O(b,C){return M.default.search(b,function(L){return L.cc<C?1:L.cc>C?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"FragmentState",function(){return P}),A.d(G,"FragmentTracker",function(){return F});var H=A("./src/events.ts"),M=A("./src/types/loader.ts"),P;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(P||(P={}));var F=function(){function O(C){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=C,this._registerListeners()}var b=O.prototype;return b._registerListeners=function(){var L=this.hls;L.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),L.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),L.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var L=this.hls;L.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),L.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),L.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(L,S){if(S===M.PlaylistLevelType.MAIN){var w=this.activeFragment,T=this.activeParts;if(!w)return null;if(T)for(var c=T.length;c--;){var o=T[c],d=o?o.end:w.appendedPTS;if(o.start<=L&&d!==void 0&&L<=d)return c>9&&(this.activeParts=T.slice(c-9)),o}else if(w.start<=L&&w.appendedPTS!==void 0&&L<=w.appendedPTS)return w}return this.getBufferedFrag(L,S)},b.getBufferedFrag=function(L,S){for(var w=this.fragments,T=Object.keys(w),c=T.length;c--;){var o=w[T[c]];if((o==null?void 0:o.body.type)===S&&o.buffered){var d=o.body;if(d.start<=L&&L<=d.end)return d}}return null},b.detectEvictedFragments=function(L,S,w){var T=this;Object.keys(this.fragments).forEach(function(c){var o=T.fragments[c];if(!o)return;if(!o.buffered){o.body.type===w&&T.removeFragment(o.body);return}var d=o.range[L];if(!d)return;d.time.some(function(u){var x=!T.isTimeBuffered(u.startPTS,u.endPTS,S);return x&&T.removeFragment(o.body),x})})},b.detectPartialFragments=function(L){var S=this,w=this.timeRanges,T=L.frag,c=L.part;if(!w||T.sn==="initSegment")return;var o=R(T),d=this.fragments[o];if(!d)return;Object.keys(w).forEach(function(u){var x=T.elementaryStreams[u];if(!x)return;var g=w[u],m=c!==null||x.partial===!0;d.range[u]=S.getBufferedTimes(T,c,m,g)}),d.backtrack=d.loaded=null,Object.keys(d.range).length?d.buffered=!0:this.removeFragment(d.body)},b.fragBuffered=function(L){var S=R(L),w=this.fragments[S];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},b.getBufferedTimes=function(L,S,w,T){for(var c={time:[],partial:w},o=S?S.start:L.start,d=S?S.end:L.end,u=L.minEndPTS||d,x=L.maxStartPTS||o,g=0;g<T.length;g++){var m=T.start(g)-this.bufferPadding,l=T.end(g)+this.bufferPadding;if(x>=m&&u<=l){c.time.push({startPTS:Math.max(o,T.start(g)),endPTS:Math.min(d,T.end(g))});break}else if(o<l&&d>m)c.partial=!0,c.time.push({startPTS:Math.max(o,T.start(g)),endPTS:Math.min(d,T.end(g))});else if(d<=m)break}return c},b.getPartialFragment=function(L){var S=null,w,T,c,o=0,d=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(x){var g=u[x];if(!g)return;I(g)&&(T=g.body.start-d,c=g.body.end+d,L>=T&&L<=c&&(w=Math.min(L-T,c-L),o<=w&&(S=g.body,o=w)))}),S},b.getState=function(L){var S=R(L),w=this.fragments[S];return w?w.buffered?I(w)?P.PARTIAL:P.OK:w.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},b.backtrack=function(L,S){var w=R(L),T=this.fragments[w];if(!T||T.backtrack)return null;var c=T.backtrack=S||T.loaded;return T.loaded=null,c},b.getBacktrackData=function(L){var S=R(L),w=this.fragments[S];if(w){var T,c=w.backtrack;if(c!=null&&(T=c.payload)!==null&&T!==void 0&&T.byteLength)return c;this.removeFragment(L)}return null},b.isTimeBuffered=function(L,S,w){for(var T,c,o=0;o<w.length;o++){if(T=w.start(o)-this.bufferPadding,c=w.end(o)+this.bufferPadding,L>=T&&S<=c)return!0;if(S<=T)return!1}return!1},b.onFragLoaded=function(L,S){var w=S.frag,T=S.part;if(w.sn==="initSegment"||w.bitrateTest||T)return;var c=R(w);this.fragments[c]={body:w,loaded:S,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(L,S){var w=this,T=S.frag,c=S.part,o=S.timeRanges;if(T.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=T,c){var d=this.activeParts;d||(this.activeParts=d=[]),d.push(c)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var x=o[u];if(w.detectEvictedFragments(u,x),!c)for(var g=0;g<x.length;g++)T.appendedPTS=Math.max(x.end(g),T.appendedPTS||0)})},b.onFragBuffered=function(L,S){this.detectPartialFragments(S)},b.hasFragment=function(L){var S=R(L);return!!this.fragments[S]},b.removeFragmentsInRange=function(L,S,w){var T=this;Object.keys(this.fragments).forEach(function(c){var o=T.fragments[c];if(!o)return;if(o.buffered){var d=o.body;d.type===w&&d.start<S&&d.end>L&&T.removeFragment(d)}})},b.removeFragment=function(L){var S=R(L);L.stats.loaded=0,L.clearElementaryStreamInfo(),delete this.fragments[S]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function I(O){var b,C;return O.buffered&&(((b=O.range.video)===null||b===void 0?void 0:b.partial)||((C=O.range.audio)===null||C===void 0?void 0:C.partial))}function R(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"STALL_MINIMUM_DURATION_MS",function(){return I}),A.d(G,"MAX_START_GAP_JUMP",function(){return R}),A.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),A.d(G,"SKIP_BUFFER_RANGE_START",function(){return b}),A.d(G,"default",function(){return C});var H=A("./src/utils/buffer-helper.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts"),F=A("./src/utils/logger.ts"),I=250,R=2,O=.1,b=.05,C=function(){function L(w,T,c,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=T,this.fragmentTracker=c,this.hls=o}var S=L.prototype;return S.destroy=function(){this.hls=this.fragmentTracker=this.media=null},S.poll=function(T){var c=this.config,o=this.media,d=this.stalled,u=o.currentTime,x=o.seeking,g=this.seeking&&!x,m=!this.seeking&&x;if(this.seeking=x,u!==T){if(this.moved=!0,d!==null){if(this.stallReported){var l=self.performance.now()-d;F.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(l)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var y=H.BufferHelper.bufferInfo(o,u,0),f=y.len>0,h=y.nextStart||0;if(!f&&!h)return;if(x){var s=y.len>R,a=!h||h-u>R&&!this.fragmentTracker.getPartialFragment(u);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,p=Math.max(h,y.start||0)-u,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=E==null||((v=E.details)===null||v===void 0)?void 0:v.live,N=D?E.details.targetduration*2:R;if(p>0&&p<=N){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(d===null){this.stalled=W;return}var z=W-d;!x&&z>=I&&this._reportStall(y.len);var B=H.BufferHelper.bufferInfo(o,u,c.maxBufferHole);this._tryFixBufferStall(B,z)},S._tryFixBufferStall=function(T,c){var o=this.config,d=this.fragmentTracker,u=this.media,x=u.currentTime,g=d.getPartialFragment(x);if(g){var m=this._trySkipBufferHole(g);if(m)return}T.len>o.maxBufferHole&&c>o.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},S._reportStall=function(T){var c=this.hls,o=this.media,d=this.stallReported;d||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+T+")"),c.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:T}))},S._trySkipBufferHole=function(T){for(var c=this.config,o=this.hls,d=this.media,u=d.currentTime,x=0,g=H.BufferHelper.getBuffered(d),m=0;m<g.length;m++){var l=g.start(m);if(u+c.maxBufferHole>=x&&u<l){var y=Math.max(l+b,d.currentTime+O);return F.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+y),this.moved=!0,this.stalled=null,d.currentTime=y,T&&o.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+y,frag:T}),y}x=g.end(m)}return 0},S._tryNudgeBuffer=function(){var T=this.config,c=this.hls,o=this.media,d=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<T.nudgeMaxRetry){var x=d+u*T.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+d+" to "+x),o.currentTime=x,c.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+d+" after "+T.nudgeMaxRetry+" nudges"),c.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},L}()},"./src/controller/id3-track-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/demux/id3.ts"),F=.25,I=function(){function R(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var O=R.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var C=this.hls;C.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var C=this.hls;C.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),C.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(C,L){this.media=L.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(C){if(!this.media)return;for(var L=0;L<C.length;L++){var S=C[L];if(S.kind==="metadata"&&S.label==="id3")return Object(M.sendAddTrackEvent)(S,this.media),S}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(C,L){if(!this.media)return;var S=L.frag,w=L.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var T=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,c=0;c<w.length;c++){var o=P.getID3Frames(w[c].data);if(o){var d=w[c].pts,u=c<w.length-1?w[c+1].pts:S.end,x=u-d;x<=0&&(u=d+F);for(var g=0;g<o.length;g++){var m=o[g];if(!P.isTimeStampFrame(m)){var l=new T(d,u,"");l.value=m,this.id3Track.addCue(l)}}}}},O.onBufferFlushing=function(C,L){var S=L.startOffset,w=L.endOffset,T=L.type;if(!T||T==="audio"){var c=this.id3Track;c&&Object(M.removeCuesInRange)(c,S,w)}},R}();G.default=I},"./src/controller/latency-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return R});var H=A("./src/errors.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts");function F(O,b){for(var C=0;C<b.length;C++){var L=b[C];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(O,L.key,L)}}function I(O,b,C){return b&&F(O.prototype,b),C&&F(O,C),O}var R=function(){function O(C){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=C,this.config=C.config,this.registerListeners()}var b=O.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(M.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(M.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(M.Events.ERROR,this.onError)},b.onMediaAttached=function(L,S){this.media=S.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(L,S){var w=S.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(L,S){if(S.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var L=this.media,S=this.levelDetails;if(!L||!S)return;this.currentTime=L.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var T=this.config,c=T.lowLatencyMode,o=T.maxLiveSyncPlaybackRate;if(!c||o===1)return;var d=this.targetLatency;if(d===null)return;var u=w-d,x=Math.min(this.maxLatency,d+S.targetduration),g=u<x;if(S.live&&g&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),l=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;L.playbackRate=Math.min(m,Math.max(1,l))}else L.playbackRate!==1&&L.playbackRate!==0&&(L.playbackRate=1)},b.estimateLiveEdge=function(){var L=this.levelDetails;return L===null?null:L.edge+L.age},b.computeLatency=function(){var L=this.estimateLiveEdge();return L===null?null:L-this.currentTime},I(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var L=this.config,S=this.levelDetails;return L.liveMaxLatencyDuration!==void 0?L.liveMaxLatencyDuration:S?L.liveMaxLatencyDurationCount*S.targetduration:0}},{key:"targetLatency",get:function(){var L=this.levelDetails;if(L===null)return null;var S=L.holdBack,w=L.partHoldBack,T=L.targetduration,c=this.config,o=c.liveSyncDuration,d=c.liveSyncDurationCount,u=c.lowLatencyMode,x=this.hls.userConfig,g=u&&w||S;(x.liveSyncDuration||x.liveSyncDurationCount||g===0)&&(g=o!==void 0?o:d*T);var m=T,l=1;return g+Math.min(this.stallCount*l,m)}},{key:"liveSyncPosition",get:function(){var L=this.estimateLiveEdge(),S=this.targetLatency,w=this.levelDetails;if(L===null||S===null||w===null)return null;var T=w.edge,c=L-S-this.edgeStalled,o=T-w.totalduration,d=T-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,c),d)}},{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 S=(this.config.lowLatencyMode&&L.partTarget||L.targetduration)*3;return Math.max(L.age-S,0)}},{key:"forwardBufferLength",get:function(){var L=this.media,S=this.levelDetails;if(!L||!S)return 0;var w=L.buffered.length;return w?L.buffered.end(w-1):S.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return c});var H=A("./src/types/level.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),F=A("./src/utils/codecs.ts"),I=A("./src/controller/level-helper.ts"),R=A("./src/controller/base-playlist-controller.ts"),O=A("./src/types/loader.ts");function b(){return b=Object.assign||function(o){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var x in u)Object.prototype.hasOwnProperty.call(u,x)&&(o[x]=u[x])}return o},b.apply(this,arguments)}function C(o,d){for(var u=0;u<d.length;u++){var x=d[u];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function L(o,d,u){return d&&C(o.prototype,d),u&&C(o,u),o}function S(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,w(o,d)}function w(o,d){return w=Object.setPrototypeOf||function(x,g){return x.__proto__=g,x},w(o,d)}var T=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),c=function(o){S(d,o);function d(x){var g;return g=o.call(this,x,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var u=d.prototype;return u._registerListeners=function(){var g=this.hls;g.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(M.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var g=this.hls;g.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var g=this._levels;g.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(g,m){var l=[],y=[],f=[],h,s={},a,v=!1,p=!1,E=!1;if(m.levels.forEach(function(z){var B=z.attrs;v=v||!!(z.width&&z.height),p=p||!!z.videoCodec,E=E||!!z.audioCodec,T&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var U=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;a=s[U],a?a.url.push(z.url):(a=new H.Level(z),s[U]=a,l.push(a)),B&&(B.AUDIO&&Object(I.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(I.addGroupId)(a,"text",B.SUBTITLES))}),(v||p)&&E&&(l=l.filter(function(z){var B=z.videoCodec,U=z.width,X=z.height;return!!B||!!(U&&X)})),l=l.filter(function(z){var B=z.audioCodec,U=z.videoCodec;return(!B||Object(F.isCodecSupportedInMp4)(B,"audio"))&&(!U||Object(F.isCodecSupportedInMp4)(U,"video"))}),m.audioTracks&&(y=m.audioTracks.filter(function(z){return!z.audioCodec||Object(F.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(y)),m.subtitles&&(f=m.subtitles,Object(I.assignTrackIdsByGroup)(f)),l.length>0){h=l[0].bitrate,l.sort(function(z,B){return z.bitrate-B.bitrate}),this._levels=l;for(var D=0;D<l.length;D++)if(l[D].bitrate===h){this._firstLevel=D,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+h);break}var N=E&&!p,W={levels:l,audioTracks:y,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:E,video:p,altAudio:!N&&y.some(function(z){return!!z.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(g,m){if(o.prototype.onError.call(this,g,m),m.fatal)return;var l=m.context,y=this._levels[this.currentLevelIndex];if(l&&(l.type===O.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&l.groupId===y.audioGroupIds[y.urlId]||l.type===O.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&l.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,s;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:l&&(l.deliveryDirectives&&(h=!1),s=l.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,f=!0;break}s!==void 0&&this.recoverLevel(m,s,f,h)},u.recoverLevel=function(g,m,l,y){var f=g.details,h=this._levels[m];if(h.loadError++,l){var s=this.retryLoadingOrFail(g);if(s)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=h.url.length;if(a>1&&h.loadError<a)g.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(f+": switch to "+v),g.levelRetry=!0,this.hls.nextAutoLevel=v)}}},u.redundantFailover=function(g){var m=this._levels[g],l=m.url.length;if(l>1){var y=(m.urlId+1)%l;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(f){f.urlId=y}),this.level=g}},u.onFragLoaded=function(g,m){var l=m.frag;if(l!==void 0&&l.type===O.PlaylistLevelType.MAIN){var y=this._levels[l.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},u.onLevelLoaded=function(g,m){var l,y=m.level,f=m.details,h=this._levels[y];if(!h){var s;this.warn("Invalid level index "+y),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(f.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,h.details)):(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(g,m){var l=this.hls.levels[this.currentLevelIndex];if(!l)return;if(l.audioGroupIds){for(var y=-1,f=this.hls.audioTracks[m.id].groupId,h=0;h<l.audioGroupIds.length;h++)if(l.audioGroupIds[h]===f){y=h;break}y!==l.urlId&&(l.urlId=y,this.startLoad())}},u.loadPlaylist=function(g){var m=this.currentLevelIndex,l=this._levels[m];if(this.canLoad&&l&&l.url.length>0){var y=l.urlId,f=l.url[y];if(g)try{f=g.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+y+" "+f),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:f,level:m,id:y,deliveryDirectives:g||null})}},u.removeLevel=function(g,m){var l=function(h,s){return s!==m},y=this._levels.filter(function(f,h){return h!==g?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(l),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(l)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(l)),f.urlId=0,!0):!1}).map(function(f,h){var s=f.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=h}),f});this._levels=y,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:y})},L(d,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,l=this._levels;if(l.length===0)return;if(this.currentLevelIndex===g&&(m=l[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=l.length){var y=g<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:y,reason:"invalid level idx"}),y)return;g=Math.min(g,l.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=l[f],s=l[g];this.log("switching to level "+g+" from "+f),this.currentLevelIndex=g;var a=b({},s,{level:g,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var v=s.details;if(!v||v.live){var p=this.switchParams(s.uri,h==null?void 0:h.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),d}(R.default)},"./src/controller/level-helper.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"addGroupId",function(){return P}),A.d(G,"assignTrackIdsByGroup",function(){return F}),A.d(G,"updatePTS",function(){return I}),A.d(G,"updateFragPTSDTS",function(){return O}),A.d(G,"mergeDetails",function(){return b}),A.d(G,"mapPartIntersection",function(){return C}),A.d(G,"mapFragmentIntersection",function(){return L}),A.d(G,"adjustSliding",function(){return S}),A.d(G,"addSliding",function(){return w}),A.d(G,"computeReloadInterval",function(){return T}),A.d(G,"getFragmentWithSN",function(){return c}),A.d(G,"getPartWith",function(){return o});var H=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts");function P(d,u,x){switch(u){case"audio":d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds.push(x);break;case"text":d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds.push(x);break}}function F(d){var u={};d.forEach(function(x){var g=x.groupId||"";x.id=u[g]=u[g]||0,u[g]++})}function I(d,u,x){var g=d[u],m=d[x];R(g,m)}function R(d,u){var x=u.startPTS;if(Object(H.isFiniteNumber)(x)){var g=0,m;u.sn>d.sn?(g=x-d.start,m=d):(g=d.start-x,m=u),m.duration!==g&&(m.duration=g)}else if(u.sn>d.sn){var l=d.cc===u.cc;l&&d.minEndPTS?u.start=d.start+(d.minEndPTS-d.start):u.start=d.start+d.duration}else u.start=Math.max(d.start-u.duration,0)}function O(d,u,x,g,m,l){var y=g-x;y<=0&&(M.logger.warn("Fragment should have a positive duration",u),g=x+u.duration,l=m+u.duration);var f=x,h=g,s=u.startPTS,a=u.endPTS;if(Object(H.isFiniteNumber)(s)){var v=Math.abs(s-x);Object(H.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(v,u.deltaPTS):u.deltaPTS=v,f=Math.max(x,s),x=Math.min(x,s),m=Math.min(m,u.startDTS),h=Math.min(g,a),g=Math.max(g,a),l=Math.max(l,u.endDTS)}u.duration=g-x;var p=x-u.start;u.appendedPTS=g,u.start=u.startPTS=x,u.maxStartPTS=f,u.startDTS=m,u.endPTS=g,u.minEndPTS=h,u.endDTS=l;var E=u.sn;if(!d||E<d.startSN||E>d.endSN)return 0;var D,N=E-d.startSN,W=d.fragments;for(W[N]=u,D=N;D>0;D--)R(W[D],W[D-1]);for(D=N;D<W.length-1;D++)R(W[D],W[D+1]);return d.fragmentHint&&R(W[W.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,p}function b(d,u){for(var x=null,g=d.fragments,m=g.length-1;m>=0;m--){var l=g[m].initSegment;if(l){x=l;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var y=0,f;if(L(d,u,function(D,N){D.relurl&&(y=D.cc-N.cc),Object(H.isFiniteNumber)(D.startPTS)&&Object(H.isFiniteNumber)(D.endPTS)&&(N.start=N.startPTS=D.startPTS,N.startDTS=D.startDTS,N.appendedPTS=D.appendedPTS,N.maxStartPTS=D.maxStartPTS,N.endPTS=D.endPTS,N.endDTS=D.endDTS,N.minEndPTS=D.minEndPTS,N.duration=D.endPTS-D.startPTS,N.duration&&(f=N),u.PTSKnown=u.alignedSliding=!0),N.elementaryStreams=D.elementaryStreams,N.loader=D.loader,N.stats=D.stats,N.urlId=D.urlId,D.initSegment&&(N.initSegment=D.initSegment,x=D.initSegment)}),x){var h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;h.forEach(function(D){var N;(!D.initSegment||D.initSegment.relurl===((N=x)===null||N===void 0?void 0:N.relurl))&&(D.initSegment=x)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(D){return!D}),u.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=u.skippedSegments;s--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(y){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=y}u.skippedSegments&&(u.startCC=u.fragments[0].cc),C(d.partList,u.partList,function(D,N){N.elementaryStreams=D.elementaryStreams,N.stats=D.stats}),f?O(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):S(d,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=d.driftStartTime,u.driftStart=d.driftStart;var p=u.advancedDateTime;if(u.advanced&&p){var E=u.edge;u.driftStart||(u.driftStartTime=p,u.driftStart=E),u.driftEndTime=p,u.driftEnd=E}else u.driftEndTime=d.driftEndTime,u.driftEnd=d.driftEnd,u.advancedDateTime=d.advancedDateTime}function C(d,u,x){if(d&&u)for(var g=0,m=0,l=d.length;m<=l;m++){var y=d[m],f=u[m+g];y&&f&&y.index===f.index&&y.fragment.sn===f.fragment.sn?x(y,f):g--}}function L(d,u,x){for(var g=u.skippedSegments,m=Math.max(d.startSN,u.startSN)-u.startSN,l=(d.fragmentHint?1:0)+(g?u.endSN:Math.min(d.endSN,u.endSN))-u.startSN,y=u.startSN-d.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,s=m;s<=l;s++){var a=h[y+s],v=f[s];g&&!v&&s<g&&(v=u.fragments[s]=a),a&&v&&x(a,v)}}function S(d,u){var x=u.startSN+u.skippedSegments-d.startSN,g=d.fragments;if(x<0||x>=g.length)return;w(u,g[x].start)}function w(d,u){if(u){for(var x=d.fragments,g=d.skippedSegments;g<x.length;g++)x[g].start+=u;d.fragmentHint&&(d.fragmentHint.start+=u)}}function T(d,u){var x=1e3*d.levelTargetDuration,g=x/2,m=d.age,l=m>0&&m<x*3,y=u.loading.end-u.loading.start,f,h=d.availabilityDelay;if(d.updated===!1)if(l){var s=333*d.misses;f=Math.max(Math.min(g,y*2),s),d.availabilityDelay=(d.availabilityDelay||0)+f}else f=g;else l?(h=Math.min(h||x/2,m),d.availabilityDelay=h,f=h+x-m):f=x-y;return Math.round(f)}function c(d,u,x){if(!d||!d.details)return null;var g=d.details,m=g.fragments[u-g.startSN];return m||(m=g.fragmentHint,m&&m.sn===u?m:u<g.startSN&&x&&x.sn===u?x:null)}function o(d,u,x){if(!d||!d.details)return null;var g=d.details.partList;if(g)for(var m=g.length;m--;){var l=g[m];if(l.index===x&&l.fragment.sn===u)return l}return null}},"./src/controller/stream-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return g});var H=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/is-supported.ts"),F=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),R=A("./src/controller/fragment-tracker.ts"),O=A("./src/types/loader.ts"),b=A("./src/loader/fragment.ts"),C=A("./src/demux/transmuxer-interface.ts"),L=A("./src/types/transmuxer.ts"),S=A("./src/controller/gap-controller.ts"),w=A("./src/errors.ts"),T=A("./src/utils/logger.ts");function c(m,l){for(var y=0;y<l.length;y++){var f=l[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function o(m,l,y){return l&&c(m.prototype,l),y&&c(m,y),m}function d(m,l){m.prototype=Object.create(l.prototype),m.prototype.constructor=m,u(m,l)}function u(m,l){return u=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},u(m,l)}var x=100,g=function(m){d(l,m);function l(f,h){var s;return s=m.call(this,f,h,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var y=l.prototype;return y._registerListeners=function(){var h=this.hls;h.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(F.Events.ERROR,this.onError,this),h.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var h=this.hls;h.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(F.Events.ERROR,this.onError,this),h.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(h){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}s>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),h=s),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var h,s=this.levels,a=this.level,v=s==null||((h=s[a])===null||h===void 0)?void 0:h.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var p,E=self.performance.now(),D=this.retryDate;(!D||E>=D||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var h,s,a=this.hls,v=this.levelLastLoaded,p=this.levels,E=this.media,D=a.config,N=a.nextLoadLevel;if(v===null||!E&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[N])return;var W=p[N];this.level=a.nextLoadLevel=N;var z=W.details;if(!z||this.state===M.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==N){this.state=M.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,O.PlaylistLevelType.MAIN);if(B===null)return;var U=B.len,X=this.getMaxBufferLength(W.maxBitrate);if(U>=X)return;if(this._streamEnded(B,z)){var ne={};this.altAudio&&(ne.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,ne),this.state=M.State.ENDED;return}var le=B.end,de=this.getNextFragment(le,z);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var we=de.sn-z.startSN;we>1&&(de=z.fragments[we-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===R.FragmentState.OK&&this.nextLoadPosition>le){var ge=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ge,O.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,z)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((h=de.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((s=de.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(de,z):this.loadFragment(de,z,le)},y.loadFragment=function(h,s,a){var v,p=this.fragmentTracker.getState(h);if(this.fragCurrent=h,p===R.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(h);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else p=R.FragmentState.NOT_LOADED}p===R.FragmentState.NOT_LOADED||p===R.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,h,s,a)):p===R.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(h){var s=this.fragmentTracker.getAppendedFrag(h,O.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},y.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,O.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var h=this.levels,s=this.media;if(s!=null&&s.readyState){var a,v=this.getAppendedFrag(s.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!s.paused&&h){var p=this.hls.nextLoadLevel,E=h[p],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*D)+1:a=0}else a=0;var N=this.getBufferedFrag(s.currentTime+a);if(N){var W=this.followingBufferedFrag(N);if(W){this.abortCurrentFrag();var z=W.maxStartPTS?W.maxStartPTS:W.start,B=W.duration,U=Math.max(N.end,z+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(U,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(h,s){m.prototype.flushMainBuffer.call(this,h,s,this.altAudio?"video":null)},y.onMediaAttached=function(h,s){m.prototype.onMediaAttached.call(this,h,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new S.default(this.config,a,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var h=this.media,s=h?h.currentTime:null;Object(H.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(h,s){var a=!1,v=!1,p;s.levels.forEach(function(E){p=E.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},y.onLevelLoading=function(h,s){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var v=a[s.level];(!v.details||v.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(v.details))&&(this.state=M.State.WAITING_LEVEL)},y.onLevelLoaded=function(h,s){var a,v=this.levels,p=s.level,E=s.details,D=E.totalduration;if(!v){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+D);var N=this.fragCurrent;N&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==s.level&&N.loader&&(this.state=M.State.IDLE,N.loader.abort()));var W=v[p],z=0;if(E.live||(a=W.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;z=this.alignPlaylists(E,W.details)}if(W.details=E,this.levelLastLoaded=p,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:E,level:p}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=M.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,z),this.tick()},y._handleFragmentLoadProgress=function(h){var s,a=h.frag,v=h.part,p=h.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var D=E[a.level],N=D.details;if(!N){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var W=D.videoCodec,z=N.PTSKnown||!N.live,B=(s=a.initSegment)===null||s===void 0?void 0:s.data,U=this._getAudioCodec(D),X=this.transmuxer=this.transmuxer||new C.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ne=v?v.index:-1,le=ne!==-1,de=new L.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,ne,le),we=this.initPTS[a.cc];X.push(p,B,U,W,a,v,N.totalduration,z,de,we)},y.onAudioTrackSwitching=function(h,s){var a=this.altAudio,v=!!s.url,p=s.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;a&&D.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(h,s){var a=s.id,v=!!this.hls.audioTracks[a].url;if(v){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=v,this.tick()},y.onBufferCreated=function(h,s){var a=s.tracks,v,p,E=!1;for(var D in a){var N=a[D];if(N.id==="main"){if(p=D,v=N,D==="video"){var W=a[D];W&&(this.videoBuffer=W.buffer)}}else E=!0}E&&v?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(h,s){var a=s.frag,v=s.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var p=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},y.onError=function(h,s){switch(s.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,s);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=M.State.ERROR):!s.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var h=this.media,s=this.gapController;if(!h||!s||!h.readyState)return;var a=I.BufferHelper.getBuffered(h);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(h,s){var a=s.type;if(a!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,O.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(h,s){this.levels=s.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var h=this.media,s=h.currentTime,a=this.startPosition;if(a>=0&&s<a){if(h.seeking){T.logger.log("could not seek to "+a+", already seeking at "+s);return}var v=I.BufferHelper.getBuffered(h),p=v.length?v.start(0):0,E=p-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(T.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),h.currentTime=a}},y._getAudioCodec=function(h){var s=this.config.defaultAudioCodec||h.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},y._loadBitrateTestFrag=function(h){var s=this;this._doFragLoad(h).then(function(a){var v=s.hls;if(!a||v.nextLoadLevel||s.fragContextChanged(h))return;s.fragLoadError=0,s.state=M.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var p=h.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),v.trigger(F.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(h){var s,a="main",v=this.hls,p=h.remuxResult,E=h.chunkMeta,D=this.getCurrentContext(E);if(!D){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var N=D.frag,W=D.part,z=D.level,B=p.video,U=p.text,X=p.id3,ne=p.initSegment,le=this.altAudio?void 0:p.audio;if(this.fragContextChanged(N))return;if(this.state=M.State.PARSING,ne){ne.tracks&&(this._bufferInitSegment(z,ne.tracks,N,E),v.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:ne.tracks}));var de=ne.initPTS,we=ne.timescale;Object(H.isFiniteNumber)(de)&&(this.initPTS[N.cc]=de,v.trigger(F.Events.INIT_PTS_FOUND,{frag:N,id:a,initPTS:de,timescale:we}))}if(B&&p.independent!==!1){if(z.details){var ge=B.startPTS,ve=B.endPTS,he=B.startDTS,fe=B.endDTS;if(W)W.elementaryStreams[B.type]={startPTS:ge,endPTS:ve,startDTS:he,endDTS:fe};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var oe=this.getLoadPosition()+this.config.maxBufferHole;if(oe<ge){this.backtrack(N);return}N.setElementaryStreamInfo(B.type,N.start,ve,N.start,fe,!0)}N.setElementaryStreamInfo(B.type,ge,ve,he,fe),this.bufferFragmentData(B,N,W,E)}}else if(p.independent===!1){this.backtrack(N);return}if(le){var Z=le.startPTS,Ee=le.endPTS,Be=le.startDTS,Ne=le.endDTS;W&&(W.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:Ee,startDTS:Be,endDTS:Ne}),N.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,Z,Ee,Be,Ne),this.bufferFragmentData(le,N,W,E)}if(X!=null&&(s=X.samples)!==null&&s!==void 0&&s.length){var He={frag:N,id:a,samples:X.samples};v.trigger(F.Events.FRAG_PARSING_METADATA,He)}if(U){var ze={frag:N,id:a,samples:U.samples};v.trigger(F.Events.FRAG_PARSING_USERDATA,ze)}},y._bufferInitSegment=function(h,s,a,v){var p=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var E=s.audio,D=s.video,N=s.audiovideo;if(E){var W=h.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),E.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(W="mp4a.40.5")),z.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),h.audioCodec&&h.audioCodec!==W&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+W+'"'),E.levelCodec=W,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(h.audioCodec||"")+"/"+E.codec+"]")}D&&(D.levelCodec=h.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+D.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(B){var U=s[B],X=U.initSegment;X!=null&&X.byteLength&&p.hls.trigger(F.Events.BUFFER_APPENDING,{type:B,data:X,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},y.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var s=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,s?this.resetFragmentLoading(h):this.state=M.State.BACKTRACKING},y.checkFragmentChanged=function(){var h=this.media,s=null;if(h&&h.readyState>1&&h.seeking===!1){var a=h.currentTime;if(I.BufferHelper.isBuffered(h,a)?s=this.getAppendedFrag(a):I.BufferHelper.isBuffered(h,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var v=this.fragPlaying,p=s.level;(!v||s.sn!==v.sn||v.level!==p||s.urlId!==v.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:s}),(!v||v.level!==p)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=s)}}},o(l,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),l}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"SubtitleStreamController",function(){return d});var H=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=A("./src/utils/buffer-helper.ts"),F=A("./src/controller/fragment-finders.ts"),I=A("./src/utils/discontinuities.ts"),R=A("./src/controller/level-helper.ts"),O=A("./src/controller/fragment-tracker.ts"),b=A("./src/controller/base-stream-controller.ts"),C=A("./src/types/loader.ts"),L=A("./src/types/level.ts");function S(u,x){for(var g=0;g<x.length;g++){var m=x[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function w(u,x,g){return x&&S(u.prototype,x),g&&S(u,g),u}function T(u,x){u.prototype=Object.create(x.prototype),u.prototype.constructor=u,c(u,x)}function c(u,x){return c=Object.setPrototypeOf||function(m,l){return m.__proto__=l,m},c(u,x)}var o=500,d=function(u){T(x,u);function x(m,l){var y;return y=u.call(this,m,l,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var g=x.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var l=this.hls;l.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(H.Events.ERROR,this.onError,this),l.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var l=this.hls;l.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(H.Events.ERROR,this.onError,this),l.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(o),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(l,y){this.mainDetails=y.details},g.onSubtitleFragProcessed=function(l,y){var f=y.frag,h=y.success;if(this.fragPrevious=f,this.state=b.State.IDLE,!h)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,v=f.start,p=0;p<s.length;p++)if(v>=s[p].start&&v<=s[p].end){a=s[p];break}var E=f.start+f.duration;a?a.end=E:(a={start:v,end:E},s.push(a)),this.fragmentTracker.fragBuffered(f)},g.onBufferFlushing=function(l,y){var f=y.startOffset,h=y.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var v=a[s].details,p=v.targetduration,E=h-p;if(E<=0)return;y.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(D){for(var N=0;N<D.length;){if(D[N].end<=E){D.shift();continue}else if(D[N].start<E)D[N].start=E;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(f,E,C.PlaylistLevelType.SUBTITLE)}},g.onError=function(l,y){var f,h=y.frag;if(!h||h.type!==C.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},g.onSubtitleTracksUpdated=function(l,y){var f=this,h=y.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(s){return new L.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){f.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(l,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},g.onSubtitleTrackLoaded=function(l,y){var f,h=y.details,s=y.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var p=v[a];if(s>=v.length||s!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=p.details)!==null&&f!==void 0&&f.live){var E=this.mainDetails;if(h.deltaUpdateFailed||!E)return;var D=E.fragments[0];if(!p.details)h.hasProgramDateTime&&E.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(h,E):D&&Object(R.addSliding)(h,D.start);else{var N=this.alignPlaylists(h,p.details);N===0&&D&&Object(R.addSliding)(h,D.start)}}if(p.details=h,this.levelLastLoaded=s,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var W=Object(F.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},g._handleFragmentLoadComplete=function(l){var y=l.frag,f=l.payload,h=y.decryptdata,s=this.hls;if(this.fragContextChanged(y))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(v){var p=performance.now();s.trigger(H.Events.FRAG_DECRYPTED,{frag:y,payload:v,stats:{tstart:a,tdecrypt:p}})})}},g.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var l,y=this.currentTrackId,f=this.levels;if(!f.length||!f[y]||!f[y].details)return;var h=f[y].details,s=h.targetduration,a=this.config,v=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-s,a.maxBufferHole),E=p.end,D=p.len,N=this.getMaxBufferLength()+s;if(D>N)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var W=h.fragments,z=W.length,B=h.edge,U,X=this.fragPrevious;if(E<B){var ne=a.maxFragLookUpTolerance;X&&h.hasProgramDateTime&&(U=Object(F.findFragmentByPDT)(W,X.endProgramDateTime,ne)),U||(U=Object(F.findFragmentByPTS)(X,W,E,ne),!U&&X&&X.start<W[0].start&&(U=W[0]))}else U=W[z-1];(l=U)!==null&&l!==void 0&&l.encrypted?(M.logger.log("Loading key for "+U.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:U})):U&&this.fragmentTracker.getState(U)===O.FragmentState.NOT_LOADED&&this.loadFragment(U,h,E)}},g.loadFragment=function(l,y,f){this.fragCurrent=l,u.prototype.loadFragment.call(this,l,y,f)},w(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(b.default)},"./src/controller/subtitle-track-controller.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/controller/base-playlist-controller.ts"),F=A("./src/types/loader.ts");function I(S,w){for(var T=0;T<w.length;T++){var c=w[T];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(S,c.key,c)}}function R(S,w,T){return w&&I(S.prototype,w),T&&I(S,T),S}function O(S,w){S.prototype=Object.create(w.prototype),S.prototype.constructor=S,b(S,w)}function b(S,w){return b=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},b(S,w)}var C=function(S){O(w,S);function w(c){var o;return o=S.call(this,c,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var T=w.prototype;return T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,S.prototype.destroy.call(this)},T.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this)},T.onMediaAttached=function(o,d){if(this.media=d.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)},T.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},T.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=L(this.media.textTracks);o.forEach(function(d){Object(M.clearCurrentCues)(d)}),this.subtitleTrack=-1,this.media=null},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},T.onManifestParsed=function(o,d){this.tracks=d.subtitleTracks},T.onSubtitleTrackLoaded=function(o,d){var u=d.id,x=d.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+u);return}var l=m.details;m.details=d.details,this.log("subtitle track "+u+" loaded ["+x.startSN+"-"+x.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,d,l))},T.onLevelLoading=function(o,d){this.switchLevel(d.level)},T.onLevelSwitching=function(o,d){this.switchLevel(d.level)},T.switchLevel=function(o){var d=this.hls.levels[o];if(!(d!=null&&d.textGroupIds))return;var u=d.textGroupIds[d.urlId];if(this.groupId!==u){var x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(y){return!u||y.groupId===u});this.tracksInGroup=g;var m=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=u;var l={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,l),m!==-1&&this.setSubtitleTrack(m,x)}},T.findTrackId=function(o){for(var d=this.tracksInGroup,u=0;u<d.length;u++){var x=d[u];if((!this.selectDefaultTrack||x.default)&&(!o||o===x.name))return x.id}return-1},T.onError=function(o,d){if(S.prototype.onError.call(this,o,d),d.fatal||!d.context)return;d.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&d.context.id===this.trackId&&d.context.groupId===this.groupId&&this.retryLoadingOrFail(d)},T.loadPlaylist=function(o){var d=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(d)){var u=d.id,x=d.groupId,g=d.url;if(o)try{g=o.addDirectives(g)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:g,id:u,groupId:x,deliveryDirectives:o||null})}},T.toggleTrackModes=function(o){var d=this,u=this.media,x=this.subtitleDisplay,g=this.trackId;if(!u)return;var m=L(u.textTracks),l=m.filter(function(h){return h.groupId===d.groupId});if(o===-1)[].slice.call(m).forEach(function(h){h.mode="disabled"});else{var y=l[g];y&&(y.mode="disabled")}var f=l[o];f&&(f.mode=x?"showing":"hidden")},T.setSubtitleTrack=function(o,d){var u,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=x[o])!==null&&u!==void 0&&u.details)||o<-1||o>=x.length)return;this.clearTimer();var g=x[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,g){var m=g.id,l=g.groupId,y=l===void 0?"":l,f=g.name,h=g.type,s=g.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:f,type:h,url:s});var a=this.switchParams(g.url,d==null?void 0:d.details);this.loadPlaylist(a)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:o})},T.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,d=L(this.media.textTracks),u=0;u<d.length;u++)if(d[u].mode==="hidden")o=u;else if(d[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var d=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,d)}}]),w}(P.default);function L(S){for(var w=[],T=0;T<S.length;T++){var c=S[T];c.kind==="subtitles"&&c.label&&w.push(S[T])}return w}G.default=C},"./src/controller/timeline-controller.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"TimelineController",function(){return L});var H=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/cea-608-parser.ts"),F=A("./src/utils/output-filter.ts"),I=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),O=A("./src/utils/imsc1-ttml-parser.ts"),b=A("./src/types/loader.ts"),C=A("./src/utils/logger.ts"),L=function(){function c(d){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=T(),this.captionsProperties=void 0,this.hls=d,this.config=d.config,this.Cues=d.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 F.default(this,"textTrack1"),x=new F.default(this,"textTrack2"),g=new F.default(this,"textTrack3"),m=new F.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,x),this.cea608Parser2=new P.default(3,g,m)}d.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.on(M.Events.FRAG_LOADING,this.onFragLoading,this),d.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=c.prototype;return o.destroy=function(){var u=this.hls;u.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,x,g,m,l){for(var y=!1,f=l.length;f--;){var h=l[f],s=w(h[0],h[1],x,g);if(s>=0&&(h[0]=Math.min(h[0],x),h[1]=Math.max(h[1],g),y=!0,s/(g-x)>.5))return}if(y||l.push([x,g]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,x,g,m)}else{var v=this.Cues.newCue(null,x,g,m);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:v,track:u})}},o.onInitPtsFound=function(u,x){var g=this,m=x.frag,l=x.id,y=x.initPTS,f=x.timescale,h=this.unparsedVttFrags;l==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(s){g.onFragLoaded(M.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(u){var x=this.media;if(x)for(var g=0;g<x.textTracks.length;g++){var m=x.textTracks[g];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var x=this.captionsProperties,g=this.captionsTracks,m=this.media,l=x[u],y=l.label,f=l.languageCode,h=this.getExistingTrack(u);if(h)g[u]=h,Object(R.clearCurrentCues)(g[u]),Object(R.sendAddTrackEvent)(g[u],m);else{var s=this.createTextTrack("captions",y,f);s&&(s[u]=!0,g[u]=s)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var x=this.captionsProperties[u];if(!x)return;var g=x.label,m={_id:u,label:g,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,x,g){var m=this.media;return m?m.addTextTrack(u,x,g):void 0},o.onMediaAttaching=function(u,x){this.media=x.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(x){Object(R.clearCurrentCues)(u[x]),delete u[x]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var x=u.textTracks;if(x)for(var g=0;g<x.length;g++)Object(R.clearCurrentCues)(x[g])},o.onSubtitleTracksUpdated=function(u,x){var g=this;this.textTracks=[];var m=x.subtitleTracks||[],l=m.some(function(s){return s.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){var y=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var v;if(a<f.length){for(var p=null,E=0;E<f.length;E++)if(S(f[E],s)){p=f[E];break}p&&(v=p)}v?Object(R.clearCurrentCues)(v):(v=g.createTextTrack("subtitles",s.name,s.lang),v&&(v.mode="disabled")),v&&(v.groupId=s.groupId,g.textTracks.push(v))})}else if(!y&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},o.onManifestLoaded=function(u,x){var g=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(m){var l=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!l)return;var y="textTrack"+l[1],f=g.captionsProperties[y];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},o.onFragLoading=function(u,x){var g=this.cea608Parser1,m=this.cea608Parser2,l=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(g&&m))return;if(x.frag.type===b.PlaylistLevelType.MAIN){var f,h,s=x.frag.sn,a=(f=x==null||((h=x.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;s===l+1||s===l&&a===y+1||(g.reset(),m.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(u,x){var g=x.frag,m=x.payload,l=this.initPTS,y=this.unparsedVttFrags;if(g.type===b.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(H.isFiniteNumber)(l[g.cc])){y.push(x),l.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var f=g.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[g.level],s=this.vttCCs;s[g.cc]||(s[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),h&&h.textCodec===O.IMSC1_CODEC?this._parseIMSC1(g,m):this._parseVTTs(g,m,s)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,x){var g=this,m=this.hls;Object(O.parseIMSC1)(x,this.initPTS[u.cc],this.timescale[u.cc],function(l){g._appendCues(l,u.level),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(l){C.logger.log("Failed to parse IMSC1: "+l),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:l})})},o._parseVTTs=function(u,x,g){var m=this,l=this.hls;Object(I.parseWebVTT)(x,this.initPTS[u.cc],this.timescale[u.cc],g,u.cc,u.start,function(y){m._appendCues(y,u.level),l.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(y){m._fallbackToIMSC1(u,x),C.logger.log("Failed to parse VTT cue: "+y),l.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:y})})},o._fallbackToIMSC1=function(u,x){var g=this,m=this.tracks[u.level];m.textCodec||Object(O.parseIMSC1)(x,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=O.IMSC1_CODEC,g._parseIMSC1(u,x)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,x){var g=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[x];if(m.mode==="disabled")return;u.forEach(function(f){return Object(R.addCueToTrack)(m,f)})}else{var l=this.tracks[x],y=l.default?"default":"subtitles"+x;g.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:u,track:y})}},o.onFragDecrypted=function(u,x){var g=x.frag;if(g.type===b.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(M.Events.FRAG_LOADED,x)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,x){var g=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(g&&m))return;for(var l=0;l<x.samples.length;l++){var y=x.samples[l].bytes;if(y){var f=this.extractCea608Data(y);g.addData(x.samples[l].pts,f[0]),m.addData(x.samples[l].pts,f[1])}}},o.onBufferFlushing=function(u,x){var g=x.startOffset,m=x.endOffset,l=x.endOffsetSubtitles,y=x.type,f=this.media;if(!f||f.currentTime<m)return;if(!y||y==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(a){return Object(R.removeCuesInRange)(h[a],g,m)})}if(this.config.renderTextTracksNatively&&(g===0&&l!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(R.removeCuesInRange)(s[a],g,l)})}},o.extractCea608Data=function(u){for(var x=u[0]&31,g=2,m=[[],[]],l=0;l<x;l++){var y=u[g++],f=127&u[g++],h=127&u[g++],s=(4&y)!==0,a=3&y;if(f===0&&h===0)continue;s&&((a===0||a===1)&&(m[a].push(f),m[a].push(h)))}return m},c}();function S(c,o){return c&&c.label===o.name&&!(c.textTrack1||c.textTrack2)}function w(c,o,d,u){return Math.min(o,u)-Math.max(c,d)}function T(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return H});var H=function(){function M(F,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=I}var P=M.prototype;return P.decrypt=function(I,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,I)},M}()},"./src/crypt/aes-decryptor.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"removePadding",function(){return M}),A.d(G,"default",function(){return P});var H=A("./src/utils/typed-array.ts");function M(F){var I=F.byteLength,R=I&&new DataView(F.buffer).getUint8(I-1);return R?Object(H.sliceUint8)(F,0,I-R):F}var P=function(){function F(){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=F.prototype;return I.uint8ArrayToUint32Array_=function(O){for(var b=new DataView(O),C=new Uint32Array(4),L=0;L<4;L++)C[L]=b.getUint32(L*4);return C},I.initTable=function(){var O=this.sBox,b=this.invSBox,C=this.subMix,L=C[0],S=C[1],w=C[2],T=C[3],c=this.invSubMix,o=c[0],d=c[1],u=c[2],x=c[3],g=new Uint32Array(256),m=0,l=0,y=0;for(y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(y=0;y<256;y++){var f=l^l<<1^l<<2^l<<3^l<<4;f=f>>>8^f&255^99,O[m]=f,b[f]=m;var h=g[m],s=g[h],a=g[s],v=g[f]*257^f*16843008;L[m]=v<<24|v>>>8,S[m]=v<<16|v>>>16,w[m]=v<<8|v>>>24,T[m]=v,v=a*16843009^s*65537^h*257^m*16843008,o[f]=v<<24|v>>>8,d[f]=v<<16|v>>>16,u[f]=v<<8|v>>>24,x[f]=v,m?(m=h^g[g[g[a^h]]],l^=g[g[l]]):m=l=1}},I.expandKey=function(O){for(var b=this.uint8ArrayToUint32Array_(O),C=!0,L=0;L<b.length&&C;)C=b[L]===this.key[L],L++;if(C)return;this.key=b;var S=this.keySize=b.length;if(S!==4&&S!==6&&S!==8)throw new Error("Invalid aes key size="+S);var w=this.ksRows=(S+6+1)*4,T,c,o=this.keySchedule=new Uint32Array(w),d=this.invKeySchedule=new Uint32Array(w),u=this.sBox,x=this.rcon,g=this.invSubMix,m=g[0],l=g[1],y=g[2],f=g[3],h,s;for(T=0;T<w;T++){if(T<S){h=o[T]=b[T];continue}s=h,T%S===0?(s=s<<8|s>>>24,s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255],s^=x[T/S|0]<<24):S>6&&T%S===4&&(s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255]),o[T]=h=(o[T-S]^s)>>>0}for(c=0;c<w;c++)T=w-c,c&3?s=o[T]:s=o[T-4],c<4||T<=4?d[c]=s:d[c]=m[u[s>>>24]]^l[u[s>>>16&255]]^y[u[s>>>8&255]]^f[u[s&255]],d[c]=d[c]>>>0},I.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},I.decrypt=function(O,b,C){for(var L=this.keySize+6,S=this.invKeySchedule,w=this.invSBox,T=this.invSubMix,c=T[0],o=T[1],d=T[2],u=T[3],x=this.uint8ArrayToUint32Array_(C),g=x[0],m=x[1],l=x[2],y=x[3],f=new Int32Array(O),h=new Int32Array(f.length),s,a,v,p,E,D,N,W,z,B,U,X,ne,le,de=this.networkToHostOrderSwap;b<f.length;){for(z=de(f[b]),B=de(f[b+1]),U=de(f[b+2]),X=de(f[b+3]),E=z^S[0],D=X^S[1],N=U^S[2],W=B^S[3],ne=4,le=1;le<L;le++)s=c[E>>>24]^o[D>>16&255]^d[N>>8&255]^u[W&255]^S[ne],a=c[D>>>24]^o[N>>16&255]^d[W>>8&255]^u[E&255]^S[ne+1],v=c[N>>>24]^o[W>>16&255]^d[E>>8&255]^u[D&255]^S[ne+2],p=c[W>>>24]^o[E>>16&255]^d[D>>8&255]^u[N&255]^S[ne+3],E=s,D=a,N=v,W=p,ne=ne+4;s=w[E>>>24]<<24^w[D>>16&255]<<16^w[N>>8&255]<<8^w[W&255]^S[ne],a=w[D>>>24]<<24^w[N>>16&255]<<16^w[W>>8&255]<<8^w[E&255]^S[ne+1],v=w[N>>>24]<<24^w[W>>16&255]<<16^w[E>>8&255]<<8^w[D&255]^S[ne+2],p=w[W>>>24]<<24^w[E>>16&255]<<16^w[D>>8&255]<<8^w[N&255]^S[ne+3],h[b]=de(s^g),h[b+1]=de(p^m),h[b+2]=de(v^l),h[b+3]=de(a^y),g=z,m=B,l=U,y=X,b=b+4}return h.buffer},F}()},"./src/crypt/decrypter.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return b});var H=A("./src/crypt/aes-crypto.ts"),M=A("./src/crypt/fast-aes-key.ts"),P=A("./src/crypt/aes-decryptor.ts"),F=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/utils/typed-array.ts"),O=16,b=function(){function C(S,w,T){var c=T===void 0?{}:T,o=c.removePKCS7Padding,d=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=S,this.config=w,this.removePKCS7Padding=d,d)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var L=C.prototype;return L.destroy=function(){this.observer=null},L.isSync=function(){return this.config.enableSoftwareAES},L.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var T=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(T):T},L.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},L.decrypt=function(w,T,c,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),T,c);var d=this.flush();d&&o(d.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),T,c).then(o)},L.softwareDecrypt=function(w,T,c){var o=this.currentIV,d=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(w=Object(I.appendUint8Array)(u,w),this.remainderData=null);var x=this.getValidChunk(w);if(!x.length)return null;o&&(c=o);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(T);var m=d;return this.currentResult=g.decrypt(x.buffer,0,c),this.currentIV=Object(R.sliceUint8)(x,-16).buffer,m||null},L.webCryptoDecrypt=function(w,T,c){var o=this,d=this.subtle;return(this.key!==T||!this.fastAesKey)&&(this.key=T,this.fastAesKey=new M.default(d,T)),this.fastAesKey.expandKey().then(function(u){if(!d)return Promise.reject(new Error("web crypto not initialized"));var x=new H.default(d,c);return x.decrypt(w.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,w,T,c)})},L.onWebCryptoError=function(w,T,c,o){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(T,c,o)},L.getValidChunk=function(w){var T=w,c=w.length-w.length%O;return c!==w.length&&(T=Object(R.sliceUint8)(w,0,c),this.remainderData=Object(R.sliceUint8)(w,c)),T},L.logOnce=function(w){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},C}()},"./src/crypt/fast-aes-key.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return H});var H=function(){function M(F,I){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=I}var P=M.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/adts.ts"),P=A("./src/utils/logger.ts"),F=A("./src/demux/id3.ts");function I(b,C){b.prototype=Object.create(C.prototype),b.prototype.constructor=b,R(b,C)}function R(b,C){return R=Object.setPrototypeOf||function(S,w){return S.__proto__=w,S},R(b,C)}var O=function(b){I(C,b);function C(S,w){var T;return T=b.call(this)||this,T.observer=void 0,T.config=void 0,T.observer=S,T.config=w,T}var L=C.prototype;return L.resetInitSegment=function(w,T,c){b.prototype.resetInitSegment.call(this,w,T,c),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:c,inputTimeScale:9e4,dropped:0}},C.probe=function(w){if(!w)return!1;for(var T=F.getID3Data(w,0)||[],c=T.length,o=w.length;c<o;c++)if(M.probe(w,c))return P.logger.log("ADTS sync word found !"),!0;return!1},L.canParse=function(w,T){return M.canParse(w,T)},L.appendFrame=function(w,T,c){M.initTrackConfig(w,this.observer,T,c,w.manifestCodec);var o=M.appendFrame(w,T,c,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},C}(H.default);O.minProbeByteLength=9,G.default=O},"./src/demux/adts.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"getAudioConfig",function(){return F}),A.d(G,"isHeaderPattern",function(){return I}),A.d(G,"getHeaderLength",function(){return R}),A.d(G,"getFullFrameLength",function(){return O}),A.d(G,"canGetFrameLength",function(){return b}),A.d(G,"isHeader",function(){return C}),A.d(G,"canParse",function(){return L}),A.d(G,"probe",function(){return S}),A.d(G,"initTrackConfig",function(){return w}),A.d(G,"getFrameDuration",function(){return T}),A.d(G,"parseFrameHeader",function(){return c}),A.d(G,"appendFrame",function(){return o});var H=A("./src/utils/logger.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts");function F(d,u,x,g){var m,l,y,f,h=navigator.userAgent.toLowerCase(),s=g,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[x+2]&192)>>>6)+1;var v=(u[x+2]&60)>>>2;if(v>a.length-1){d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return y=(u[x+2]&1)<<2,y|=(u[x+3]&192)>>>6,H.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(h)?v>=6?(m=5,f=new Array(4),l=v-3):(m=2,f=new Array(2),l=v):h.indexOf("android")!==-1?(m=2,f=new Array(2),l=v):(m=5,f=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&v>=6?l=v-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(v>=6&&y===1||/vivaldi/i.test(h))||!g&&y===1)&&(m=2,f=new Array(2)),l=v)),f[0]=m<<3,f[0]|=(v&14)>>1,f[1]|=(v&1)<<7,f[1]|=y<<3,m===5&&(f[1]|=(l&14)>>1,f[2]=(l&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[v],channelCount:y,codec:"mp4a.40."+m,manifestCodec:s}}function I(d,u){return d[u]===255&&(d[u+1]&246)===240}function R(d,u){return d[u+1]&1?7:9}function O(d,u){return(d[u+3]&3)<<11|d[u+4]<<3|(d[u+5]&224)>>>5}function b(d,u){return u+5<d.length}function C(d,u){return u+1<d.length&&I(d,u)}function L(d,u){return b(d,u)&&I(d,u)&&O(d,u)<=d.length-u}function S(d,u){if(C(d,u)){var x=R(d,u);if(u+x>=d.length)return!1;var g=O(d,u);if(g<=x)return!1;var m=u+g;return m===d.length||C(d,m)}return!1}function w(d,u,x,g,m){if(!d.samplerate){var l=F(u,x,g,m);if(!l)return;d.config=l.config,d.samplerate=l.samplerate,d.channelCount=l.channelCount,d.codec=l.codec,d.manifestCodec=l.manifestCodec,H.logger.log("parsed codec:"+d.codec+", rate:"+l.samplerate+", channels:"+l.channelCount)}}function T(d){return 1024*9e4/d}function c(d,u,x,g,m){var l=R(d,u),y=O(d,u);if(y-=l,y>0){var f=x+g*m;return{headerLength:l,frameLength:y,stamp:f}}}function o(d,u,x,g,m){var l=T(d.samplerate),y=c(u,x,g,m,l);if(y){var f=y.frameLength,h=y.headerLength,s=y.stamp,a=h+f,v=Math.max(0,x+a-u.length),p;v?(p=new Uint8Array(a-h),p.set(u.subarray(x+h,u.length),0)):p=u.subarray(x+h,x+a);var E={unit:p,pts:s};return v||d.samples.push(E),{sample:E,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"initPTSFn",function(){return O});var H=A("./src/polyfills/number.ts"),M=A("./src/demux/id3.ts"),P=A("./src/demux/dummy-demuxed-track.ts"),F=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/typed-array.ts"),R=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var C=b.prototype;return C.resetInitSegment=function(S,w,T){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},C.resetTimeStamp=function(){},C.resetContiguity=function(){},C.canParse=function(S,w){return!1},C.appendFrame=function(S,w,T){},C.demux=function(S,w){this.cachedData&&(S=Object(F.appendUint8Array)(this.cachedData,S),this.cachedData=null);var T=M.getID3Data(S,0),c=T?T.length:0,o,d,u=this._audioTrack,x=this._id3Track,g=T?M.getTimeStamp(T):void 0,m=S.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(g,w)),T&&T.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:T}),d=this.initPTS;c<m;){if(this.canParse(S,c)){var l=this.appendFrame(u,S,c);l?(this.frameIndex++,d=l.sample.pts,c+=l.length,o=c):c=m}else M.canParse(S,c)?(T=M.getID3Data(S,c),x.samples.push({pts:d,dts:d,data:T}),c+=T.length,o=c):c++;if(c===m&&o!==m){var y=Object(I.sliceUint8)(S,o);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:x,textTrack:Object(P.dummyTrack)()}},C.demuxSampleAes=function(S,w,T){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},C.flush=function(S){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},C.destroy=function(){},b}(),O=function(C,L){return Object(H.isFiniteNumber)(C)?C*90:L*9e4};G.default=R},"./src/demux/chunk-cache.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return H});var H=function(){function P(){this.chunks=[],this.dataLength=0}var F=P.prototype;return F.push=function(R){this.chunks.push(R),this.dataLength+=R.length},F.flush=function(){var R=this.chunks,O=this.dataLength,b;if(R.length)R.length===1?b=R[0]:b=M(R,O);else return new Uint8Array(0);return this.reset(),b},F.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,F){for(var I=new Uint8Array(F),R=0,O=0;O<P.length;O++){var b=P[O];I.set(b,R),R+=b.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/utils/logger.ts"),M=function(){function P(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 F=P.prototype;return F.loadWord=function(){var R=this.data,O=this.bytesAvailable,b=R.byteLength-O,C=new Uint8Array(4),L=Math.min(4,O);if(L===0)throw new Error("no bytes available");C.set(R.subarray(b,b+L)),this.word=new DataView(C.buffer).getUint32(0),this.bitsAvailable=L*8,this.bytesAvailable-=L},F.skipBits=function(R){var O;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,O=R>>3,R-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},F.readBits=function(R){var O=Math.min(this.bitsAvailable,R),b=this.word>>>32-O;return R>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=R-O,O>0&&this.bitsAvailable?b<<O|this.readBits(O):b},F.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()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},F.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(R){for(var O=8,b=8,C,L=0;L<R;L++)b!==0&&(C=this.readEG(),b=(O+C+256)%256),O=b===0?O:b},F.readSPS=function(){var R=0,O=0,b=0,C=0,L,S,w,T=this.readUByte.bind(this),c=this.readBits.bind(this),o=this.readUEG.bind(this),d=this.readBoolean.bind(this),u=this.skipBits.bind(this),x=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);T();var l=T();if(c(5),u(3),T(),g(),l===100||l===110||l===122||l===244||l===44||l===83||l===86||l===118||l===128){var y=o();if(y===3&&u(1),g(),g(),u(1),d())for(S=y!==3?8:12,w=0;w<S;w++)d()&&(w<6?m(16):m(64))}g();var f=o();if(f===0)o();else if(f===1)for(u(1),x(),x(),L=o(),w=0;w<L;w++)x();g(),u(1);var h=o(),s=o(),a=c(1);a===0&&u(1),u(1),d()&&(R=o(),O=o(),b=o(),C=o());var v=[1,1];if(d()&&d()){var p=T();switch(p){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[T()<<8|T(),T()<<8|T()];break}}}return{width:Math.ceil((h+1)*16-R*2-O*2),height:(2-a)*(s+1)*16-(a?2:4)*(b+C),pixelRatio:v}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();G.default=M},"./src/demux/id3.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"isHeader",function(){return H}),A.d(G,"isFooter",function(){return M}),A.d(G,"getID3Data",function(){return P}),A.d(G,"canParse",function(){return I}),A.d(G,"getTimeStamp",function(){return R}),A.d(G,"isTimeStampFrame",function(){return O}),A.d(G,"getID3Frames",function(){return C}),A.d(G,"decodeFrame",function(){return L}),A.d(G,"utf8ArrayToStr",function(){return o}),A.d(G,"testables",function(){return d});var H=function(m,l){return l+10<=m.length&&(m[l]===73&&m[l+1]===68&&m[l+2]===51&&(m[l+3]<255&&m[l+4]<255&&(m[l+6]<128&&m[l+7]<128&&m[l+8]<128&&m[l+9]<128)))},M=function(m,l){return l+10<=m.length&&(m[l]===51&&m[l+1]===68&&m[l+2]===73&&(m[l+3]<255&&m[l+4]<255&&(m[l+6]<128&&m[l+7]<128&&m[l+8]<128&&m[l+9]<128)))},P=function(m,l){for(var y=l,f=0;H(m,l);){f+=10;var h=F(m,l+6);f+=h,M(m,l+10)&&(f+=10),l+=f}return f>0?m.subarray(y,y+f):void 0},F=function(m,l){var y=0;return y=(m[l]&127)<<21,y|=(m[l+1]&127)<<14,y|=(m[l+2]&127)<<7,y|=m[l+3]&127,y},I=function(m,l){return H(m,l)&&F(m,l+6)+10<=m.length-l},R=function(m){for(var l=C(m),y=0;y<l.length;y++){var f=l[y];if(O(f))return c(f)}return},O=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},b=function(m){var l=String.fromCharCode(m[0],m[1],m[2],m[3]),y=F(m,4),f=10;return{type:l,size:y,data:m.subarray(f,f+y)}},C=function(m){for(var l=0,y=[];H(m,l);){var f=F(m,l+6);l+=10;for(var h=l+f;l+8<h;){var s=b(m.subarray(l)),a=L(s);a&&y.push(a),l+=s.size+10}M(m,l)&&(l+=10)}return y},L=function(m){return m.type==="PRIV"?S(m):m.type[0]==="W"?T(m):w(m)},S=function(m){if(m.size<2)return;var l=o(m.data,!0),y=new Uint8Array(m.data.subarray(l.length+1));return{key:m.type,info:l,data:y.buffer}},w=function(m){if(m.size<2)return;if(m.type==="TXXX"){var l=1,y=o(m.data.subarray(l),!0);l+=y.length+1;var f=o(m.data.subarray(l));return{key:m.type,info:y,data:f}}var h=o(m.data.subarray(1));return{key:m.type,data:h}},T=function(m){if(m.type==="WXXX"){if(m.size<2)return;var l=1,y=o(m.data.subarray(l),!0);l+=y.length+1;var f=o(m.data.subarray(l));return{key:m.type,info:y,data:f}}var h=o(m.data);return{key:m.type,data:h}},c=function(m){if(m.data.byteLength===8){var l=new Uint8Array(m.data),y=l[3]&1,f=(l[4]<<23)+(l[5]<<15)+(l[6]<<7)+l[7];return f/=45,y&&(f+=4772185884e-2),Math.round(f)}return},o=function(m,l){l===void 0&&(l=!1);var y=x();if(y){var f=y.decode(m);if(l){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var s=m.length,a,v,p,E="",D=0;D<s;){if(a=m[D++],a===0&&l)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:v=m[D++],E+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[D++],p=m[D++],E+=String.fromCharCode((a&15)<<12|(v&63)<<6|(p&63)<<0);break;default:}}return E},d={decodeTextFrame:w},u;function x(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/id3.ts"),P=A("./src/utils/logger.ts"),F=A("./src/demux/mpegaudio.ts");function I(b,C){b.prototype=Object.create(C.prototype),b.prototype.constructor=b,R(b,C)}function R(b,C){return R=Object.setPrototypeOf||function(S,w){return S.__proto__=w,S},R(b,C)}var O=function(b){I(C,b);function C(){return b.apply(this,arguments)||this}var L=C.prototype;return L.resetInitSegment=function(w,T,c){b.prototype.resetInitSegment.call(this,w,T,c),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:c,inputTimeScale:9e4,dropped:0}},C.probe=function(w){if(!w)return!1;for(var T=M.getID3Data(w,0)||[],c=T.length,o=w.length;c<o;c++)if(F.probe(w,c))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},L.canParse=function(w,T){return F.canParse(w,T)},L.appendFrame=function(w,T,c){return this.initPTS===null?void 0:F.appendFrame(w,T,c,this.initPTS,this.frameIndex)},C}(H.default);O.minProbeByteLength=4,G.default=O},"./src/demux/mp4demuxer.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/utils/mp4-tools.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),P=function(){function F(R,O){this.remainderData=null,this.config=void 0,this.config=O}var I=F.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},F.probe=function(O){return Object(H.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},I.demux=function(O){var b=O,C=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(H.appendUint8Array)(this.remainderData,O));var L=Object(H.segmentValidRange)(b);this.remainderData=L.remainder,C.samples=L.valid||new Uint8Array}else C.samples=b;return{audioTrack:Object(M.dummyTrack)(),avcTrack:C,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},I.flush=function(){var O=Object(M.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:O,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},I.demuxSampleAes=function(O,b,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},F}();P.minProbeByteLength=1024,G.default=P},"./src/demux/mpegaudio.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"appendFrame",function(){return R}),A.d(G,"parseHeader",function(){return O}),A.d(G,"isHeaderPattern",function(){return b}),A.d(G,"isHeader",function(){return C}),A.d(G,"canParse",function(){return L}),A.d(G,"probe",function(){return S});var H=null,M=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function R(w,T,c,o,d){if(c+24>T.length)return;var u=O(T,c);if(u&&c+u.frameLength<=T.length){var x=u.samplesPerFrame*9e4/u.sampleRate,g=o+d*x,m={unit:T.subarray(c,c+u.frameLength),pts:g,dts:g};return w.config=[],w.channelCount=u.channelCount,w.samplerate=u.sampleRate,w.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function O(w,T){var c=w[T+1]>>3&3,o=w[T+1]>>1&3,d=w[T+2]>>4&15,u=w[T+2]>>2&3;if(c!==1&&d!==0&&d!==15&&u!==3){var x=w[T+2]>>1&1,g=w[T+3]>>6,m=c===3?3-o:o===3?3:4,l=M[m*14+d-1]*1e3,y=c===3?0:c===2?1:2,f=P[y*3+u],h=g===3?1:2,s=F[c][o],a=I[o],v=s*8*a,p=Math.floor(s*l/f+x)*a;if(H===null){var E=navigator.userAgent||"",D=E.match(/Chrome\/(\d+)/i);H=D?parseInt(D[1]):0}var N=!!H&&H<=87;return N&&o===2&&l>=224e3&&g===0&&(w[T+3]=w[T+3]|128),{sampleRate:f,channelCount:h,frameLength:p,samplesPerFrame:v}}}function b(w,T){return w[T]===255&&(w[T+1]&224)===224&&(w[T+1]&6)!==0}function C(w,T){return T+1<w.length&&b(w,T)}function L(w,T){var c=4;return b(w,T)&&c<=w.length-T}function S(w,T){if(T+1<w.length&&b(w,T)){var c=4,o=O(w,T),d=c;o!=null&&o.frameLength&&(d=o.frameLength);var u=T+d;return u===w.length||C(w,u)}return!1}},"./src/demux/sample-aes.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/crypt/decrypter.ts"),M=A("./src/demux/tsdemuxer.ts"),P=function(){function F(R,O,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new H.default(R,O,{removePKCS7Padding:!1})}var I=F.prototype;return I.decryptBuffer=function(O,b){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,b)},I.decryptAacSample=function(O,b,C,L){var S=O[b].unit,w=S.subarray(16,S.length-S.length%16),T=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),c=this;this.decryptBuffer(T,function(o){var d=new Uint8Array(o);S.set(d,16),L||c.decryptAacSamples(O,b+1,C)})},I.decryptAacSamples=function(O,b,C){for(;;b++){if(b>=O.length){C();return}if(O[b].unit.length<32)continue;var L=this.decrypter.isSync();if(this.decryptAacSample(O,b,C,L),!L)return}},I.getAvcEncryptedData=function(O){for(var b=Math.floor((O.length-48)/160)*16+16,C=new Int8Array(b),L=0,S=32;S<=O.length-16;S+=160,L+=16)C.set(O.subarray(S,S+16),L);return C},I.getAvcDecryptedUnit=function(O,b){for(var C=new Uint8Array(b),L=0,S=32;S<=O.length-16;S+=160,L+=16)O.set(C.subarray(L,L+16),S);return O},I.decryptAvcSample=function(O,b,C,L,S,w){var T=Object(M.discardEPB)(S.data),c=this.getAvcEncryptedData(T),o=this;this.decryptBuffer(c.buffer,function(d){S.data=o.getAvcDecryptedUnit(T,d),w||o.decryptAvcSamples(O,b,C+1,L)})},I.decryptAvcSamples=function(O,b,C,L){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,C=0){if(b>=O.length){L();return}for(var S=O[b].units;!(C>=S.length);C++){var w=S[C];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var T=this.decrypter.isSync();if(this.decryptAvcSample(O,b,C,L,w,T),!T)return}}},F}();G.default=P},"./src/demux/transmuxer-interface.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return S});var H=A("./node_modules/webworkify-webpack/index.js"),M=A.n(H),P=A("./src/events.ts"),F=A("./src/demux/transmuxer.ts"),I=A("./src/utils/logger.ts"),R=A("./src/errors.ts"),O=A("./src/utils/mediasource-helper.ts"),b=A("./node_modules/eventemitter3/index.js"),C=A.n(b),L=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},S=function(){function w(c,o,d,u){var x=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=c,this.id=o,this.onTransmuxComplete=d,this.onFlush=u;var g=c.config,m=function(s,a){a=a||{},a.frag=x.frag,a.id=x.id,c.trigger(s,a)};this.observer=new b.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var l={mp4:L.isTypeSupported("video/mp4"),mpeg:L.isTypeSupported("audio/mpeg"),mp3:L.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var f;try{f=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){c.trigger(P.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},f.postMessage({cmd:"init",typeSupported:l,vendor:y,id:o,config:JSON.stringify(g)})}catch(h){I.logger.warn("Error in worker:",h),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new F.default(this.observer,l,g,y,o),this.worker=null}}else this.transmuxer=new F.default(this.observer,l,g,y,o)}var T=w.prototype;return T.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var d=this.transmuxer;d&&(d.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},T.push=function(o,d,u,x,g,m,l,y,f,h){var s=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,p=m?m.start:g.start,E=g.decryptdata,D=this.frag,N=!(D&&g.cc===D.cc),W=!(D&&f.level===D.level),z=D?f.sn-D.sn:-1,B=this.part?f.part-this.part.index:1,U=!W&&(z===1||z===0&&B===1),X=self.performance.now();(W||z||g.stats.parsing.start===0)&&(g.stats.parsing.start=X),m&&(B||!U)&&(m.stats.parsing.start=X);var ne=new F.TransmuxState(N,U,y,W,p);if(!U||N){I.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+U+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+p);var le=new F.TransmuxConfig(u,x,d,l,h);this.configureTransmuxer(le)}if(this.frag=g,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:f,state:ne},o instanceof ArrayBuffer?[o]:[]);else if(a){var de=a.push(o,E,f,ne);Object(F.isPromise)(de)?de.then(function(we){s.handleTransmuxComplete(we)}):this.handleTransmuxComplete(de)}},T.flush=function(o){var d=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:o});else if(u){var g=u.flush(o);Object(F.isPromise)(g)?g.then(function(m){d.handleFlushResult(m,o)}):this.handleFlushResult(g,o)}},T.handleFlushResult=function(o,d){var u=this;o.forEach(function(x){u.handleTransmuxComplete(x)}),this.onFlush(d)},T.onWorkerMessage=function(o){var d=o.data,u=this.hls;switch(d.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.id=this.id,u.trigger(d.event,d.data);break}}},T.configureTransmuxer=function(o){var d=this.worker,u=this.transmuxer;d?d.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},T.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return R});var H=A("./src/demux/transmuxer.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),F=A("./node_modules/eventemitter3/index.js"),I=A.n(F);function R(S){var w=new F.EventEmitter,T=function(o,d){S.postMessage({event:o,data:d})};w.on(M.Events.FRAG_DECRYPTED,T),w.on(M.Events.ERROR,T),S.addEventListener("message",function(c){var o=c.data;switch(o.cmd){case"init":{var d=JSON.parse(o.config);S.transmuxer=new H.default(w,o.typeSupported,d,o.vendor,o.id),Object(P.enableLogs)(d.debug),T("init",null);break}case"configure":{S.transmuxer.configure(o.config);break}case"demux":{var u=S.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(u)?u.then(function(m){O(S,m)}):O(S,u);break}case"flush":{var x=o.chunkMeta,g=S.transmuxer.flush(x);Object(H.isPromise)(g)?g.then(function(m){C(S,m,x)}):C(S,g,x);break}default:break}})}function O(S,w){if(L(w.remuxResult))return;var T=[],c=w.remuxResult,o=c.audio,d=c.video;o&&b(T,o),d&&b(T,d),S.postMessage({event:"transmuxComplete",data:w},T)}function b(S,w){w.data1&&S.push(w.data1.buffer),w.data2&&S.push(w.data2.buffer)}function C(S,w,T){w.forEach(function(c){O(S,c)}),S.postMessage({event:"flush",data:T})}function L(S){return!S.audio&&!S.video&&!S.text&&!S.id3&&!S.initSegment}},"./src/demux/transmuxer.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return d}),A.d(G,"isPromise",function(){return g}),A.d(G,"TransmuxConfig",function(){return m}),A.d(G,"TransmuxState",function(){return l});var H=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/crypt/decrypter.ts"),F=A("./src/demux/aacdemuxer.ts"),I=A("./src/demux/mp4demuxer.ts"),R=A("./src/demux/tsdemuxer.ts"),O=A("./src/demux/mp3demuxer.ts"),b=A("./src/remux/mp4-remuxer.ts"),C=A("./src/remux/passthrough-remuxer.ts"),L=A("./src/demux/chunk-cache.ts"),S=A("./src/utils/mp4-tools.ts"),w=A("./src/utils/logger.ts"),T;try{T=self.performance.now.bind(self.performance)}catch(y){w.logger.debug("Unable to use Performance API on this environment"),T=self.Date.now}var c=[{demux:R.default,remux:b.default},{demux:I.default,remux:C.default},{demux:F.default,remux:b.default},{demux:O.default,remux:b.default}],o=1024;c.forEach(function(y){var f=y.demux;o=Math.max(o,f.minProbeByteLength)});var d=function(){function y(h,s,a,v,p){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=h,this.typeSupported=s,this.config=a,this.vendor=v,this.id=p}var f=y.prototype;return f.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},f.push=function(s,a,v,p){var E=this,D=v.transmuxing;D.executeStart=T();var N=new Uint8Array(s),W=this.cache,z=this.config,B=this.currentTransmuxState,U=this.transmuxConfig;p&&(this.currentTransmuxState=p);var X=u(N,a);if(X&&X.method==="AES-128"){var ne=this.getDecrypter();if(z.enableSoftwareAES){var le=ne.softwareDecrypt(N,X.key.buffer,X.iv.buffer);if(!le)return D.executeEnd=T(),x(v);N=new Uint8Array(le)}else return this.decryptionPromise=ne.webCryptoDecrypt(N,X.key.buffer,X.iv.buffer).then(function(Ce){var Me=E.push(Ce,null,v);return E.decryptionPromise=null,Me}),this.decryptionPromise}var de=p||B,we=de.contiguous,ge=de.discontinuity,ve=de.trackSwitch,he=de.accurateTimeOffset,fe=de.timeOffset,oe=U.audioCodec,Z=U.videoCodec,Ee=U.defaultInitPts,Be=U.duration,Ne=U.initSegmentData;if((ge||ve)&&this.resetInitSegment(Ne,oe,Z,Be),ge&&this.resetInitialTimestamp(Ee),we||this.resetContiguity(),this.needsProbing(N,ge,ve)){if(W.dataLength){var He=W.flush();N=Object(S.appendUint8Array)(He,N)}this.configureTransmuxer(N,U)}var ze=this.transmux(N,X,fe,he,v),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,D.executeEnd=T(),ze},f.flush=function(s){var a=this,v=s.transmuxing;v.executeStart=T();var p=this.decrypter,E=this.cache,D=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return a.flush(s)});var W=[],z=D.timeOffset;if(p){var B=p.flush();B&&W.push(this.push(B,null,s))}var U=E.dataLength;E.reset();var X=this.demuxer,ne=this.remuxer;if(!X||!ne)return U>=o&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=T(),[x(s)];var le=X.flush(z);return g(le)?le.then(function(de){return a.flushRemux(W,de,s),W}):(this.flushRemux(W,le,s),W)},f.flushRemux=function(s,a,v){var p=a.audioTrack,E=a.avcTrack,D=a.id3Track,N=a.textTrack,W=this.currentTransmuxState,z=W.accurateTimeOffset,B=W.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var U=this.remuxer.remux(p,E,D,N,B,z,!0,this.id);s.push({remuxResult:U,chunkMeta:v}),v.transmuxing.executeEnd=T()},f.resetInitialTimestamp=function(s){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(s),v.resetTimeStamp(s)},f.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(s,a,v,p){var E=this.demuxer,D=this.remuxer;if(!E||!D)return;E.resetInitSegment(a,v,p),D.resetInitSegment(s,a,v)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(s,a,v,p,E){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(s,a,v,p,E):D=this.transmuxUnencrypted(s,v,p,E),D},f.transmuxUnencrypted=function(s,a,v,p){var E=this.demuxer.demux(s,a,!1,!this.config.progressive),D=E.audioTrack,N=E.avcTrack,W=E.id3Track,z=E.textTrack,B=this.remuxer.remux(D,N,W,z,a,v,!1,this.id);return{remuxResult:B,chunkMeta:p}},f.transmuxSampleAes=function(s,a,v,p,E){var D=this;return this.demuxer.demuxSampleAes(s,a,v).then(function(N){var W=D.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,v,p,!1,D.id);return{remuxResult:W,chunkMeta:E}})},f.configureTransmuxer=function(s,a){for(var v=this.config,p=this.observer,E=this.typeSupported,D=this.vendor,N=a.audioCodec,W=a.defaultInitPts,z=a.duration,B=a.initSegmentData,U=a.videoCodec,X,ne=0,le=c.length;ne<le;ne++)if(c[ne].demux.probe(s)){X=c[ne];break}X||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:I.default,remux:C.default});var de=this.demuxer,we=this.remuxer,ge=X.remux,ve=X.demux;(!we||!(we instanceof ge))&&(this.remuxer=new ge(p,v,E,D)),(!de||!(de instanceof ve))&&(this.demuxer=new ve(p,v,E),this.probe=ve.probe),this.resetInitSegment(B,N,U,z),this.resetInitialTimestamp(W)},f.needsProbing=function(s,a,v){return!this.demuxer||!this.remuxer||a||v},f.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new P.default(this.observer,this.config)),s},y}();function u(y,f){var h=null;return y.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var x=function(f){return{remuxResult:{},chunkMeta:f}};function g(y){return"then"in y&&y.then instanceof Function}var m=function(f,h,s,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=h,this.initSegmentData=s,this.duration=a,this.defaultInitPts=v},l=function(f,h,s,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=h,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"discardEPB",function(){return x});var H=A("./src/demux/adts.ts"),M=A("./src/demux/mpegaudio.ts"),P=A("./src/demux/exp-golomb.ts"),F=A("./src/demux/id3.ts"),I=A("./src/demux/sample-aes.ts"),R=A("./src/events.ts"),O=A("./src/utils/mp4-tools.ts"),b=A("./src/utils/logger.ts"),C=A("./src/errors.ts"),L={video:1,audio:2,id3:3,text:4},S=function(){function g(l,y,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=l,this.config=y,this.typeSupported=f}g.probe=function(y){var f=g.syncOffset(y);return f<0?!1:(f&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},g.syncOffset=function(y){for(var f=Math.min(1e3,y.length-3*188),h=0;h<f;){if(y[h]===71&&y[h+188]===71&&y[h+2*188]===71)return h;h++}return-1},g.createTrack=function(y,f){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:L[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?f:void 0}};var m=g.prototype;return m.resetInitSegment=function(y,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",h),this._audioTrack=g.createTrack("audio",h),this._id3Track=g.createTrack("id3",h),this._txtTrack=g.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=f,this._duration=h},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,f=this._avcTrack,h=this._id3Track;y&&(y.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,f,h,s){h===void 0&&(h=!1),s===void 0&&(s=!1),h||(this.sampleAes=null);var a,v=this._avcTrack,p=this._audioTrack,E=this._id3Track,D=v.pid,N=v.pesData,W=p.pid,z=E.pid,B=p.pesData,U=E.pesData,X=!1,ne=this.pmtParsed,le=this._pmtId,de=y.length;if(this.remainderData&&(y=Object(O.appendUint8Array)(this.remainderData,y),de=y.length,this.remainderData=null),de<188&&!s)return this.remainderData=y,{audioTrack:p,avcTrack:v,id3Track:E,textTrack:this._txtTrack};var we=Math.max(0,g.syncOffset(y));de-=(de+we)%188,de<y.byteLength&&!s&&(this.remainderData=new Uint8Array(y.buffer,de,y.buffer.byteLength-de));for(var ge=we;ge<de;ge+=188)if(y[ge]===71){var ve=!!(y[ge+1]&64),he=((y[ge+1]&31)<<8)+y[ge+2],fe=(y[ge+3]&48)>>4,oe=void 0;if(fe>1){if(oe=ge+5+y[ge+4],oe===ge+188)continue}else oe=ge+4;switch(he){case D:ve&&(N&&(a=o(N))&&this.parseAVCPES(a,!1),N={data:[],size:0}),N&&(N.data.push(y.subarray(oe,ge+188)),N.size+=ge+188-oe);break;case W:ve&&(B&&(a=o(B))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(y.subarray(oe,ge+188)),B.size+=ge+188-oe);break;case z:ve&&(U&&(a=o(U))&&this.parseID3PES(a),U={data:[],size:0}),U&&(U.data.push(y.subarray(oe,ge+188)),U.size+=ge+188-oe);break;case 0:ve&&(oe+=y[oe]+1),le=this._pmtId=T(y,oe);break;case le:{ve&&(oe+=y[oe]+1);var Z=c(y,oe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);D=Z.avc,D>0&&(v.pid=D),W=Z.audio,W>0&&(p.pid=W,p.isAAC=Z.isAAC),z=Z.id3,z>0&&(E.pid=z),X&&!ne&&(b.logger.log("reparse from beginning"),X=!1,ge=we-188),ne=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=N,p.pesData=B,E.pesData=U;var Ee={audioTrack:p,avcTrack:v,id3Track:E,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(Ee),Ee},m.flush=function(){var y=this.remainderData;this.remainderData=null;var f;return y?f=this.demux(y,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(y){var f=y.audioTrack,h=y.avcTrack,s=y.id3Track,a=h.pesData,v=f.pesData,p=s.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),h.pesData=null):h.pesData=a,v&&(E=o(v))?(f.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),f.pesData=null):(v!=null&&v.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=v),p&&(E=o(p))?(this.parseID3PES(E),s.pesData=null):s.pesData=p},m.demuxSampleAes=function(y,f,h){var s=this.demux(y,h,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,f);return this.decrypt(s,a)},m.decrypt=function(y,f){return new Promise(function(h){var s=y.audioTrack,a=y.avcTrack;s.samples&&s.isAAC?f.decryptAacSamples(s.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){h(y)}):h(y)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){h(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,f){var h=this,s=this._avcTrack,a=this.parseAVCNALu(y.data),v=!1,p=this.avcSample,E,D=!1;y.data=null,p&&a.length&&!s.audFound&&(d(p,s),p=this.avcSample=w(!1,y.pts,y.dts,"")),a.forEach(function(N){switch(N.type){case 1:{E=!0,p||(p=h.avcSample=w(!0,y.pts,y.dts,"")),v&&(p.debug+="NDR "),p.frame=!0;var W=N.data;if(D&&W.length>4){var z=new P.default(W).readSliceType();(z===2||z===4||z===7||z===9)&&(p.key=!0)}break}case 5:E=!0,p||(p=h.avcSample=w(!0,y.pts,y.dts,"")),v&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{E=!0,v&&p&&(p.debug+="SEI ");var B=new P.default(x(N.data));B.readUByte();for(var U=0,X=0,ne=!1,le=0;!ne&&B.bytesAvailable>1;){U=0;do le=B.readUByte(),U+=le;while(le===255);X=0;do le=B.readUByte(),X+=le;while(le===255);if(U===4&&B.bytesAvailable!==0){ne=!0;var de=B.readUByte();if(de===181){var we=B.readUShort();if(we===49){var ge=B.readUInt();if(ge===1195456820){var ve=B.readUByte();if(ve===3){for(var he=B.readUByte(),fe=B.readUByte(),oe=31&he,Z=[he,fe],Ee=0;Ee<oe;Ee++)Z.push(B.readUByte()),Z.push(B.readUByte()),Z.push(B.readUByte());u(h._txtTrack.samples,{type:3,pts:y.pts,bytes:Z})}}}}}else if(U===5&&B.bytesAvailable!==0){if(ne=!0,X>16){for(var Be=[],Ne=0;Ne<16;Ne++)Be.push(B.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&Be.push("-");for(var He=X-16,ze=new Uint8Array(He),Ae=0;Ae<He;Ae++)ze[Ae]=B.readUByte();u(h._txtTrack.samples,{pts:y.pts,payloadType:U,uuid:Be.join(""),userData:Object(F.utf8ArrayToStr)(ze),userDataBytes:ze})}}else if(X<B.bytesAvailable)for(var Ce=0;Ce<X;Ce++)B.readUByte()}break}case 7:if(E=!0,D=!0,v&&p&&(p.debug+="SPS "),!s.sps){var Me=new P.default(N.data),Ue=Me.readSPS();s.width=Ue.width,s.height=Ue.height,s.pixelRatio=Ue.pixelRatio,s.sps=[N.data],s.duration=h._duration;for(var Ie=N.data.subarray(1,4),De="avc1.",Te=0;Te<3;Te++){var rt=Ie[Te].toString(16);rt.length<2&&(rt="0"+rt),De+=rt}s.codec=De}break;case 8:E=!0,v&&p&&(p.debug+="PPS "),s.pps||(s.pps=[N.data]);break;case 9:E=!1,s.audFound=!0,p&&d(p,s),p=h.avcSample=w(!1,y.pts,y.dts,v?"AUD ":"");break;case 12:E=!1;break;default:E=!1,p&&(p.debug+="unknown NAL "+N.type+" ");break}if(p&&E){var Qe=p.units;Qe.push(N)}}),f&&p&&(d(p,s),this.avcSample=null)},m.getLastNalUnit=function(){var y,f=this.avcSample,h;if(!f||f.units.length===0){var s=this._avcTrack.samples;f=s[s.length-1]}if((y=f)!==null&&y!==void 0&&y.units){var a=f.units;h=a[a.length-1]}return h},m.parseAVCNALu=function(y){var f=y.byteLength,h=this._avcTrack,s=h.naluState||0,a=s,v=[],p=0,E,D,N,W=-1,z=0;for(s===-1&&(W=0,z=y[0]&31,s=0,p=1);p<f;){if(E=y[p++],!s){s=E?0:1;continue}if(s===1){s=E?0:2;continue}if(!E)s=3;else if(E===1){if(W>=0){var B={data:y.subarray(W,p-s-1),type:z};v.push(B)}else{var U=this.getLastNalUnit();if(U&&(a&&p<=4-a&&(U.state&&(U.data=U.data.subarray(0,U.data.byteLength-a))),D=p-s-1,D>0)){var X=new Uint8Array(U.data.byteLength+D);X.set(U.data,0),X.set(y.subarray(0,D),U.data.byteLength),U.data=X,U.state=0}}p<f?(N=y[p]&31,W=p,z=N,s=0):s=-1}else s=0}if(W>=0&&s>=0){var ne={data:y.subarray(W,f),type:z,state:s};v.push(ne)}if(v.length===0){var le=this.getLastNalUnit();if(le){var de=new Uint8Array(le.data.byteLength+y.byteLength);de.set(le.data,0),de.set(y,le.data.byteLength),le.data=de}}return h.naluState=s,v},m.parseAACPES=function(y){var f=0,h=this._audioTrack,s=this.aacOverFlow,a=y.data;if(s){this.aacOverFlow=null;var v=s.sample.unit.byteLength,p=Math.min(s.missing,v),E=v-p;s.sample.unit.set(a.subarray(0,p),E),h.samples.push(s.sample),f=s.missing}var D,N;for(D=f,N=a.length;D<N-1&&!H.isHeader(a,D);D++);if(D!==f){var W,z;if(D<N-1?(W="AAC PES did not start with ADTS header,offset:"+D,z=!1):(W="no ADTS header found in AAC PES",z=!0),b.logger.warn("parsing error:"+W),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:W}),z)return}H.initTrackConfig(h,this.observer,a,D,this.audioCodec);var B;if(y.pts!==void 0)B=y.pts;else if(s){var U=H.getFrameDuration(h.samplerate);B=s.sample.pts+U}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;D<N;)if(H.isHeader(a,D)){if(D+5<N){var ne=H.appendFrame(h,a,D,B,X);if(ne)if(ne.missing)this.aacOverFlow=ne;else{D+=ne.length,X++;continue}}break}else D++},m.parseMPEGPES=function(y){var f=y.data,h=f.length,s=0,a=0,v=y.pts;if(v===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<h;)if(M.isHeader(f,a)){var p=M.appendFrame(this._audioTrack,f,a,v,s);if(p)a+=p.length,s++;else break}else a++},m.parseID3PES=function(y){if(y.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},g}();S.minProbeByteLength=188;function w(g,m,l,y){return{key:g,frame:!1,pts:m,dts:l,units:[],debug:y,length:0}}function T(g,m){return(g[m+10]&31)<<8|g[m+11]}function c(g,m,l,y){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(g[m+1]&15)<<8|g[m+2],s=m+3+h-4,a=(g[m+10]&15)<<8|g[m+11];for(m+=12+a;m<s;){var v=(g[m+1]&31)<<8|g[m+2];switch(g[m]){case 207:if(!y){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=v);break;case 21:f.id3===-1&&(f.id3=v);break;case 219:if(!y){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=v);break;case 3:case 4:l?f.audio===-1&&(f.audio=v,f.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((g[m+3]&15)<<8|g[m+4])+5}return f}function o(g){var m=0,l,y,f,h,s,a=g.data;if(!g||g.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}l=a[0];var p=(l[0]<<16)+(l[1]<<8)+l[2];if(p===1){if(y=(l[4]<<8)+l[5],y&&y>g.size-6)return null;var E=l[7];E&192&&(h=(l[9]&14)*536870912+(l[10]&255)*4194304+(l[11]&254)*16384+(l[12]&255)*128+(l[13]&254)/2,E&64?(s=(l[14]&14)*536870912+(l[15]&255)*4194304+(l[16]&254)*16384+(l[17]&255)*128+(l[18]&254)/2,h-s>60*9e4&&(b.logger.warn(Math.round((h-s)/9e4)+"s delta between PTS and DTS, align them"),h=s)):s=h),f=l[8];var D=f+9;if(g.size<=D)return null;g.size-=D;for(var N=new Uint8Array(g.size),W=0,z=a.length;W<z;W++){l=a[W];var B=l.byteLength;if(D)if(D>B){D-=B;continue}else l=l.subarray(D),B-=D,D=0;N.set(l,m),m+=B}return y&&(y-=f+3),{data:N,pts:h,dts:s,len:y}}return null}function d(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var l=m.samples,y=l.length;if(y){var f=l[y-1];g.pts=f.pts,g.dts=f.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&b.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function u(g,m){var l=g.length;if(l>0){if(m.pts>=g[l-1].pts)g.push(m);else for(var y=l-1;y>=0;y--)if(m.pts<g[y].pts){g.splice(y,0,m);break}}else g.push(m)}function x(g){for(var m=g.byteLength,l=[],y=1;y<m-2;)g[y]===0&&g[y+1]===0&&g[y+2]===3?(l.push(y+2),y+=2):y++;if(l.length===0)return g;var f=m-l.length,h=new Uint8Array(f),s=0;for(y=0;y<f;s++,y++)s===l[0]&&(s++,l.shift()),h[y]=g[s];return h}G.default=S},"./src/errors.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"ErrorTypes",function(){return H}),A.d(G,"ErrorDetails",function(){return M});var H;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(H||(H={}));var M;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"Events",function(){return H});var H;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return g});var H=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(H),P=A("./src/loader/playlist-loader.ts"),F=A("./src/loader/key-loader.ts"),I=A("./src/controller/id3-track-controller.ts"),R=A("./src/controller/latency-controller.ts"),O=A("./src/controller/level-controller.ts"),b=A("./src/controller/fragment-tracker.ts"),C=A("./src/controller/stream-controller.ts"),L=A("./src/is-supported.ts"),S=A("./src/utils/logger.ts"),w=A("./src/config.ts"),T=A("./node_modules/eventemitter3/index.js"),c=A.n(T),o=A("./src/events.ts"),d=A("./src/errors.ts");function u(m,l){for(var y=0;y<l.length;y++){var f=l[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function x(m,l,y){return l&&u(m.prototype,l),y&&u(m,y),m}var g=function(){m.isSupported=function(){return Object(L.isSupported)()};function m(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new T.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var f=this.config=Object(w.mergeConfig)(m.DefaultConfig,y);this.userConfig=y,Object(S.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(w.enableStreamingMode)(f);var h=f.abrController,s=f.bufferController,a=f.capLevelController,v=f.fpsController,p=this.abrController=new h(this),E=this.bufferController=new s(this),D=this.capLevelController=new a(this),N=new v(this),W=new P.default(this),z=new F.default(this),B=new I.default(this),U=this.levelController=new O.default(this),X=new b.FragmentTracker(this),ne=this.streamController=new C.default(this,X);D.setStreamController(ne),N.setStreamController(ne);var le=[U,ne];this.networkControllers=le;var de=[W,z,p,E,D,N,B,X];this.audioTrackController=this.createController(f.audioTrackController,null,le),this.createController(f.audioStreamController,X,le),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,le),this.createController(f.subtitleStreamController,X,le),this.createController(f.timelineController,null,de),this.emeController=this.createController(f.emeController,null,de),this.cmcdController=this.createController(f.cmcdController,null,de),this.latencyController=this.createController(R.default,null,de),this.coreComponents=de}var l=m.prototype;return l.createController=function(f,h,s){if(f){var a=h?new f(this,h):new f(this);return s&&s.push(a),a}return null},l.on=function(f,h,s){s===void 0&&(s=this),this._emitter.on(f,h,s)},l.once=function(f,h,s){s===void 0&&(s=this),this._emitter.once(f,h,s)},l.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},l.off=function(f,h,s,a){s===void 0&&(s=this),this._emitter.off(f,h,s,a)},l.listeners=function(f){return this._emitter.listeners(f)},l.emit=function(f,h,s){return this._emitter.emit(f,h,s)},l.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(s){S.logger.error("An internal error happened while handling event "+f+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:d.ErrorTypes.OTHER_ERROR,details:d.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:s})}return!1},l.listenerCount=function(f){return this._emitter.listenerCount(f)},l.destroy=function(){S.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},l.attachMedia=function(f){S.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},l.detachMedia=function(){S.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},l.loadSource=function(f){this.stopLoad();var h=this.media,s=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});S.logger.log("loadSource:"+a),h&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},l.startLoad=function(f){f===void 0&&(f=-1),S.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},l.stopLoad=function(){S.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},l.swapAudioCodec=function(){S.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},l.recoverMediaError=function(){S.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},l.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},x(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){S.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){S.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){S.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){S.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){S.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var h=!!f;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(S.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,h=this.config.minAutoBitrate;if(!f)return 0;for(var s=f.length,a=0;a<s;a++)if(f[a].maxBitrate>h)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,h=this.autoLevelCapping,s;return h===-1&&f&&f.length?s=f.length-1:s=h,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var h=this.audioTrackController;h&&(h.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return d.ErrorTypes}},{key:"ErrorDetails",get:function(){return d.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:w.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"isSupported",function(){return P}),A.d(G,"changeTypeSupported",function(){return F});var H=A("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var I=Object(H.getMediaSource)();if(!I)return!1;var R=M(),O=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!O&&!!b}function F(){var I,R=M();return typeof(R==null||((I=R.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return S}),A.d(G,"LoadError",function(){return T});var H=A("./src/polyfills/number.ts"),M=A("./src/errors.ts");function P(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,b(c,o)}function F(c){var o=typeof Map=="function"?new Map:void 0;return F=function(u){if(u===null||!O(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,x)}function x(){return I(u,arguments,C(this).constructor)}return x.prototype=Object.create(u.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),b(x,u)},F(c)}function I(c,o,d){return R()?I=Reflect.construct:I=function(x,g,m){var l=[null];l.push.apply(l,g);var y=Function.bind.apply(x,l),f=new y;return m&&b(f,m.prototype),f},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(c){return!1}}function O(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function b(c,o){return b=Object.setPrototypeOf||function(u,x){return u.__proto__=x,u},b(c,o)}function C(c){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},C(c)}var L=Math.pow(2,17),S=function(){function c(d){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=d}var o=c.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,x){var g=this,m=u.url;if(!m)return Promise.reject(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var l=this.config,y=l.fLoader,f=l.loader;return new Promise(function(h,s){g.loader&&g.loader.destroy();var a=g.loader=u.loader=y?new y(l):new f(l),v=w(u),p={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:L};u.stats=a.stats,a.load(v,p,{onSuccess:function(D,N,W,z){g.resetLoader(u,a),h({frag:u,part:null,payload:D.data,networkDetails:z})},onError:function(D,N,W){g.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:D,networkDetails:W}))},onAbort:function(D,N,W){g.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:W}))},onTimeout:function(D,N,W){g.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:W}))},onProgress:function(D,N,W,z){x&&x({frag:u,part:null,payload:W,networkDetails:z})}})})},o.loadPart=function(u,x,g){var m=this;this.abort();var l=this.config,y=l.fLoader,f=l.loader;return new Promise(function(h,s){m.loader&&m.loader.destroy();var a=m.loader=u.loader=y?new y(l):new f(l),v=w(u,x),p={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:L};x.stats=a.stats,a.load(v,p,{onSuccess:function(D,N,W,z){m.resetLoader(u,a),m.updateStatsFromPart(u,x);var B={frag:u,part:x,payload:D.data,networkDetails:z};g(B),h(B)},onError:function(D,N,W){m.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:x,response:D,networkDetails:W}))},onAbort:function(D,N,W){u.stats.aborted=x.stats.aborted,m.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:x,networkDetails:W}))},onTimeout:function(D,N,W){m.resetLoader(u,a),s(new T({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:x,networkDetails:W}))}})})},o.updateStatsFromPart=function(u,x){var g=u.stats,m=x.stats,l=m.total;if(g.loaded+=m.loaded,l){var y=Math.round(u.duration/x.duration),f=Math.min(Math.round(g.loaded/l),y),h=y-f,s=h*Math.round(g.loaded/f);g.total=g.loaded+s}else g.total=Math.max(g.loaded,g.total);var a=g.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(u,x){u.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},c}();function w(c,o){o===void 0&&(o=null);var d=o||c,u={frag:c,part:o,responseType:"arraybuffer",url:d.url,headers:{},rangeStart:0,rangeEnd:0},x=d.byteRangeStartOffset,g=d.byteRangeEndOffset;return Object(H.isFiniteNumber)(x)&&Object(H.isFiniteNumber)(g)&&(u.rangeStart=x,u.rangeEnd=g),u}var T=function(c){P(o,c);function o(d){for(var u,x=arguments.length,g=new Array(x>1?x-1:0),m=1;m<x;m++)g[m-1]=arguments[m];return u=c.call.apply(c,[this].concat(g))||this,u.data=void 0,u.data=d,u}return o}(F(Error))},"./src/loader/fragment.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"ElementaryStreamTypes",function(){return S}),A.d(G,"BaseSegment",function(){return w}),A.d(G,"Fragment",function(){return T}),A.d(G,"Part",function(){return c});var H=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),F=A("./src/utils/logger.ts"),I=A("./src/loader/level-key.ts"),R=A("./src/loader/load-stats.ts");function O(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,b(o,d)}function b(o,d){return b=Object.setPrototypeOf||function(x,g){return x.__proto__=g,x},b(o,d)}function C(o,d){for(var u=0;u<d.length;u++){var x=d[u];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function L(o,d,u){return d&&C(o.prototype,d),u&&C(o,u),o}var S;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(S||(S={}));var w=function(){function o(u){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[S.AUDIO]=null,x[S.VIDEO]=null,x[S.AUDIOVIDEO]=null,x),this.baseurl=u}var d=o.prototype;return d.setByteRange=function(x,g){var m=x.split("@",2),l=[];m.length===1?l[0]=g?g.byteRangeEndOffset:0:l[0]=parseInt(m[1]),l[1]=parseInt(m[0])+l[0],this._byteRange=l},L(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),o}(),T=function(o){O(d,o);function d(x,g){var m;return m=o.call(this,g)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new R.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=x,m}var u=d.prototype;return u.createInitializationVector=function(g){for(var m=new Uint8Array(16),l=12;l<16;l++)m[l]=g>>8*(15-l)&255;return m},u.setDecryptDataFromLevelKey=function(g,m){var l=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(l=I.LevelKey.fromURI(g.uri),l.method=g.method,l.iv=this.createInitializationVector(m),l.keyFormat="identity"),l},u.setElementaryStreamInfo=function(g,m,l,y,f,h){h===void 0&&(h=!1);var s=this.elementaryStreams,a=s[g];if(!a){s[g]={startPTS:m,endPTS:l,startDTS:y,endDTS:f,partial:h};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,l),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,f)},u.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[S.AUDIO]=null,g[S.VIDEO]=null,g[S.AUDIOVIDEO]=null},L(d,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var g=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),d}(w),c=function(o){O(d,o);function d(u,x,g,m,l){var y;y=o.call(this,g)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new R.LoadStats,y.duration=u.decimalFloatingPoint("DURATION"),y.gap=u.bool("GAP"),y.independent=u.bool("INDEPENDENT"),y.relurl=u.enumeratedString("URI"),y.fragment=x,y.index=m;var f=u.enumeratedString("BYTERANGE");return f&&y.setByteRange(f,l),l&&(y.fragOffset=l.fragOffset+l.duration),y}return L(d,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),d}(w)},"./src/loader/key-loader.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return F});var H=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),F=function(){function I(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var R=I.prototype;return R._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var C=this.loaders[b];C&&C.destroy()}this.loaders={}},R.onKeyLoading=function(b,C){var L=C.frag,S=L.type,w=this.loaders[S];if(!L.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var T=L.decryptdata.uri;if(T!==this.decrypturl||this.decryptkey===null){var c=this.hls.config;if(w&&(P.logger.warn("abort previous key loader for type:"+S),w.abort()),!T){P.logger.warn("key uri is falsy");return}var o=c.loader,d=L.loader=this.loaders[S]=new o(c);this.decrypturl=T,this.decryptkey=null;var u={url:T,frag:L,responseType:"arraybuffer"},x={timeout:c.fragLoadingTimeOut,maxRetry:0,retryDelay:c.fragLoadingRetryDelay,maxRetryDelay:c.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};d.load(u,x,g)}else this.decryptkey&&(L.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:L}))},R.loadsuccess=function(b,C,L){var S=L.frag;if(!S.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=S.decryptdata.key=new Uint8Array(b.data),S.loader=null,delete this.loaders[S.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:S})},R.loaderror=function(b,C){var L=C.frag,S=L.loader;S&&S.abort(),delete this.loaders[L.type],this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:L,response:b})},R.loadtimeout=function(b,C){var L=C.frag,S=L.loader;S&&S.abort(),delete this.loaders[L.type],this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:L})},I}()},"./src/loader/level-details.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"LevelDetails",function(){return I});var H=A("./src/polyfills/number.ts");function M(R,O){for(var b=0;b<O.length;b++){var C=O[b];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(R,C.key,C)}}function P(R,O,b){return O&&M(R.prototype,O),b&&M(R,b),R}var F=10,I=function(){function R(b){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=b}var O=R.prototype;return O.reloaded=function(C){if(!C){this.advanced=!0,this.updated=!0;return}var L=this.lastPartSn-C.lastPartSn,S=this.lastPartIndex-C.lastPartIndex;this.updated=this.endSN!==C.endSN||!!S||!!L,this.advanced=this.endSN>C.endSN||L>0||L===0&&S>0,this.updated||this.advanced?this.misses=Math.floor(C.misses*.6):this.misses=C.misses+1,this.availabilityDelay=C.availabilityDelay},P(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||F}},{key:"drift",get:function(){var C=this.driftEndTime-this.driftStartTime;if(C>0){var L=this.driftEnd-this.driftStart;return L*1e3/C}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var C;return(C=this.fragments)!==null&&C!==void 0&&C.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 C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"LevelKey",function(){return I});var H=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(H);function P(R,O){for(var b=0;b<O.length;b++){var C=O[b];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(R,C.key,C)}}function F(R,O,b){return O&&P(R.prototype,O),b&&P(R,b),R}var I=function(){R.fromURL=function(b,C){return new R(b,C)},R.fromURI=function(b){return new R(b)};function R(O,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(H.buildAbsoluteURL)(O,b,{alwaysNormalize:!0}):this._uri=O}return F(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"LoadStats",function(){return H});var H=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,G,A){"use strict";A.r(G),A.d(G,"default",function(){return d});var H=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),F=A("./src/loader/fragment.ts"),I=A("./src/loader/level-details.ts"),R=A("./src/loader/level-key.ts"),O=A("./src/utils/attr-list.ts"),b=A("./src/utils/logger.ts"),C=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,S=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),T=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("|")),c=/\.(mp4|m4s|m4v|m4a)$/i;function o(l){var y,f;return c.test((y=(f=M.parseURL(l))===null||f===void 0?void 0:f.path)!=null?y:"")}var d=function(){function l(){}return l.findGroup=function(f,h){for(var s=0;s<f.length;s++){var a=f[s];if(a.id===h)return a}},l.convertAVC1ToAVCOTI=function(f){var h=f.split(".");if(h.length>2){var s=h.shift()+".";return s+=parseInt(h.shift()).toString(16),s+=("000"+parseInt(h.shift()).toString(16)).substr(-4),s}return f},l.resolve=function(f,h){return M.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},l.parseMasterPlaylist=function(f,h){var s=[],a={},v=!1;L.lastIndex=0;for(var p;(p=L.exec(f))!=null;)if(p[1]){var E=new O.AttrList(p[1]),D={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:l.resolve(p[2],h)},N=E.decimalResolution("RESOLUTION");N&&(D.width=N.width,D.height=N.height),u((E.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=l.convertAVC1ToAVCOTI(D.videoCodec)),s.push(D)}else if(p[3]){var W=new O.AttrList(p[3]);W["DATA-ID"]&&(v=!0,a[W["DATA-ID"]]=W)}return{levels:s,sessionData:v?a:null}},l.parseMasterPlaylistMedia=function(f,h,s,a){a===void 0&&(a=[]);var v,p=[],E=0;for(S.lastIndex=0;(v=S.exec(f))!==null;){var D=new O.AttrList(v[1]);if(D.TYPE===s){var N={attrs:D,bitrate:0,id:E++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:s,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?l.resolve(D.URI,h):""};if(a.length){var W=l.findGroup(a,N.groupId)||a[0];x(N,W,"audioCodec"),x(N,W,"textCodec")}p.push(N)}}return p},l.parseLevelPlaylist=function(f,h,s,a,v){var p=new I.LevelDetails(h),E=p.fragments,D=null,N=0,W=0,z=0,B=0,U=null,X=new F.Fragment(a,h),ne,le,de,we=-1,ge=!1;for(w.lastIndex=0,p.m3u8=f;(ne=w.exec(f))!==null;){ge&&(ge=!1,X=new F.Fragment(a,h),X.start=z,X.sn=N,X.cc=B,X.level=s,D&&(X.initSegment=D,X.rawProgramDateTime=D.rawProgramDateTime));var ve=ne[1];if(ve){X.duration=parseFloat(ve);var he=(" "+ne[2]).slice(1);X.title=he||null,X.tagList.push(he?["INF",ve,he]:["INF",ve])}else if(ne[3])Object(H.isFiniteNumber)(X.duration)&&(X.start=z,de&&(X.levelkey=de),X.sn=N,X.level=s,X.cc=B,X.urlId=v,E.push(X),X.relurl=(" "+ne[3]).slice(1),m(X,U),U=X,z+=X.duration,N++,W=0,ge=!0);else if(ne[4]){var fe=(" "+ne[4]).slice(1);U?X.setByteRange(fe,U):X.setByteRange(fe)}else if(ne[5])X.rawProgramDateTime=(" "+ne[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),we===-1&&(we=E.length);else{if(ne=ne[0].match(T),!ne){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<ne.length&&!(typeof ne[le]!="undefined");le++);var oe=(" "+ne[le]).slice(1),Z=(" "+ne[le+1]).slice(1),Ee=ne[le+2]?(" "+ne[le+2]).slice(1):"";switch(oe){case"PLAYLIST-TYPE":p.type=Z.toUpperCase();break;case"MEDIA-SEQUENCE":N=p.startSN=parseInt(Z);break;case"SKIP":{var Be=new O.AttrList(Z),Ne=Be.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(Ne)){p.skippedSegments=Ne;for(var He=Ne;He--;)E.unshift(null);N+=Ne}var ze=Be.enumeratedString("RECENTLY-REMOVED-DATERANGES");ze&&(p.recentlyRemovedDateranges=ze.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(Z);break;case"VERSION":p.version=parseInt(Z);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(Z||Ee)&&X.tagList.push(Ee?[Z,Ee]:[Z]);break;case"DIS":B++;case"GAP":X.tagList.push([oe]);break;case"BITRATE":X.tagList.push([oe,Z]);break;case"DISCONTINUITY-SEQ":B=parseInt(Z);break;case"KEY":{var Ae,Ce=new O.AttrList(Z),Me=Ce.enumeratedString("METHOD"),Ue=Ce.URI,Ie=Ce.hexadecimalInteger("IV"),De=Ce.enumeratedString("KEYFORMATVERSIONS"),Te=Ce.enumeratedString("KEYID"),rt=(Ae=Ce.enumeratedString("KEYFORMAT"))!=null?Ae:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(rt)>-1){b.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;Me&&(de=R.LevelKey.fromURL(h,Ue),Ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(de.method=Me,de.keyFormat=rt,Te&&(de.keyID=Te),De&&(de.keyFormatVersions=De),de.iv=Ie));break}case"START":{var Ve=new O.AttrList(Z),Xe=Ve.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Xe)&&(p.startTimeOffset=Xe);break}case"MAP":{var ut=new O.AttrList(Z);X.relurl=ut.URI,ut.BYTERANGE&&X.setByteRange(ut.BYTERANGE),X.level=s,X.sn="initSegment",de&&(X.levelkey=de),X.initSegment=null,D=X,ge=!0;break}case"SERVER-CONTROL":{var tt=new O.AttrList(Z);p.canBlockReload=tt.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=tt.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&tt.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=tt.optionalFloat("PART-HOLD-BACK",0),p.holdBack=tt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var qe=new O.AttrList(Z);p.partTarget=qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var be=p.partList;be||(be=p.partList=[]);var nt=W>0?be[be.length-1]:void 0,Ye=W++,xe=new F.Part(new O.AttrList(Z),X,h,Ye,nt);be.push(xe),X.duration+=xe.duration;break}case"PRELOAD-HINT":{var Re=new O.AttrList(Z);p.preloadHint=Re;break}case"RENDITION-REPORT":{var ue=new O.AttrList(Z);p.renditionReports=p.renditionReports||[],p.renditionReports.push(ue);break}default:b.logger.warn("line parsed but not handled: "+ne);break}}}U&&!U.relurl?(E.pop(),z-=U.duration,p.partList&&(p.fragmentHint=U)):p.partList&&(m(X,U),X.cc=B,p.fragmentHint=X);var ie=E.length,se=E[0],Y=E[ie-1];if(z+=p.skippedSegments*p.targetduration,z>0&&ie&&Y){p.averagetargetduration=z/ie;var $=Y.sn;p.endSN=$!=="initSegment"?$:0,se&&(p.startCC=se.cc,se.initSegment||p.fragments.every(function(J){return J.relurl&&o(J.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new F.Fragment(a,h),X.relurl=Y.relurl,X.level=s,X.sn="initSegment",se.initSegment=X,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(z+=p.fragmentHint.duration),p.totalduration=z,p.endCC=B,we>0&&g(E,we),p},l}();function u(l,y){["video","audio","text"].forEach(function(f){var h=l.filter(function(a){return Object(C.isCodecType)(a,f)});if(h.length){var s=h.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=s.length>0?s[0]:h[0],l=l.filter(function(a){return h.indexOf(a)===-1})}}),y.unknownCodecs=l}function x(l,y,f){var h=y[f];h&&(l[f]=h)}function g(l,y){for(var f=l[y],h=y;h--;){var s=l[h];if(!s)return;s.programDateTime=f.programDateTime-s.duration*1e3,f=s}}function m(l,y){l.rawProgramDateTime?l.programDateTime=Date.parse(l.rawProgramDateTime):y!=null&&y.programDateTime&&(l.programDateTime=y.endProgramDateTime),Object(H.isFiniteNumber)(l.programDateTime)||(l.programDateTime=null,l.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),F=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/m3u8-parser.ts"),O=A("./src/types/loader.ts"),b=A("./src/utils/attr-list.ts");function C(w){var T=w.type;switch(T){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function L(w,T){var c=w.url;return(c===void 0||c.indexOf("data:")===0)&&(c=T.url),c}var S=function(){function w(c){this.hls=void 0,this.loaders=Object.create(null),this.hls=c,this.registerListeners()}var T=w.prototype;return T.registerListeners=function(){var o=this.hls;o.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.createInternalLoader=function(o){var d=this.hls.config,u=d.pLoader,x=d.loader,g=u||x,m=new g(d);return o.loader=m,this.loaders[o.type]=m,m},T.getInternalLoader=function(o){return this.loaders[o.type]},T.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},T.destroyInternalLoaders=function(){for(var o in this.loaders){var d=this.loaders[o];d&&d.destroy(),this.resetInternalLoader(o)}},T.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},T.onManifestLoading=function(o,d){var u=d.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},T.onLevelLoading=function(o,d){var u=d.id,x=d.level,g=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:null,level:x,responseType:"text",type:O.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},T.onAudioTrackLoading=function(o,d){var u=d.id,x=d.groupId,g=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:x,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},T.onSubtitleTrackLoading=function(o,d){var u=d.id,x=d.groupId,g=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:x,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},T.load=function(o){var d,u=this.hls.config,x=this.getInternalLoader(o);if(x){var g=x.context;if(g&&g.url===o.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),x.abort()}var m,l,y,f;switch(o.type){case O.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,l=u.manifestLoadingTimeOut,y=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:m=0,l=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,l=u.levelLoadingTimeOut,y=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(o),(d=o.deliveryDirectives)!==null&&d!==void 0&&d.part){var h;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?h=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?h=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(h=this.hls.subtitleTracks[o.id].details),h){var s=h.partTarget,a=h.targetduration;s&&a&&(l=Math.min(Math.max(s*3,a*.8)*1e3,l))}}var v={timeout:l,maxRetry:m,retryDelay:y,maxRetryDelay:f,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(o,v,p)},T.loadsuccess=function(o,d,u,x){if(x===void 0&&(x=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,d,u,x);return}this.resetInternalLoader(u.type);var g=o.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",x);return}d.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,d,u,x):this.handleMasterPlaylist(o,d,u,x)},T.loaderror=function(o,d,u){u===void 0&&(u=null),this.handleNetworkError(d,u,!1,o)},T.loadtimeout=function(o,d,u){u===void 0&&(u=null),this.handleNetworkError(d,u,!0)},T.handleMasterPlaylist=function(o,d,u,x){var g=this.hls,m=o.data,l=L(o,u),y=R.default.parseMasterPlaylist(m,l),f=y.levels,h=y.sessionData;if(!f.length){this.handleManifestParsingError(o,u,"no level found in manifest",x);return}var s=f.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),a=f.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),v=R.default.parseMasterPlaylistMedia(m,l,"AUDIO",s),p=R.default.parseMasterPlaylistMedia(m,l,"SUBTITLES",a),E=R.default.parseMasterPlaylistMedia(m,l,"CLOSED-CAPTIONS");if(v.length){var D=v.some(function(N){return!N.url});!D&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}g.trigger(M.Events.MANIFEST_LOADED,{levels:f,audioTracks:v,subtitles:p,captions:E,url:l,stats:d,networkDetails:x,sessionData:h})},T.handleTrackOrLevelPlaylist=function(o,d,u,x){var g=this.hls,m=u.id,l=u.level,y=u.type,f=L(o,u),h=Object(H.isFiniteNumber)(m)?m:0,s=Object(H.isFiniteNumber)(l)?l:h,a=C(u),v=R.default.parseLevelPlaylist(o.data,f,s,a,h);if(!v.fragments.length){g.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(y===O.PlaylistContextType.MANIFEST){var p={attrs:new b.AttrList({}),bitrate:0,details:v,name:"",url:f};g.trigger(M.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:f,stats:d,networkDetails:x,sessionData:null})}if(d.parsing.end=performance.now(),v.needSidxRanges){var E,D=(E=v.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:D,isSidxRequest:!0,type:y,level:l,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=v,this.handlePlaylistLoaded(o,d,u,x)},T.handleSidxRequest=function(o,d){var u=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var x=u.references,g=d.levelDetails;x.forEach(function(m,l){var y=m.info,f=g.fragments[l];f.byteRange.length===0&&f.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},T.handleManifestParsingError=function(o,d,u,x){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:d.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:d,networkDetails:x})},T.handleNetworkError=function(o,d,u,x){u===void 0&&(u=!1),F.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var g=P.ErrorDetails.UNKNOWN,m=!1,l=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:g=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case O.PlaylistContextType.LEVEL:g=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.AUDIO_TRACK:g=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:g=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}l&&this.resetInternalLoader(o.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:o.url,loader:l,context:o,networkDetails:d};x&&(y.response=x),this.hls.trigger(M.Events.ERROR,y)},T.handlePlaylistLoaded=function(o,d,u,x){var g=u.type,m=u.level,l=u.id,y=u.groupId,f=u.loader,h=u.levelDetails,s=u.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",x);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(g){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:h,level:m||0,id:l||0,stats:d,networkDetails:x,deliveryDirectives:s});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:h,id:l||0,groupId:y||"",stats:d,networkDetails:x,deliveryDirectives:s});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:h,id:l||0,groupId:y||"",stats:d,networkDetails:x,deliveryDirectives:s});break}},w}();G.default=S},"./src/polyfills/number.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"isFiniteNumber",function(){return H}),A.d(G,"MAX_SAFE_INTEGER",function(){return M});var H=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,G,A){"use strict";A.r(G);var H=function(){function M(){}return M.getSilentFrame=function(F,I){switch(F){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},M}();G.default=H},"./src/remux/mp4-generator.ts":function(q,G,A){"use strict";A.r(G);var H=Math.pow(2,32)-1,M=function(){function P(){}return P.init=function(){P.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 P.types)P.types.hasOwnProperty(I)&&(P.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]),O=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]);P.HDLR_TYPES={video:R,audio:O};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=C,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var L=new Uint8Array([105,115,111,109]),S=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,L,w,L,S),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,b))},P.box=function(I){for(var R=8,O=arguments.length,b=new Array(O>1?O-1:0),C=1;C<O;C++)b[C-1]=arguments[C];for(var L=b.length,S=L;L--;)R+=b[L].byteLength;var w=new Uint8Array(R);for(w[0]=R>>24&255,w[1]=R>>16&255,w[2]=R>>8&255,w[3]=R&255,w.set(I,4),L=0,R=8;L<S;L++)w.set(b[L],R),R+=b[L].byteLength;return w},P.hdlr=function(I){return P.box(P.types.hdlr,P.HDLR_TYPES[I])},P.mdat=function(I){return P.box(P.types.mdat,I)},P.mdhd=function(I,R){R*=I;var O=Math.floor(R/(H+1)),b=Math.floor(R%(H+1));return P.box(P.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,O>>24,O>>16&255,O>>8&255,O&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},P.mdia=function(I){return P.box(P.types.mdia,P.mdhd(I.timescale,I.duration),P.hdlr(I.type),P.minf(I))},P.mfhd=function(I){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},P.minf=function(I){return I.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(I)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(I))},P.moof=function(I,R,O){return P.box(P.types.moof,P.mfhd(I),P.traf(O,R))},P.moov=function(I){for(var R=I.length,O=[];R--;)O[R]=P.trak(I[R]);return P.box.apply(null,[P.types.moov,P.mvhd(I[0].timescale,I[0].duration)].concat(O).concat(P.mvex(I)))},P.mvex=function(I){for(var R=I.length,O=[];R--;)O[R]=P.trex(I[R]);return P.box.apply(null,[P.types.mvex].concat(O))},P.mvhd=function(I,R){R*=I;var O=Math.floor(R/(H+1)),b=Math.floor(R%(H+1)),C=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,O>>24,O>>16&255,O>>8&255,O&255,b>>24,b>>16&255,b>>8&255,b&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 P.box(P.types.mvhd,C)},P.sdtp=function(I){var R=I.samples||[],O=new Uint8Array(4+R.length),b,C;for(b=0;b<R.length;b++)C=R[b].flags,O[b+4]=C.dependsOn<<4|C.isDependedOn<<2|C.hasRedundancy;return P.box(P.types.sdtp,O)},P.stbl=function(I){return P.box(P.types.stbl,P.stsd(I),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(I){var R=[],O=[],b,C,L;for(b=0;b<I.sps.length;b++)C=I.sps[b],L=C.byteLength,R.push(L>>>8&255),R.push(L&255),R=R.concat(Array.prototype.slice.call(C));for(b=0;b<I.pps.length;b++)C=I.pps[b],L=C.byteLength,O.push(L>>>8&255),O.push(L&255),O=O.concat(Array.prototype.slice.call(C));var S=P.box(P.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|I.sps.length].concat(R).concat([I.pps.length]).concat(O))),w=I.width,T=I.height,c=I.pixelRatio[0],o=I.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&255,T>>8&255,T&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]),S,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.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]))},P.mp4a=function(I){var R=I.samplerate;return P.box(P.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]),P.box(P.types.esds,P.esds(I)))},P.mp3=function(I){var R=I.samplerate;return P.box(P.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]))},P.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(I)):P.box(P.types.stsd,P.STSD,P.mp4a(I)):P.box(P.types.stsd,P.STSD,P.avc1(I))},P.tkhd=function(I){var R=I.id,O=I.duration*I.timescale,b=I.width,C=I.height,L=Math.floor(O/(H+1)),S=Math.floor(O%(H+1));return P.box(P.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,S>>24,S>>16&255,S>>8&255,S&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,b>>8&255,b&255,0,0,C>>8&255,C&255,0,0]))},P.traf=function(I,R){var O=P.sdtp(I),b=I.id,C=Math.floor(R/(H+1)),L=Math.floor(R%(H+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,L>>24,L>>16&255,L>>8&255,L&255])),P.trun(I,O.length+16+20+8+16+8+8),O)},P.trak=function(I){return I.duration=I.duration||4294967295,P.box(P.types.trak,P.tkhd(I),P.mdia(I))},P.trex=function(I){var R=I.id;return P.box(P.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]))},P.trun=function(I,R){var O=I.samples||[],b=O.length,C=12+16*b,L=new Uint8Array(C),S,w,T,c,o,d;for(R+=8+C,L.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),S=0;S<b;S++)w=O[S],T=w.duration,c=w.size,o=w.flags,d=w.cts,L.set([T>>>24&255,T>>>16&255,T>>>8&255,T&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*S);return P.box(P.types.trun,L)},P.initSegment=function(I){P.types||P.init();var R=P.moov(I),O=new Uint8Array(P.FTYP.byteLength+R.byteLength);return O.set(P.FTYP),O.set(R,P.FTYP.byteLength),O},P}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,G.default=M},"./src/remux/mp4-remuxer.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return d}),A.d(G,"normalizePts",function(){return u});var H=A("./src/polyfills/number.ts"),M=A("./src/remux/aac-helper.ts"),P=A("./src/remux/mp4-generator.ts"),F=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),O=A("./src/types/loader.ts"),b=A("./src/utils/timescale-conversion.ts");function C(){return C=Object.assign||function(l){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(l[h]=f[h])}return l},C.apply(this,arguments)}var L=10*1e3,S=1024,w=1152,T=null,c=null,o=!1,d=function(){function l(f,h,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=h,this.typeSupported=s,this.ISGenerated=!1,T===null){var v=navigator.userAgent||"",p=v.match(/Chrome\/(\d+)/i);T=p?parseInt(p[1]):0}if(c===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);c=E?parseInt(E[1]):0}o=!!T&&T<75||!!c&&c<600}var y=l.prototype;return y.destroy=function(){},y.resetTimeStamp=function(h){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},y.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(h){var s=!1,a=h.reduce(function(v,p){var E=p.pts-v;return E<-4294967296?(s=!0,u(v,p.pts)):E>0?v:p.pts},h[0].pts);return s&&R.logger.debug("PTS rollover detected"),a},y.remux=function(h,s,a,v,p,E,D,N){var W,z,B,U,X,ne,le=p,de=p,we=h.pid>-1,ge=s.pid>-1,ve=s.samples.length,he=h.samples.length>0,fe=ve>1,oe=(!we||he)&&(!ge||fe)||this.ISGenerated||D;if(oe){this.ISGenerated||(B=this.generateIS(h,s,p));var Z=this.isVideoContiguous,Ee=-1;if(fe&&(Ee=x(s.samples),!Z&&this.config.forceKeyFrameOnDiscontinuity))if(ne=!0,Ee>0){R.logger.warn("[mp4-remuxer]: Dropped "+Ee+" out of "+ve+" video samples due to a missing keyframe");var Be=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(Ee),s.dropped+=Ee,de+=(s.samples[0].pts-Be)/(s.timescale||9e4)}else Ee===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+ve+" video samples"),ne=!1);if(this.ISGenerated){if(he&&fe){var Ne=this.getVideoStartPts(s.samples),He=u(h.samples[0].pts,Ne)-Ne,ze=He/s.inputTimeScale;le+=Math.max(0,ze),de+=Math.max(0,-ze)}if(he){if(h.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(h,s,p)),z=this.remuxAudio(h,le,this.isAudioContiguous,E,ge||fe||N===O.PlaylistLevelType.AUDIO?de:void 0),fe){var Ae=z?z.endPTS-z.startPTS:0;s.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(h,s,p)),W=this.remuxVideo(s,de,Z,Ae)}}else fe&&(W=this.remuxVideo(s,de,Z,0));W&&(W.firstKeyFrame=Ee,W.independent=Ee!==-1)}}return this.ISGenerated&&(a.samples.length&&(X=this.remuxID3(a,p)),v.samples.length&&(U=this.remuxText(v,p))),{audio:z,video:W,initSegment:B,independent:ne,text:U,id3:X}},y.generateIS=function(h,s,a){var v=h.samples,p=s.samples,E=this.typeSupported,D={},N=!Object(H.isFiniteNumber)(this._initPTS),W="audio/mp4",z,B,U;if(N&&(z=B=Infinity),h.config&&v.length&&(h.timescale=h.samplerate,h.isAAC||(E.mpeg?(W="audio/mpeg",h.codec=""):E.mp3&&(h.codec="mp3")),D.audio={id:"audio",container:W,codec:h.codec,initSegment:!h.isAAC&&E.mpeg?new Uint8Array(0):P.default.initSegment([h]),metadata:{channelCount:h.channelCount}},N&&(U=h.inputTimeScale,z=B=v[0].pts-Math.round(U*a))),s.sps&&s.pps&&p.length&&(s.timescale=s.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:P.default.initSegment([s]),metadata:{width:s.width,height:s.height}},N)){U=s.inputTimeScale;var X=this.getVideoStartPts(p),ne=Math.round(U*a);B=Math.min(B,u(p[0].dts,X)-ne),z=Math.min(z,X-ne)}if(Object.keys(D).length)return this.ISGenerated=!0,N&&(this._initPTS=z,this._initDTS=B),{tracks:D,initPTS:z,timescale:U}},y.remuxVideo=function(h,s,a,v){var p=h.inputTimeScale,E=h.samples,D=[],N=E.length,W=this._initPTS,z=this.nextAvcDts,B=8,U,X,ne,le=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,we=0,ge=!1;if(!a||z===null){var ve=s*p,he=E[0].pts-u(E[0].dts,E[0].pts);z=ve-he}for(var fe=0;fe<N;fe++){var oe=E[fe];if(oe.pts=u(oe.pts-W,z),oe.dts=u(oe.dts-W,z),oe.dts>oe.pts){var Z=9e4*.2;we=Math.max(Math.min(we,oe.pts-oe.dts),-1*Z)}oe.dts<E[fe>0?fe-1:fe].dts&&(ge=!0)}ge&&E.sort(function(Dt,Ge){var lt=Dt.dts-Ge.dts,Ct=Dt.pts-Ge.pts;return lt||Ct}),X=E[0].dts,ne=E[E.length-1].dts;var Ee=Math.round((ne-X)/(N-1));if(we<0){if(we<Ee*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-Ee,!0)+" ms");for(var Be=we,Ne=0;Ne<N;Ne++)E[Ne].dts=Be=Math.max(Be,E[Ne].pts-Ee),E[Ne].pts=Math.max(Be,E[Ne].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(we,!0)+" ms to overcome this issue");for(var He=0;He<N;He++)E[He].dts=E[He].dts+we}X=E[0].dts}if(a){var ze=X-z,Ae=ze>Ee,Ce=ze<-1;if(Ae||Ce){Ae?R.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(ze,!0)+" ms ("+ze+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-ze,!0)+" ms ("+ze+"dts) overlapping between fragments detected"),X=z;var Me=E[0].pts-ze;E[0].dts=X,E[0].pts=Me,R.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(Me,!0)+"/"+Object(b.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(ze,!0)+" ms")}}o&&(X=Math.max(0,X));for(var Ue=0,Ie=0,De=0;De<N;De++){for(var Te=E[De],rt=Te.units,Qe=rt.length,Ve=0,Xe=0;Xe<Qe;Xe++)Ve+=rt[Xe].data.length;Ie+=Ve,Ue+=Qe,Te.length=Ve,Te.dts=Math.max(Te.dts,X),Te.pts=Math.max(Te.pts,Te.dts,0),le=Math.min(Te.pts,le),de=Math.max(Te.pts,de)}ne=E[N-1].dts;var ut=Ie+4*Ue+8,tt;try{tt=new Uint8Array(ut)}catch(Dt){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ut,reason:"fail allocating video mdat "+ut});return}var qe=new DataView(tt.buffer);qe.setUint32(0,ut),tt.set(P.default.types.mdat,4);for(var be=0;be<N;be++){for(var nt=E[be],Ye=nt.units,xe=0,Re=0,ue=Ye.length;Re<ue;Re++){var ie=Ye[Re],se=ie.data,Y=ie.data.byteLength;qe.setUint32(B,Y),B+=4,tt.set(se,B),B+=Y,xe+=4+Y}if(be<N-1)U=E[be+1].dts-nt.dts;else{var $=this.config,J=nt.dts-E[be>0?be-1:be].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var ee=Math.floor($.maxBufferHole*p),re=(v?le+v*p:this.nextAudioPts)-nt.pts;re>ee?(U=re-J,U<0&&(U=J),R.logger.log("[mp4-remuxer]: It is approximately "+re/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=J}else U=J}var ye=Math.round(nt.pts-nt.dts);D.push(new g(nt.key,U,xe,ye))}if(D.length&&T&&T<70){var _e=D[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(U!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=ne+U,this.isVideoContiguous=!0;var je=P.default.moof(h.sequenceNumber++,X,C({},h,{samples:D})),Ke="video",st={data1:je,data2:tt,startPTS:le/p,endPTS:(de+U)/p,startDTS:X/p,endDTS:z/p,type:Ke,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(tt.length,"MDAT length must not be zero"),st},y.remuxAudio=function(h,s,a,v,p){var E=h.inputTimeScale,D=h.samplerate?h.samplerate:E,N=E/D,W=h.isAAC?S:w,z=W*N,B=this._initPTS,U=!h.isAAC&&this.typeSupported.mpeg,X=[],ne=h.samples,le=U?0:8,de=this.nextAudioPts||-1,we=s*E;if(this.isAudioContiguous=a=a||ne.length&&de>0&&(v&&Math.abs(we-de)<9e3||Math.abs(u(ne[0].pts-B,we)-de)<20*z),ne.forEach(function(se){se.pts=u(se.pts-B,we)}),!a||de<0){if(ne=ne.filter(function(se){return se.pts>=0}),!ne.length)return;p===0?de=0:v?de=Math.max(0,we):de=ne[0].pts}if(h.isAAC)for(var ge=p!==void 0,ve=this.config.maxAudioFramesDrift,he=0,fe=de;he<ne.length;he++){var oe=ne[he],Z=oe.pts,Ee=Z-fe,Be=Math.abs(1e3*Ee/E);if(Ee<=-ve*z&&ge)he===0&&(R.logger.warn("Audio frame @ "+(Z/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ee/E)+" ms."),this.nextAudioPts=de=fe=Z);else if(Ee>=ve*z&&Be<L&&ge){var Ne=Math.round(Ee/z);fe=Z-Ne*z,fe<0&&(Ne--,fe+=z),he===0&&(this.nextAudioPts=de=fe),R.logger.warn("[mp4-remuxer]: Injecting "+Ne+" audio frame @ "+(fe/E).toFixed(3)+"s due to "+Math.round(1e3*Ee/E)+" ms gap.");for(var He=0;He<Ne;He++){var ze=Math.max(fe,0),Ae=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);Ae||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=oe.unit.subarray()),ne.splice(he,0,{unit:Ae,pts:ze}),fe+=z,he++}}oe.pts=fe,fe+=z}for(var Ce=null,Me=null,Ue,Ie=0,De=ne.length;De--;)Ie+=ne[De].unit.byteLength;for(var Te=0,rt=ne.length;Te<rt;Te++){var Qe=ne[Te],Ve=Qe.unit,Xe=Qe.pts;if(Me!==null){var ut=X[Te-1];ut.duration=Math.round((Xe-Me)/N)}else if(a&&h.isAAC&&(Xe=de),Ce=Xe,Ie>0){Ie+=le;try{Ue=new Uint8Array(Ie)}catch(se){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!U){var tt=new DataView(Ue.buffer);tt.setUint32(0,Ie),Ue.set(P.default.types.mdat,4)}}else return;Ue.set(Ve,le);var qe=Ve.byteLength;le+=qe,X.push(new g(!0,W,qe,0)),Me=Xe}var be=X.length;if(!be)return;var nt=X[X.length-1];this.nextAudioPts=de=Me+N*nt.duration;var Ye=U?new Uint8Array(0):P.default.moof(h.sequenceNumber++,Ce/N,C({},h,{samples:X}));h.samples=[];var xe=Ce/E,Re=de/E,ue="audio",ie={data1:Ye,data2:Ue,startPTS:xe,endPTS:Re,startDTS:xe,endDTS:Re,type:ue,hasAudio:!0,hasVideo:!1,nb:be};return this.isAudioContiguous=!0,console.assert(Ue.length,"MDAT length must not be zero"),ie},y.remuxEmptyAudio=function(h,s,a,v){var p=h.inputTimeScale,E=h.samplerate?h.samplerate:p,D=p/E,N=this.nextAudioPts,W=(N!==null?N:v.startDTS*p)+this._initDTS,z=v.endDTS*p+this._initDTS,B=D*S,U=Math.ceil((z-W)/B),X=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){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=[],le=0;le<U;le++){var de=W+le*B;ne.push({unit:X,pts:de,dts:de})}return h.samples=ne,this.remuxAudio(h,s,a,!1)},y.remuxID3=function(h,s){var a=h.samples.length;if(!a)return;for(var v=h.inputTimeScale,p=this._initPTS,E=this._initDTS,D=0;D<a;D++){var N=h.samples[D];N.pts=u(N.pts-p,s*v)/v,N.dts=u(N.dts-E,s*v)/v}var W=h.samples;return h.samples=[],{samples:W}},y.remuxText=function(h,s){var a=h.samples.length;if(!a)return;for(var v=h.inputTimeScale,p=this._initPTS,E=0;E<a;E++){var D=h.samples[E];D.pts=u(D.pts-p,s*v)/v}h.samples.sort(function(W,z){return W.pts-z.pts});var N=h.samples;return h.samples=[],{samples:N}},l}();function u(l,y){var f;if(y===null)return l;for(y<l?f=-8589934592:f=8589934592;Math.abs(l-y)>4294967296;)l+=f;return l}function x(l){for(var y=0;y<l.length;y++)if(l[y].key)return y;return-1}var g=function(y,f,h,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=h,this.cts=s,this.flags=new m(y)},m=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/polyfills/number.ts"),M=A("./src/utils/mp4-tools.ts"),P=A("./src/loader/fragment.ts"),F=A("./src/utils/logger.ts"),I=function(){function b(){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 C=b.prototype;return C.destroy=function(){},C.resetTimeStamp=function(S){this.initPTS=S,this.lastEndDTS=null},C.resetNextTimestamp=function(){this.lastEndDTS=null},C.resetInitSegment=function(S,w,T){this.audioCodec=w,this.videoCodec=T,this.generateInitSegment(S),this.emitInitSegment=!0},C.generateInitSegment=function(S){var w=this.audioCodec,T=this.videoCodec;if(!S||!S.byteLength){this.initTracks=void 0,this.initData=void 0;return}var c=this.initData=Object(M.parseInitSegment)(S);w||(w=O(c.audio,P.ElementaryStreamTypes.AUDIO)),T||(T=O(c.video,P.ElementaryStreamTypes.VIDEO));var o={};c.audio&&c.video?o.audiovideo={container:"video/mp4",codec:w+","+T,initSegment:S,id:"main"}:c.audio?o.audio={container:"audio/mp4",codec:w,initSegment:S,id:"audio"}:c.video?o.video={container:"video/mp4",codec:T,initSegment:S,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},C.remux=function(S,w,T,c,o){var d=this.initPTS,u=this.lastEndDTS,x={audio:void 0,video:void 0,text:c,id3:T,initSegment:void 0};Object(H.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var g=w.samples;if(!g||!g.length)return x;var m={initPTS:void 0,timescale:1},l=this.initData;if((!l||!l.length)&&(this.generateInitSegment(g),l=this.initData),!l||!l.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(d)||(this.initPTS=m.initPTS=d=R(l,g,u));var y=Object(M.getDuration)(g,l),f=u,h=y+f;Object(M.offsetStartDTS)(l,g,d),y>0?this.lastEndDTS=h:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!l.audio,a=!!l.video,v="";s&&(v+="audio"),a&&(v+="video");var p={data1:g,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:v,hasAudio:s,hasVideo:a,nb:1,dropped:0};return x.audio=p.type==="audio"?p:void 0,x.video=p.type!=="audio"?p:void 0,x.text=c,x.id3=T,x.initSegment=m,x},b}(),R=function(C,L,S){return Object(M.getStartDTS)(C,L)-S};function O(b,C){var L=b==null?void 0:b.codec;return L&&L.length>4?L:L==="hvc1"?"hvc1.1.c.L120.90":L==="av01"?"av01.0.04M.08":L==="avc1"||C===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=I},"./src/task-loop.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return H});var H=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=M.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},M}()},"./src/types/cmcd.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"CMCDVersion",function(){return H}),A.d(G,"CMCDObjectType",function(){return M}),A.d(G,"CMCDStreamingFormat",function(){return P}),A.d(G,"CMCDStreamType",function(){return F});var H=1,M;(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"})(M||(M={}));var P;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(P||(P={}));var F;(function(I){I.VOD="v",I.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"HlsSkip",function(){return P}),A.d(G,"getSkipValue",function(){return F}),A.d(G,"HlsUrlParameters",function(){return I}),A.d(G,"Level",function(){return R});function H(O,b){for(var C=0;C<b.length;C++){var L=b[C];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(O,L.key,L)}}function M(O,b,C){return b&&H(O.prototype,b),C&&H(O,C),O}var P;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(P||(P={}));function F(O,b){var C=O.canSkipUntil,L=O.canSkipDateRanges,S=O.endSN,w=b!==void 0?b-S:0;return C&&w<C?L?P.v2:P.Yes:P.No}var I=function(){function O(C,L,S){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=C,this.part=L,this.skip=S}var b=O.prototype;return b.addDirectives=function(L){var S=new self.URL(L);return this.msn!==void 0&&S.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&S.searchParams.set("_HLS_part",this.part.toString()),this.skip&&S.searchParams.set("_HLS_skip",this.skip),S.toString()},O}(),R=function(){function O(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(C){return C}).join(",").replace(/\.[^.,]+/g,"")}return M(O,[{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(C){var L=C%this.url.length;this._urlId!==L&&(this.details=void 0,this._urlId=L)}}]),O}()},"./src/types/loader.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"PlaylistContextType",function(){return H}),A.d(G,"PlaylistLevelType",function(){return M});var H;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"ChunkMetadata",function(){return H});var H=function(F,I,R,O,b,C){O===void 0&&(O=0),b===void 0&&(b=-1),C===void 0&&(C=!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=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=F,this.sn=I,this.id=R,this.size=O,this.part=b,this.partial=C};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"AttrList",function(){return P});var H=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function F(R){typeof R=="string"&&(R=F.parseAttrList(R));for(var O in R)R.hasOwnProperty(O)&&(this[O]=R[O])}var I=F.prototype;return I.decimalInteger=function(O){var b=parseInt(this[O],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},I.hexadecimalInteger=function(O){if(this[O]){var b=(this[O]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var C=new Uint8Array(b.length/2),L=0;L<b.length/2;L++)C[L]=parseInt(b.slice(L*2,L*2+2),16);return C}else return null},I.hexadecimalIntegerAsNumber=function(O){var b=parseInt(this[O],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},I.decimalFloatingPoint=function(O){return parseFloat(this[O])},I.optionalFloat=function(O,b){var C=this[O];return C?parseFloat(C):b},I.enumeratedString=function(O){return this[O]},I.bool=function(O){return this[O]==="YES"},I.decimalResolution=function(O){var b=H.exec(this[O]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},F.parseAttrList=function(O){var b,C={},L='"';for(M.lastIndex=0;(b=M.exec(O))!==null;){var S=b[2];S.indexOf(L)===0&&S.lastIndexOf(L)===S.length-1&&(S=S.slice(1,-1)),C[b[1]]=S}return C},F}()},"./src/utils/binary-search.ts":function(q,G,A){"use strict";A.r(G);var H={search:function(P,F){for(var I=0,R=P.length-1,O=null,b=null;I<=R;){O=(I+R)/2|0,b=P[O];var C=F(b);if(C>0)I=O+1;else if(C<0)R=O-1;else return b}return null}};G.default=H},"./src/utils/buffer-helper.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"BufferHelper",function(){return P});var H=A("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function F(){}return F.isBuffered=function(R,O){try{if(R){for(var b=F.getBuffered(R),C=0;C<b.length;C++)if(O>=b.start(C)&&O<=b.end(C))return!0}}catch(L){}return!1},F.bufferInfo=function(R,O,b){try{if(R){var C=F.getBuffered(R),L=[],S;for(S=0;S<C.length;S++)L.push({start:C.start(S),end:C.end(S)});return this.bufferedInfo(L,O,b)}}catch(w){}return{len:0,start:O,end:O,nextStart:void 0}},F.bufferedInfo=function(R,O,b){O=Math.max(0,O),R.sort(function(m,l){var y=m.start-l.start;return y||l.end-m.end});var C=[];if(b)for(var L=0;L<R.length;L++){var S=C.length;if(S){var w=C[S-1].end;R[L].start-w<b?R[L].end>w&&(C[S-1].end=R[L].end):C.push(R[L])}else C.push(R[L])}else C=R;for(var T=0,c,o=O,d=O,u=0;u<C.length;u++){var x=C[u].start,g=C[u].end;if(O+b>=x&&O<g)o=x,d=g,T=d-O;else if(O+b<x){c=x;break}}return{len:T,start:o||0,end:d||0,nextStart:c}},F.getBuffered=function(R){try{return R.buffered}catch(O){return H.logger.log("failed to get media.buffered",O),M}},F}()},"./src/utils/cea-608-parser.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"Row",function(){return d}),A.d(G,"CaptionScreen",function(){return u});var H=A("./src/utils/logger.ts"),M={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},P=function(h){var s=h;return M.hasOwnProperty(h)&&(s=M[h]),String.fromCharCode(s)},F=15,I=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},C={25:2,26:4,29:6,30:8,31:10,27:13,28:15},L=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],S;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(S||(S={}));var w=function(){function f(){this.time=null,this.verboseLevel=S.ERROR}var h=f.prototype;return h.log=function(a,v){this.verboseLevel>=a&&H.logger.log(this.time+" ["+a+"] "+v)},f}(),T=function(h){for(var s=[],a=0;a<h.length;a++)s.push(h[a].toString(16));return s},c=function(){function f(s,a,v,p,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=v||!1,this.background=p||"black",this.flash=E||!1}var h=f.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],p=0;p<v.length;p++){var E=v[p];a.hasOwnProperty(E)&&(this[E]=a[E])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},h.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(s,a,v,p,E,D){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new c(a,v,p,E,D)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},h.setPenState=function(a){this.penState.copy(a)},h.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},h.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),d=function(){function f(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<I;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new c}var h=f.prototype;return h.equals=function(a){for(var v=!0,p=0;p<I;p++)if(!this.chars[p].equals(a.chars[p])){v=!1;break}return v},h.copy=function(a){for(var v=0;v<I;v++)this.chars[v].copy(a.chars[v])},h.isEmpty=function(){for(var a=!0,v=0;v<I;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},h.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(S.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(S.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},h.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var p=this.pos+1;p<v+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(v)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=I){this.logger.log(S.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(a){var v;for(v=a;v<I;v++)this.chars[v].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var a=[],v=!0,p=0;p<I;p++){var E=this.chars[p].uchar;E!==" "&&(v=!1),a.push(E)}return v?"":a.join("")},h.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},f}(),u=function(){function f(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<F;a++)this.rows.push(new d(s));this.logger=s,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=f.prototype;return h.reset=function(){for(var a=0;a<F;a++)this.rows[a].clear();this.currRow=F-1},h.equals=function(a){for(var v=!0,p=0;p<F;p++)if(!this.rows[p].equals(a.rows[p])){v=!1;break}return v},h.copy=function(a){for(var v=0;v<F;v++)this.rows[v].copy(a.rows[v])},h.isEmpty=function(){for(var a=!0,v=0;v<F;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},h.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},h.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},h.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},h.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},h.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},h.setCursor=function(a){this.logger.log(S.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},h.setPAC=function(a){this.logger.log(S.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var p=0;p<F;p++)this.rows[p].clear();var E=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var N=D.rows[E].cueStartTime,W=this.logger.time;if(N&&W!==null&&N<W)for(var z=0;z<this.nrRollUpRows;z++)this.rows[v-this.nrRollUpRows+z+1].copy(D.rows[E+z])}}this.currRow=v;var B=this.rows[this.currRow];if(a.indent!==null){var U=a.indent,X=Math.max(U-1,0);B.setCursor(a.indent),a.color=B.chars[X].penState.foreground}var ne={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ne)},h.setBkgData=function(a){this.logger.log(S.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},h.setRollUpRows=function(a){this.nrRollUpRows=a},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(S.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(S.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(S.INFO,"Rolling up")},h.getDisplayText=function(a){a=a||!1;for(var v=[],p="",E=-1,D=0;D<F;D++){var N=this.rows[D].getTextString();N&&(E=D+1,a?v.push("Row "+E+": '"+N+"'"):v.push(N.trim()))}return v.length>0&&(a?p="["+v.join(" | ")+"]":p=v.join(`
|
|
`)),p},h.getTextAndFormat=function(){return this.rows},f}(),x=function(){function f(s,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(v),this.nonDisplayedMemory=new u(v),this.lastOutputScreen=new u(v),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var h=f.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(a){this.outputFilter=a},h.setPAC=function(a){this.writeScreen.setPAC(a)},h.setBkgData=function(a){this.writeScreen.setBkgData(a)},h.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(S.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},h.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(S.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(S.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(S.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(S.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(S.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(a){this.logger.log(S.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},h.ccFON=function(){this.logger.log(S.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(S.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(S.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(S.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(S.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(S.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(S.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(S.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(S.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(a){this.logger.log(S.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},h.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var p=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=E[p]}this.logger.log(S.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},h.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),g=function(){function f(s,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new w;this.channels=[null,new x(s,a,p),new x(s+1,v,p)],this.cmdHistory=y(),this.logger=p}var h=f.prototype;return h.getHandler=function(a){return this.channels[a].getHandler()},h.setHandler=function(a,v){this.channels[a].setHandler(v)},h.addData=function(a,v){var p,E,D,N=!1;this.logger.time=a;for(var W=0;W<v.length;W+=2){if(E=v[W]&127,D=v[W+1]&127,E===0&&D===0)continue;if(this.logger.log(S.DATA,"["+T([v[W],v[W+1]])+"] -> ("+T([E,D])+")"),p=this.parseCmd(E,D),p||(p=this.parseMidrow(E,D)),p||(p=this.parsePAC(E,D)),p||(p=this.parseBackgroundAttributes(E,D)),!p&&(N=this.parseChars(E,D),N)){var z=this.currentChannel;if(z&&z>0){var B=this.channels[z];B.insertChars(N)}else this.logger.log(S.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!N&&this.logger.log(S.WARNING,"Couldn't parse cleaned data "+T([E,D])+" orig: "+T([v[W],v[W+1]]))}},h.parseCmd=function(a,v){var p=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,D=(a===23||a===31)&&v>=33&&v<=35;if(!(E||D))return!1;if(l(a,v,p))return m(null,null,p),this.logger.log(S.DEBUG,"Repeated command ("+T([a,v])+") is dropped"),!0;var N=a===20||a===21||a===23?1:2,W=this.channels[N];return a===20||a===21||a===28||a===29?v===32?W.ccRCL():v===33?W.ccBS():v===34?W.ccAOF():v===35?W.ccAON():v===36?W.ccDER():v===37?W.ccRU(2):v===38?W.ccRU(3):v===39?W.ccRU(4):v===40?W.ccFON():v===41?W.ccRDC():v===42?W.ccTR():v===43?W.ccRTD():v===44?W.ccEDM():v===45?W.ccCR():v===46?W.ccENM():v===47&&W.ccEOC():W.ccTO(v-32),m(a,v,p),this.currentChannel=N,!0},h.parseMidrow=function(a,v){var p=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(S.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[p];return E?(E.ccMIDROW(v),this.logger.log(S.DEBUG,"MIDROW ("+T([a,v])+")"),!0):!1}return!1},h.parsePAC=function(a,v){var p,E=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,N=(a===16||a===24)&&v>=64&&v<=95;if(!(D||N))return!1;if(l(a,v,E))return m(null,null,E),!0;var W=a<=23?1:2;v>=64&&v<=95?p=W===1?R[a]:b[a]:p=W===1?O[a]:C[a];var z=this.channels[W];return z?(z.setPAC(this.interpretPAC(p,v)),m(a,v,E),this.currentChannel=W,!0):!1},h.interpretPAC=function(a,v){var p,E={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?p=v-96:p=v-64,E.underline=(p&1)===1,p<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((p-16)/2)*4,E},h.parseChars=function(a,v){var p,E=null,D=null;if(a>=25?(p=2,D=a-8):(p=1,D=a),D>=17&&D<=19){var N;D===17?N=v+80:D===18?N=v+112:N=v+144,this.logger.log(S.INFO,"Special char '"+P(N)+"' in channel "+p),E=[N]}else a>=32&&a<=127&&(E=v===0?[a]:[a,v]);if(E){var W=T(E);this.logger.log(S.DEBUG,"Char codes = "+W.join(",")),m(a,v,this.cmdHistory)}return E},h.parseBackgroundAttributes=function(a,v){var p=(a===16||a===24)&&v>=32&&v<=47,E=(a===23||a===31)&&v>=45&&v<=47;if(!(p||E))return!1;var D,N={};a===16||a===24?(D=Math.floor((v-32)/2),N.background=L[D],v%2===1&&(N.background=N.background+"_semi")):v===45?N.background="transparent":(N.foreground="black",v===47&&(N.underline=!0));var W=a<=23?1:2,z=this.channels[W];return z.setBkgData(N),m(a,v,this.cmdHistory),!0},h.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=y()},h.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var p=this.channels[v];p&&p.cueSplitAtTime(a)}},f}();function m(f,h,s){s.a=f,s.b=h}function l(f,h,s){return s.a===f&&s.b===h}function y(){return{a:null,b:null}}G.default=g},"./src/utils/codecs.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"isCodecType",function(){return M}),A.d(G,"isCodecSupportedInMp4",function(){return P});var H={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 M(F,I){var R=H[I];return!!R&&R[F.slice(0,4)]===!0}function P(F,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/utils/vttparser.ts"),M=A("./src/utils/webvtt-parser.ts"),P=A("./src/utils/texttrack-utils.ts"),F=/\s/,I={newCue:function(O,b,C,L){for(var S=[],w,T,c,o,d,u=self.VTTCue||self.TextTrackCue,x=0;x<L.rows.length;x++)if(w=L.rows[x],c=!0,o=0,d="",!w.isEmpty()){for(var g=0;g<w.chars.length;g++)F.test(w.chars[g].uchar)&&c?o++:(d+=w.chars[g].uchar,c=!1);w.cueStartTime=b,b===C&&(C+=1e-4),o>=16?o--:o++;var m=Object(H.fixLineBreaks)(d.trim()),l=Object(M.generateCueId)(b,C,m);(!O||!O.cues||!O.cues.getCueById(l))&&(T=new u(b,C,m),T.id=l,T.line=x+1,T.align="left",T.position=10+Math.min(80,Math.floor(o*8/32)*10),S.push(T))}return O&&S.length&&(S.sort(function(y,f){return y.line==="auto"||f.line==="auto"?0:y.line>8&&f.line>8?f.line-y.line:y.line-f.line}),S.forEach(function(y){return Object(P.addCueToTrack)(O,y)})),S}};G.default=I},"./src/utils/discontinuities.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"findFirstFragWithCC",function(){return F}),A.d(G,"shouldAlignOnDiscontinuities",function(){return I}),A.d(G,"findDiscontinuousReferenceFrag",function(){return R}),A.d(G,"adjustSlidingStart",function(){return b}),A.d(G,"alignStream",function(){return C}),A.d(G,"alignPDT",function(){return S}),A.d(G,"alignFragmentByPDTDelta",function(){return w}),A.d(G,"alignMediaPlaylistByPDT",function(){return T});var H=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts"),P=A("./src/controller/level-helper.ts");function F(c,o){for(var d=null,u=0,x=c.length;u<x;u++){var g=c[u];if(g&&g.cc===o){d=g;break}}return d}function I(c,o,d){return!!(o.details&&(d.endCC>d.startCC||c&&c.cc<d.startCC))}function R(c,o){var d=c.fragments,u=o.fragments;if(!u.length||!d.length){M.logger.log("No fragments to align");return}var x=F(d,u[0].cc);if(!x||x&&!x.startPTS){M.logger.log("No frag in previous level to align on");return}return x}function O(c,o){if(c){var d=c.start+o;c.start=c.startPTS=d,c.endPTS=d+c.duration}}function b(c,o){for(var d=o.fragments,u=0,x=d.length;u<x;u++)O(d[u],c);o.fragmentHint&&O(o.fragmentHint,c),o.alignedSliding=!0}function C(c,o,d){if(!o)return;L(c,d,o),!d.alignedSliding&&o.details&&S(d,o.details),!d.alignedSliding&&o.details&&!d.skippedSegments&&Object(P.adjustSliding)(o.details,d)}function L(c,o,d){if(I(c,d,o)){var u=R(d.details,o);u&&Object(H.isFiniteNumber)(u.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),b(u.start,o))}}function S(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var d=o.fragments[0].programDateTime,u=c.fragments[0].programDateTime,x=(u-d)/1e3+o.fragments[0].start;x&&Object(H.isFiniteNumber)(x)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(u-d)+"ms, sliding:"+x.toFixed(3)+" "+c.url+" "),b(x,c))}function w(c,o){var d=c.programDateTime;if(!d)return;var u=(d-o)/1e3;c.start=c.startPTS=u,c.endPTS=u+c.duration}function T(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var d=o.fragments[0].programDateTime,u=o.fragments[0].start,x=d-u*1e3;c.fragments.forEach(function(g){w(g,x)}),c.fragmentHint&&w(c.fragmentHint,x),c.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/utils/ewma.ts"),M=function(){function P(I,R,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(I),this.fast_=new H.default(R)}var F=P.prototype;return F.update=function(R,O){var b=this.slow_,C=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new H.default(R,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new H.default(O,C.getEstimate(),C.getTotalWeight()))},F.sample=function(R,O){R=Math.max(R,this.minDelayMs_);var b=8*O,C=R/1e3,L=b/C;this.fast_.sample(C,L),this.slow_.sample(C,L)},F.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},P}();G.default=M},"./src/utils/ewma.ts":function(q,G,A){"use strict";A.r(G);var H=function(){function M(F,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=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=I,this.totalWeight_=R}var P=M.prototype;return P.sample=function(I,R){var O=Math.pow(this.alpha_,I);this.estimate_=R*(1-O)+O*this.estimate_,this.totalWeight_+=I},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},M}();G.default=H},"./src/utils/fetch-loader.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"fetchSupported",function(){return w});var H=A("./src/polyfills/number.ts"),M=A("./src/loader/load-stats.ts"),P=A("./src/demux/chunk-cache.ts");function F(u,x){u.prototype=Object.create(x.prototype),u.prototype.constructor=u,C(u,x)}function I(u){var x=typeof Map=="function"?new Map:void 0;return I=function(m){if(m===null||!b(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(m))return x.get(m);x.set(m,l)}function l(){return R(m,arguments,L(this).constructor)}return l.prototype=Object.create(m.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),C(l,m)},I(u)}function R(u,x,g){return O()?R=Reflect.construct:R=function(l,y,f){var h=[null];h.push.apply(h,y);var s=Function.bind.apply(l,h),a=new s;return f&&C(a,f.prototype),a},R.apply(null,arguments)}function O(){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 b(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function C(u,x){return C=Object.setPrototypeOf||function(m,l){return m.__proto__=l,m},C(u,x)}function L(u){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},L(u)}function S(){return S=Object.assign||function(u){for(var x=1;x<arguments.length;x++){var g=arguments[x];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(u[m]=g[m])}return u},S.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var T=function(){function u(g){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=g.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var x=u.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(m,l,y){var f=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var s=c(m,this.controller.signal),a=y.onProgress,v=m.responseType==="arraybuffer",p=v?"byteLength":"length";this.context=m,this.config=l,this.callbacks=y,this.request=this.fetchSetup(m,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),y.onTimeout(h,m,f.response)},l.timeout),self.fetch(this.request).then(function(E){if(f.response=f.loader=E,!E.ok){var D=E.status,N=E.statusText;throw new d(N||"fetch, bad network response",D,E)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(H.isFiniteNumber)(l.highWaterMark)?f.loadProgressively(E,h,m,l.highWaterMark,a):v?E.arrayBuffer():E.text()}).then(function(E){var D=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=E[p];var N={url:D.url,data:E};a&&!Object(H.isFiniteNumber)(l.highWaterMark)&&a(h,m,E,D),y.onSuccess(N,h,m,D)}).catch(function(E){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var D=E.code||0;y.onError({code:D,text:E.message},m,E.details)})},x.getCacheAge=function(){var m=null;if(this.response){var l=this.response.headers.get("age");m=l?parseFloat(l):null}return m},x.loadProgressively=function(m,l,y,f,h){f===void 0&&(f=0);var s=new P.default,a=m.body.getReader(),v=function p(){return a.read().then(function(E){if(E.done)return s.dataLength&&h(l,y,s.flush(),m),Promise.resolve(new ArrayBuffer(0));var D=E.value,N=D.length;return l.loaded+=N,N<f||s.dataLength?(s.push(D),s.dataLength>=f&&h(l,y,s.flush(),m)):h(l,y,D,m),p()}).catch(function(){return Promise.reject()})};return v()},u}();function c(u,x){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(S({},u.headers))};return u.rangeEnd&&g.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),g}function o(u,x){return new self.Request(u.url,x)}var d=function(u){F(x,u);function x(g,m,l){var y;return y=u.call(this,g)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=l,y}return x}(I(Error));G.default=T},"./src/utils/imsc1-ttml-parser.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"IMSC1_CODEC",function(){return b}),A.d(G,"parseIMSC1",function(){return w});var H=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/utils/vttcue.ts"),F=A("./src/demux/id3.ts"),I=A("./src/utils/timescale-conversion.ts"),R=A("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var s=arguments[h];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(f[a]=s[a])}return f},O.apply(this,arguments)}var b="stpp.ttml.im1t",C=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,L=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,S={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(f,h,s,a,v){var p=Object(H.findBox)(new Uint8Array(f),["mdat"]);if(p.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var E=p[0],D=Object(F.utf8ArrayToStr)(new Uint8Array(f,E.start,E.end-E.start)),N=Object(I.toTimescaleFromScale)(h,1,s);try{a(T(D,N))}catch(W){v(W)}}function T(f,h){var s=new DOMParser,a=s.parseFromString(f,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(p).reduce(function(B,U){return B[U]=v.getAttribute("ttp:"+U)||p[U],B},{}),D=v.getAttribute("xml:space")!=="preserve",N=o(c(v,"styling","style")),W=o(c(v,"layout","region")),z=c(v,"body","[begin]");return[].map.call(z,function(B){var U=d(B,D);if(!U||!B.hasAttribute("begin"))return null;var X=m(B.getAttribute("begin"),E),ne=m(B.getAttribute("dur"),E),le=m(B.getAttribute("end"),E);if(X===null)throw g(B);if(le===null){if(ne===null)throw g(B);le=X+ne}var de=new P.default(X-h,le-h,U);de.id=Object(R.generateCueId)(de.startTime,de.endTime,de.text);var we=W[B.getAttribute("region")],ge=N[B.getAttribute("style")];de.position=10,de.size=80;var ve=u(we,ge),he=ve.textAlign;if(he){var fe=S[he];fe&&(de.lineAlign=fe),de.align=he}return O(de,ve),de}).filter(function(B){return B!==null})}function c(f,h,s){var a=f.getElementsByTagName(h)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(f){return f.reduce(function(h,s){var a=s.getAttribute("xml:id");return a&&(h[a]=s),h},{})}function d(f,h){return[].slice.call(f.childNodes).reduce(function(s,a,v){var p;return a.nodeName==="br"&&v?s+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?d(a,h):h?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function u(f,h){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,p){var E=x(h,s,p)||x(f,s,p);return E&&(v[p]=E),v},{})}function x(f,h,s){return f.hasAttributeNS(h,s)?f.getAttributeNS(h,s):null}function g(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,h){if(!f)return null;var s=Object(M.parseTimeStamp)(f);return s===null&&(C.test(f)?s=l(f,h):L.test(f)&&(s=y(f,h))),s}function l(f,h){var s=C.exec(f),a=(s[4]|0)+(s[5]|0)/h.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/h.frameRate}function y(f,h){var s=L.exec(f),a=Number(s[1]),v=s[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/h.frameRate;case"t":return a/h.tickRate}return a}},"./src/utils/logger.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"enableLogs",function(){return R}),A.d(G,"logger",function(){return O});var H=function(){},M={trace:H,debug:H,log:H,warn:H,info:H,error:H},P=M;function F(b){var C=self.console[b];return C?C.bind(self.console,"["+b+"] >"):H}function I(b){for(var C=arguments.length,L=new Array(C>1?C-1:0),S=1;S<C;S++)L[S-1]=arguments[S];L.forEach(function(w){P[w]=b[w]?b[w].bind(b):F(w)})}function R(b){if(self.console&&b===!0||typeof b=="object"){I(b,"debug","log","info","warn","error");try{P.log()}catch(C){P=M}}else P=M}var O=P},"./src/utils/mediakeys-helper.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"KeySystems",function(){return H}),A.d(G,"requestMediaKeySystemAccess",function(){return M});var H;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(H||(H={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"bin2str",function(){return I}),A.d(G,"readUint16",function(){return R}),A.d(G,"readUint32",function(){return O}),A.d(G,"writeUint32",function(){return b}),A.d(G,"findBox",function(){return C}),A.d(G,"parseSegmentIndex",function(){return L}),A.d(G,"parseInitSegment",function(){return S}),A.d(G,"getStartDTS",function(){return w}),A.d(G,"getDuration",function(){return T}),A.d(G,"computeRawDurationFromSamples",function(){return c}),A.d(G,"offsetStartDTS",function(){return o}),A.d(G,"segmentValidRange",function(){return d}),A.d(G,"appendUint8Array",function(){return u});var H=A("./src/utils/typed-array.ts"),M=A("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,F=[].push;function I(x){return String.fromCharCode.apply(null,x)}function R(x,g){"data"in x&&(g+=x.start,x=x.data);var m=x[g]<<8|x[g+1];return m<0?65536+m:m}function O(x,g){"data"in x&&(g+=x.start,x=x.data);var m=x[g]<<24|x[g+1]<<16|x[g+2]<<8|x[g+3];return m<0?4294967296+m:m}function b(x,g,m){"data"in x&&(g+=x.start,x=x.data),x[g]=m>>24,x[g+1]=m>>16&255,x[g+2]=m>>8&255,x[g+3]=m&255}function C(x,g){var m=[];if(!g.length)return m;var l,y,f;"data"in x?(l=x.data,y=x.start,f=x.end):(l=x,y=0,f=l.byteLength);for(var h=y;h<f;){var s=O(l,h),a=I(l.subarray(h+4,h+8)),v=s>1?h+s:f;if(a===g[0])if(g.length===1)m.push({data:l,start:h+8,end:v});else{var p=C({data:l,start:h+8,end:v},g.slice(1));p.length&&F.apply(m,p)}h=v}return m}function L(x){var g=C(x,["moov"]),m=g[0],l=m?m.end:null,y=C(x,["sidx"]);if(!y||!y[0])return null;var f=[],h=y[0],s=h.data[0],a=s===0?8:16,v=O(h,a);a+=4;var p=0,E=0;s===0?a+=8:a+=16,a+=2;var D=h.end+E,N=R(h,a);a+=2;for(var W=0;W<N;W++){var z=a,B=O(h,z);z+=4;var U=B&2147483647,X=(B&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ne=O(h,z);z+=4,f.push({referenceSize:U,subsegmentDuration:ne,info:{duration:ne/v,start:D,end:D+U-1}}),D+=U,z+=4,a=z}return{earliestPresentationTime:p,timescale:v,version:s,referencesCount:N,references:f,moovEndOffset:l}}function S(x){for(var g=[],m=C(x,["moov","trak"]),l=0;l<m.length;l++){var y=m[l],f=C(y,["tkhd"])[0];if(f){var h=f.data[f.start],s=h===0?12:20,a=O(f,s),v=C(y,["mdia","mdhd"])[0];if(v){h=v.data[v.start],s=h===0?12:20;var p=O(v,s),E=C(y,["mdia","hdlr"])[0];if(E){var D=I(E.data.subarray(E.start+8,E.start+12)),N={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[D];if(N){var W=C(y,["mdia","minf","stbl","stsd"])[0],z=void 0;W&&(z=I(W.data.subarray(W.start+12,W.start+16))),g[a]={timescale:p,type:N},g[N]={timescale:p,id:a,codec:z}}}}}}var B=C(x,["moov","mvex","trex"]);return B.forEach(function(U){var X=O(U,4),ne=g[X];ne&&(ne.default={duration:O(U,12),flags:O(U,20)})}),g}function w(x,g){return C(g,["moof","traf"]).reduce(function(m,l){var y=C(l,["tfdt"])[0],f=y.data[y.start],h=C(l,["tfhd"]).reduce(function(s,a){var v=O(a,4),p=x[v];if(p){var E=O(y,4);f===1&&(E*=Math.pow(2,32),E+=O(y,8));var D=p.timescale||9e4,N=E/D;if(isFinite(N)&&(s===null||N<s))return N}return s},null);return h!==null&&isFinite(h)&&(m===null||h<m)?h:m},null)||0}function T(x,g){for(var m=0,l=0,y=0,f=C(x,["moof","traf"]),h=0;h<f.length;h++){var s=f[h],a=C(s,["tfhd"])[0],v=O(a,4),p=g[v];if(!p)continue;var E=p.default,D=O(a,0)|(E==null?void 0:E.flags),N=E==null?void 0:E.duration;D&8&&(D&2?N=O(a,12):N=O(a,8));for(var W=p.timescale||9e4,z=C(s,["trun"]),B=0;B<z.length;B++){if(N){var U=O(z[B],4);m=N*U}else m=c(z[B]);p.type===M.ElementaryStreamTypes.VIDEO?l+=m/W:p.type===M.ElementaryStreamTypes.AUDIO&&(y+=m/W)}}if(l===0&&y===0){var X=L(x);if(X!=null&&X.references)return X.references.reduce(function(ne,le){return ne+le.info.duration||0},0)}return l||y}function c(x){var g=O(x,0),m=8;g&1&&(m+=4),g&4&&(m+=4);for(var l=0,y=O(x,4),f=0;f<y;f++){if(g&256){var h=O(x,m);l+=h,m+=4}g&512&&(m+=4),g&1024&&(m+=4),g&2048&&(m+=4)}return l}function o(x,g,m){C(g,["moof","traf"]).forEach(function(l){C(l,["tfhd"]).forEach(function(y){var f=O(y,4),h=x[f];if(!h)return;var s=h.timescale||9e4;C(l,["tfdt"]).forEach(function(a){var v=a.data[a.start],p=O(a,4);if(v===0)b(a,4,p-m*s);else{p*=Math.pow(2,32),p+=O(a,8),p-=m*s,p=Math.max(p,0);var E=Math.floor(p/(P+1)),D=Math.floor(p%(P+1));b(a,4,E),b(a,8,D)}})})})}function d(x){var g={valid:null,remainder:null},m=C(x,["moof"]);if(m){if(m.length<2)return g.remainder=x,g}else return g;var l=m[m.length-1];return g.valid=Object(H.sliceUint8)(x,0,l.start-8),g.remainder=Object(H.sliceUint8)(x,l.start-8),g}function u(x,g){var m=new Uint8Array(x.length+g.length);return m.set(x),m.set(g,x.length),m}},"./src/utils/output-filter.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"default",function(){return H});var H=function(){function M(F,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=I}var P=M.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(I,R,O){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=R,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"sendAddTrackEvent",function(){return M}),A.d(G,"addCueToTrack",function(){return P}),A.d(G,"clearCurrentCues",function(){return F}),A.d(G,"removeCuesInRange",function(){return I}),A.d(G,"getCuesInRange",function(){return O});var H=A("./src/utils/logger.ts");function M(b,C){var L;try{L=new Event("addtrack")}catch(S){L=document.createEvent("Event"),L.initEvent("addtrack",!1,!1)}L.track=b,C.dispatchEvent(L)}function P(b,C){var L=b.mode;if(L==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(C.id))try{if(b.addCue(C),!b.cues.getCueById(C.id))throw new Error("addCue is failed for: "+C)}catch(w){H.logger.debug("[texttrack-utils]: "+w);var S=new self.TextTrackCue(C.startTime,C.endTime,C.text);S.id=C.id,b.addCue(S)}L==="disabled"&&(b.mode=L)}function F(b){var C=b.mode;if(C==="disabled"&&(b.mode="hidden"),b.cues)for(var L=b.cues.length;L--;)b.removeCue(b.cues[L]);C==="disabled"&&(b.mode=C)}function I(b,C,L){var S=b.mode;if(S==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var w=O(b.cues,C,L),T=0;T<w.length;T++)b.removeCue(w[T]);S==="disabled"&&(b.mode=S)}function R(b,C){if(C<b[0].startTime)return 0;var L=b.length-1;if(C>b[L].endTime)return-1;for(var S=0,w=L;S<=w;){var T=Math.floor((w+S)/2);if(C<b[T].startTime)w=T-1;else if(C>b[T].startTime&&S<L)S=T+1;else return T}return b[S].startTime-C<C-b[w].startTime?S:w}function O(b,C,L){var S=[],w=R(b,C);if(w>-1)for(var T=w,c=b.length;T<c;T++){var o=b[T];if(o.startTime>=C&&o.endTime<=L)S.push(o);else if(o.startTime>L)return S}return S}},"./src/utils/time-ranges.ts":function(q,G,A){"use strict";A.r(G);var H={toString:function(P){for(var F="",I=P.length,R=0;R<I;R++)F+="["+P.start(R).toFixed(3)+","+P.end(R).toFixed(3)+"]";return F}};G.default=H},"./src/utils/timescale-conversion.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"toTimescaleFromBase",function(){return M}),A.d(G,"toTimescaleFromScale",function(){return P}),A.d(G,"toMsFromMpegTsClock",function(){return F}),A.d(G,"toMpegTsClockFromTimescale",function(){return I});var H=9e4;function M(R,O,b,C){b===void 0&&(b=1),C===void 0&&(C=!1);var L=R*O*b;return C?Math.round(L):L}function P(R,O,b,C){return b===void 0&&(b=1),C===void 0&&(C=!1),M(R,O,1/b,C)}function F(R,O){return O===void 0&&(O=!1),M(R,1e3,1/H,O)}function I(R,O){return O===void 0&&(O=1),M(R,H,1/O)}},"./src/utils/typed-array.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"sliceUint8",function(){return H});function H(M,P,F){return Uint8Array.prototype.slice?M.slice(P,F):new Uint8Array(Array.prototype.slice.call(M,P,F))}},"./src/utils/vttcue.ts":function(q,G,A){"use strict";A.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],M=["start","middle","end","left","right"];function P(b,C){if(typeof C!="string")return!1;if(!Array.isArray(b))return!1;var L=C.toLowerCase();return~b.indexOf(L)?L:!1}function F(b){return P(H,b)}function I(b){return P(M,b)}function R(b){for(var C=arguments.length,L=new Array(C>1?C-1:0),S=1;S<C;S++)L[S-1]=arguments[S];for(var w=1;w<arguments.length;w++){var T=arguments[w];for(var c in T)b[c]=T[c]}return b}function O(b,C,L){var S=this,w={enumerable:!0};S.hasBeenReset=!1;var T="",c=!1,o=b,d=C,u=L,x=null,g="",m=!0,l="auto",y="start",f=50,h="middle",s=50,a="middle";Object.defineProperty(S,"id",R({},w,{get:function(){return T},set:function(p){T=""+p}})),Object.defineProperty(S,"pauseOnExit",R({},w,{get:function(){return c},set:function(p){c=!!p}})),Object.defineProperty(S,"startTime",R({},w,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"endTime",R({},w,{get:function(){return d},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");d=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"text",R({},w,{get:function(){return u},set:function(p){u=""+p,this.hasBeenReset=!0}})),Object.defineProperty(S,"region",R({},w,{get:function(){return x},set:function(p){x=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"vertical",R({},w,{get:function(){return g},set:function(p){var E=F(p);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"snapToLines",R({},w,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(S,"line",R({},w,{get:function(){return l},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"lineAlign",R({},w,{get:function(){return y},set:function(p){var E=I(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");y=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"position",R({},w,{get:function(){return f},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");f=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"positionAlign",R({},w,{get:function(){return h},set:function(p){var E=I(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");h=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"size",R({},w,{get:function(){return s},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"align",R({},w,{get:function(){return a},set:function(p){var E=I(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),S.displayState=void 0}return O.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"parseTimeStamp",function(){return P}),A.d(G,"fixLineBreaks",function(){return C}),A.d(G,"VTTParser",function(){return L});var H=A("./src/utils/vttcue.ts"),M=function(){function S(){}var w=S.prototype;return w.decode=function(c,o){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},S}();function P(S){function w(c,o,d,u){return(c|0)*3600+(o|0)*60+(d|0)+parseFloat(u||0)}var T=S.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return T?parseFloat(T[2])>59?w(T[2],T[3],0,T[4]):w(T[1],T[2],T[3],T[4]):null}var F=function(){function S(){this.values=Object.create(null)}var w=S.prototype;return w.set=function(c,o){!this.get(c)&&o!==""&&(this.values[c]=o)},w.get=function(c,o,d){return d?this.has(c)?this.values[c]:o[d]:this.has(c)?this.values[c]:o},w.has=function(c){return c in this.values},w.alt=function(c,o,d){for(var u=0;u<d.length;++u)if(o===d[u]){this.set(c,o);break}},w.integer=function(c,o){/^-?\d+$/.test(o)&&this.set(c,parseInt(o,10))},w.percent=function(c,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var d=parseFloat(o);if(d>=0&&d<=100)return this.set(c,d),!0}return!1},S}();function I(S,w,T,c){var o=c?S.split(c):[S];for(var d in o){if(typeof o[d]!="string")continue;var u=o[d].split(T);if(u.length!==2)continue;var x=u[0],g=u[1];w(x,g)}}var R=new H.default(0,0,""),O=R.align==="middle"?"middle":"center";function b(S,w,T){var c=S;function o(){var x=P(S);if(x===null)throw new Error("Malformed timestamp: "+c);return S=S.replace(/^[^\sa-zA-Z-]+/,""),x}function d(x,g){var m=new F;I(x,function(f,h){var s;switch(f){case"region":for(var a=T.length-1;a>=0;a--)if(T[a].id===h){m.set(f,T[a].region);break}break;case"vertical":m.alt(f,h,["rl","lr"]);break;case"line":s=h.split(","),m.integer(f,s[0]),m.percent(f,s[0])&&m.set("snapToLines",!1),m.alt(f,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",O,"end"]);break;case"position":s=h.split(","),m.percent(f,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,h);break;case"align":m.alt(f,h,["start",O,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var l=m.get("line","auto");l==="auto"&&R.line===-1&&(l=-1),g.line=l,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",O);var y=m.get("position","auto");y==="auto"&&R.position===50&&(y=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=y}function u(){S=S.replace(/^\s+/,"")}if(u(),w.startTime=o(),u(),S.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+c);S=S.substr(3),u(),w.endTime=o(),u(),d(S,w)}function C(S){return S.replace(/<br(?: \/)?>/gi,`
|
|
`)}var L=function(){function S(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=S.prototype;return w.parse=function(c){var o=this;c&&(o.buffer+=o.decoder.decode(c,{stream:!0}));function d(){var y=o.buffer,f=0;for(y=C(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
|
|
`;)++f;var h=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
|
|
`&&++f,o.buffer=y.substr(f),h}function u(y){I(y,function(f,h){},/:/)}try{var x="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;x=d();var g=x.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:x=d();switch(o.state){case"HEADER":/:/.test(x)?u(x):x||(o.state="ID");continue;case"NOTE":x||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){o.state="NOTE";break}if(!x)continue;if(o.cue=new H.default(0,0,""),o.state="CUE",x.indexOf("-->")===-1){o.cue.id=x;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{b(x,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var l=x.indexOf("-->")!==-1;if(!x||l&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=x}continue;case"BADCUE":x||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var c=this;try{if((c.cue||c.state==="HEADER")&&(c.buffer+=`
|
|
|
|
`,c.parse()),c.state==="INITIAL"||c.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){c.onparsingerror&&c.onparsingerror(o)}return c.onflush&&c.onflush(),this},S}()},"./src/utils/webvtt-parser.ts":function(q,G,A){"use strict";A.r(G),A.d(G,"generateCueId",function(){return L}),A.d(G,"parseWebVTT",function(){return w});var H=A("./src/polyfills/number.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/demux/id3.ts"),F=A("./src/utils/timescale-conversion.ts"),I=A("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,O=function(c,o,d){return d===void 0&&(d=0),c.substr(d,o.length)===o},b=function(c){var o=parseInt(c.substr(-3)),d=parseInt(c.substr(-6,2)),u=parseInt(c.substr(-9,2)),x=c.length>9?parseInt(c.substr(0,c.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(d)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+c);return o+=1e3*d,o+=60*1e3*u,o+=60*60*1e3*x,o},C=function(c){for(var o=5381,d=c.length;d;)o=o*33^c.charCodeAt(--d);return(o>>>0).toString()};function L(T,c,o){return C(T.toString())+C(c.toString())+C(o)}var S=function(c,o,d){var u=c[o],x=c[u.prevCC];if(!x||!x.new&&u.new){c.ccOffset=c.presentationOffset=u.start,u.new=!1;return}for(;(g=x)!==null&&g!==void 0&&g.new;){var g;c.ccOffset+=u.start-x.start,u.new=!1,u=x,x=c[u.prevCC]}c.presentationOffset=d};function w(T,c,o,d,u,x,g,m){var l=new M.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(T)).trim().replace(R,`
|
|
`).split(`
|
|
`),f=[],h=Object(F.toMpegTsClockFromTimescale)(c,o),s="00:00.000",a=0,v=0,p,E=!0,D=!1;l.oncue=function(N){var W=d[u],z=d.ccOffset,B=(a-h)/9e4;if(W!=null&&W.new&&(v!==void 0?z=d.ccOffset=W.start:S(d,u,B)),B&&(z=B-d.presentationOffset),D){var U=N.endTime-N.startTime,X=Object(I.normalizePts)((N.startTime+z-v)*9e4,x*9e4)/9e4;N.startTime=X,N.endTime=X+U}var ne=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(ne)),N.id||(N.id=L(N.startTime,N.endTime,ne)),N.endTime>0&&f.push(N)},l.onparsingerror=function(N){p=N},l.onflush=function(){if(p){m(p);return}g(f)},y.forEach(function(N){if(E)if(O(N,"X-TIMESTAMP-MAP=")){E=!1,D=!0,N.substr(16).split(",").forEach(function(W){O(W,"LOCAL:")?s=W.substr(6):O(W,"MPEGTS:")&&(a=parseInt(W.substr(7)))});try{v=b(s)/1e3}catch(W){D=!1,p=W}return}else N===""&&(E=!1);l.parse(N+`
|
|
`)}),l.flush()}},"./src/utils/xhr-loader.ts":function(q,G,A){"use strict";A.r(G);var H=A("./src/utils/logger.ts"),M=A("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,F=function(){function I(O){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=O?O.xhrSetup:null,this.stats=new M.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 b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},R.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(b,C,L){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=C,this.callbacks=L,this.retryDelay=C.retryDelay,this.loadInternal()},R.loadInternal=function(){var b=this.config,C=this.context;if(!b)return;var L=this.loader=new self.XMLHttpRequest,S=this.stats;S.loading.first=0,S.loaded=0;var w=this.xhrSetup;try{if(w)try{w(L,C.url)}catch(o){L.open("GET",C.url,!0),w(L,C.url)}L.readyState||L.open("GET",C.url,!0);var T=this.context.headers;if(T)for(var c in T)L.setRequestHeader(c,T[c])}catch(o){this.callbacks.onError({code:L.status,text:o.message},C,L);return}C.rangeEnd&&L.setRequestHeader("Range","bytes="+C.rangeStart+"-"+(C.rangeEnd-1)),L.onreadystatechange=this.readystatechange.bind(this),L.onprogress=this.loadprogress.bind(this),L.responseType=C.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),L.send()},R.readystatechange=function(){var b=this.context,C=this.loader,L=this.stats;if(!b||!C)return;var S=C.readyState,w=this.config;if(L.aborted)return;if(S>=2)if(self.clearTimeout(this.requestTimeout),L.loading.first===0&&(L.loading.first=Math.max(self.performance.now(),L.loading.start)),S===4){C.onreadystatechange=null,C.onprogress=null;var T=C.status;if(T>=200&&T<300){L.loading.end=Math.max(self.performance.now(),L.loading.first);var c,o;if(b.responseType==="arraybuffer"?(c=C.response,o=c.byteLength):(c=C.responseText,o=c.length),L.loaded=L.total=o,!this.callbacks)return;var d=this.callbacks.onProgress;if(d&&d(L,b,c,C),!this.callbacks)return;var u={url:C.responseURL,data:c};this.callbacks.onSuccess(u,L,b,C)}else L.retry>=w.maxRetry||T>=400&&T<499?(H.logger.error(T+" while loading "+b.url),this.callbacks.onError({code:T,text:C.statusText},b,C)):(H.logger.warn(T+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),L.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},R.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(b){var C=this.stats;C.loaded=b.loaded,b.lengthComputable&&(C.total=b.total)},R.getCacheAge=function(){var b=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var C=this.loader.getResponseHeader("age");b=C?parseFloat(C):null}return b},I}();G.default=F}}).default})}}]);
|