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.
437 lines
1.2 MiB
437 lines
1.2 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[191,3,5,7,8,19],{"+NIl":function(Fe,Se,W){(function(q){q(W("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(V,M){"use strict";function z(d,s){d.cmdState.push(s)}function U(d){return d.cmdState.length>0?d.cmdState[d.cmdState.length-1]:null}function L(d){var s=d.cmdState.pop();s&&s.closeBracket()}function H(d){for(var s=d.cmdState,l=s.length-1;l>=0;l--){var r=s[l];if(r.name=="DEFAULT")continue;return r}return{styleIdentifier:function(){return null}}}function F(d,s,l){return function(){this.name=d,this.bracketNo=0,this.style=s,this.styles=l,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=F("importmodule","tag",["string","builtin"]),D.documentclass=F("documentclass","tag",["","atom"]),D.usepackage=F("usepackage","tag",["atom"]),D.begin=F("begin","tag",["atom"]),D.end=F("end","tag",["atom"]),D.label=F("label","tag",["atom"]),D.ref=F("ref","tag",["atom"]),D.eqref=F("eqref","tag",["atom"]),D.cite=F("cite","tag",["atom"]),D.bibitem=F("bibitem","tag",["atom"]),D.Bibitem=F("Bibitem","tag",["atom"]),D.RBibitem=F("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function I(d,s){d.f=s}function g(d,s){var l;if(d.match(/^\\[a-zA-Z@]+/)){var r=d.current().slice(1);return l=D.hasOwnProperty(r)?D[r]:D.DEFAULT,l=new l,z(s,l),I(s,u),l.style}if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/\\]/))return"tag";if(d.match("\\["))return I(s,function(n,h){return f(n,h,"\\]")}),"keyword";if(d.match("\\("))return I(s,function(n,h){return f(n,h,"\\)")}),"keyword";if(d.match("$$"))return I(s,function(n,h){return f(n,h,"$$")}),"keyword";if(d.match("$"))return I(s,function(n,h){return f(n,h,"$")}),"keyword";var a=d.next();if(a=="%")return d.skipToEnd(),"comment";if(a=="}"||a=="]"){if(l=U(s),l)l.closeBracket(a),I(s,u);else return"error";return"bracket"}else return a=="{"||a=="["?(l=D.DEFAULT,l=new l,z(s,l),"bracket"):/\d/.test(a)?(d.eatWhile(/[\w.%]/),"atom"):(d.eatWhile(/[\w\-_]/),l=H(s),l.name=="begin"&&(l.argument=d.current()),l.styleIdentifier())}function f(d,s,l){if(d.eatSpace())return null;if(l&&d.match(l))return I(s,g),"keyword";if(d.match(/^\\[a-zA-Z@]+/))return"tag";if(d.match(/^[a-zA-Z]+/))return"variable-2";if(d.match(/^\\[$&%#{}_]/))return"tag";if(d.match(/^\\[,;!\/]/))return"tag";if(d.match(/^[\^_&]/))return"tag";if(d.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(d.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var r=d.next();return r=="{"||r=="}"||r=="["||r=="]"||r=="("||r==")"?"bracket":r=="%"?(d.skipToEnd(),"comment"):"error"}function u(d,s){var l=d.peek(),r;return l=="{"||l=="["?(r=U(s),r.openBracket(l),d.eat(l),I(s,g),"bracket"):/[ \t\r]/.test(l)?(d.eat(l),null):(I(s,g),L(s),g(d,s))}return{startState:function(){var d=M.inMathMode?function(s,l){return f(s,l)}:g;return{cmdState:[],f:d}},copyState:function(d){return{cmdState:d.cmdState.slice(),f:d.f}},token:function(d,s){return s.f(d,s)},blankLine:function(d){d.f=g,d.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+aKw":function(Fe,Se,W){"use strict";var q=W("tJVT"),V=W("q1tI"),M=W.n(V),z=function(H){return String(H).length===1?"0".concat(H):H},U=function(H){var F=H.className,D=F===void 0?"":F,I=H.onChange,g=H.defaultValue,f=g===void 0?0:g,u=Object(V.useState)(f),d=Object(q.a)(u,2),s=d[0],l=d[1];Object(V.useEffect)(function(){var h=setTimeout(function(){l(s+1e3)},1e3);return I(s+1e3),function(){clearInterval(h)}},[s]);var r=parseInt(s/(60*6e4))||"00",a=parseInt(s%(60*6e4)/6e4)||"00",n=parseInt(s%6e4/1e3)||"00";return M.a.createElement("div",{className:D},z(r),":",z(a),":",z(n))};Se.a=U},"+k/U":function(Fe,Se,W){Fe.exports={pagination:"pagination___2XcQw",info:"info___12Y4R"}},"+ua5":function(Fe,Se,W){},"07cG":function(Fe,Se,W){Fe.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(Fe,Se,W){(function(q){q(W("VrN/"))})(function(q){q.defineOption("placeholder","",function(F,D,I){var g=I&&I!=q.Init;if(D&&!g)F.on("blur",U),F.on("change",L),F.on("swapDoc",L),q.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){z(F)}),L(F);else if(!D&&g){F.off("blur",U),F.off("change",L),F.off("swapDoc",L),q.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),V(F);var f=F.getWrapperElement();f.className=f.className.replace(" CodeMirror-empty","")}D&&!F.hasFocus()&&U(F)});function V(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function M(F){V(F);var D=F.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=F.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var I=F.getOption("placeholder");typeof I=="string"&&(I=document.createTextNode(I)),D.appendChild(I),F.display.lineSpace.insertBefore(D,F.display.lineSpace.firstChild)}function z(F){setTimeout(function(){var D=!1,I=F.getInputField();I.nodeName=="TEXTAREA"?D=!I.value:F.lineCount()==1&&(D=!/[^\u200b]/.test(I.querySelector(".CodeMirror-line").textContent)),D?M(F):V(F)},20)}function U(F){H(F)&&M(F)}function L(F){var D=F.getWrapperElement(),I=H(F);D.className=D.className.replace(" CodeMirror-empty","")+(I?" CodeMirror-empty":""),I?M(F):V(F)}function H(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(Fe,Se,W){(function(q){q(W("VrN/"))})(function(q){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},M={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(z,U){var L=z.indentUnit,H={},F=U.htmlMode?V:M;for(var D in F)H[D]=F[D];for(var D in U)H[D]=U[D];var I,g;function f(c,E){function y(N){return E.tokenize=N,N(c,E)}var _=c.next();if(_=="<")return c.eat("!")?c.eat("[")?c.match("CDATA[")?y(s("atom","]]>")):null:c.match("--")?y(s("comment","-->")):c.match("DOCTYPE",!0,!0)?(c.eatWhile(/[\w\._\-]/),y(l(1))):null:c.eat("?")?(c.eatWhile(/[\w\._\-]/),E.tokenize=s("meta","?>"),"meta"):(I=c.eat("/")?"closeTag":"openTag",E.tokenize=u,"tag bracket");if(_=="&"){var P;return c.eat("#")?c.eat("x")?P=c.eatWhile(/[a-fA-F\d]/)&&c.eat(";"):P=c.eatWhile(/[\d]/)&&c.eat(";"):P=c.eatWhile(/[\w\.\-:]/)&&c.eat(";"),P?"atom":"error"}else return c.eatWhile(/[^&<]/),null}f.isInText=!0;function u(c,E){var y=c.next();if(y==">"||y=="/"&&c.eat(">"))return E.tokenize=f,I=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return I="equals",null;if(y=="<"){E.tokenize=f,E.state=h,E.tagName=E.tagStart=null;var _=E.tokenize(c,E);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(y)?(E.tokenize=d(y),E.stringStartCol=c.column(),E.tokenize(c,E)):(c.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function d(c){var E=function(y,_){for(;!y.eol();)if(y.next()==c){_.tokenize=u;break}return"string"};return E.isInAttribute=!0,E}function s(c,E){return function(y,_){for(;!y.eol();){if(y.match(E)){_.tokenize=f;break}y.next()}return c}}function l(c){return function(E,y){for(var _;(_=E.next())!=null;){if(_=="<")return y.tokenize=l(c+1),y.tokenize(E,y);if(_==">")if(c==1){y.tokenize=f;break}else return y.tokenize=l(c-1),y.tokenize(E,y)}return"meta"}}function r(c,E,y){this.prev=c.context,this.tagName=E,this.indent=c.indented,this.startOfLine=y,(H.doNotIndent.hasOwnProperty(E)||c.context&&c.context.noIndent)&&(this.noIndent=!0)}function a(c){c.context&&(c.context=c.context.prev)}function n(c,E){for(var y;;){if(!c.context)return;if(y=c.context.tagName,!H.contextGrabbers.hasOwnProperty(y)||!H.contextGrabbers[y].hasOwnProperty(E))return;a(c)}}function h(c,E,y){return c=="openTag"?(y.tagStart=E.column(),O):c=="closeTag"?S:h}function O(c,E,y){return c=="word"?(y.tagName=E.current(),g="tag",C):H.allowMissingTagName&&c=="endTag"?(g="tag bracket",C(c,E,y)):(g="error",O)}function S(c,E,y){if(c=="word"){var _=E.current();return y.context&&y.context.tagName!=_&&H.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==_||H.matchClosing===!1?(g="tag",x):(g="tag error",A)}else return H.allowMissingTagName&&c=="endTag"?(g="tag bracket",x(c,E,y)):(g="error",A)}function x(c,E,y){return c!="endTag"?(g="error",x):(a(y),h)}function A(c,E,y){return g="error",x(c,E,y)}function C(c,E,y){if(c=="word")return g="attribute",b;if(c=="endTag"||c=="selfcloseTag"){var _=y.tagName,P=y.tagStart;return y.tagName=y.tagStart=null,c=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(_)?n(y,_):(n(y,_),y.context=new r(y,_,P==y.indented)),h}return g="error",C}function b(c,E,y){return c=="equals"?v:(H.allowMissing||(g="error"),C(c,E,y))}function v(c,E,y){return c=="string"?p:c=="word"&&H.allowUnquoted?(g="string",C):(g="error",C(c,E,y))}function p(c,E,y){return c=="string"?p:C(c,E,y)}return{startState:function(c){var E={tokenize:f,state:h,indented:c||0,tagName:null,tagStart:null,context:null};return c!=null&&(E.baseIndent=c),E},token:function(c,E){if(!E.tagName&&c.sol()&&(E.indented=c.indentation()),c.eatSpace())return null;I=null;var y=E.tokenize(c,E);return(y||I)&&y!="comment"&&(g=null,E.state=E.state(I||y,c,E),g&&(y=g=="error"?y+" error":g)),y},indent:function(c,E,y){var _=c.context;if(c.tokenize.isInAttribute)return c.tagStart==c.indented?c.stringStartCol+1:c.indented+L;if(_&&_.noIndent)return q.Pass;if(c.tokenize!=u&&c.tokenize!=f)return y?y.match(/^(\s*)/)[0].length:0;if(c.tagName)return H.multilineTagIndentPastTag!==!1?c.tagStart+c.tagName.length+2:c.tagStart+L*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var P=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(P&&P[1])for(;_;)if(_.tagName==P[2]){_=_.prev;break}else if(H.implicitlyClosed.hasOwnProperty(_.tagName))_=_.prev;else break;else if(P)for(;_;){var N=H.contextGrabbers[_.tagName];if(N&&N.hasOwnProperty(P[2]))_=_.prev;else break}for(;_&&_.prev&&!_.startOfLine;)_=_.prev;return _?_.indent+L:c.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(c){c.state==v&&(c.state=C)},xmlCurrentTag:function(c){return c.tagName?{name:c.tagName,close:c.type=="closeTag"}:null},xmlCurrentContext:function(c){for(var E=[],y=c.context;y;y=y.prev)y.tagName&&E.push(y.tagName);return E.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1j5w":function(Fe,Se,W){"use strict";W.d(Se,"d",function(){return vt}),W.d(Se,"b",function(){return be}),W.d(Se,"c",function(){return Xe}),W.d(Se,"a",function(){return bt});var q=W("VTBJ"),V=W("1OyB"),M=W("vuIU"),z=W("JX7q"),U=W("Ji7U"),L=W("LK+K"),H=W("q1tI"),F=W("I8Z2"),D=W("BGR+"),I=W("wx14"),g=W("rePB"),f=W("4IlW"),u=W("2GS6"),d=W("Gytx"),s=W.n(d),l=W("TSYQ"),r=W.n(l),a=W("U8pU"),n=W("ODXe"),h=/iPhone/i,O=/iPod/i,S=/iPad/i,x=/\bAndroid(?:.+)Mobile\b/i,A=/Android/i,C=/\bAndroid(?:.+)SD4930UR\b/i,b=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,v=/Windows Phone/i,p=/\bWindows(?:.+)ARM\b/i,c=/BlackBerry/i,E=/BB10/i,y=/Opera Mini/i,_=/\b(CriOS|Chrome)(?:.+)Mobile/i,P=/Mobile(?:.+)Firefox\b/i;function N(at,Be){return at.test(Be)}function K(at){var Be=at||(typeof navigator!="undefined"?navigator.userAgent:""),We=Be.split("[FBAN");if(typeof We[1]!="undefined"){var Me=We,se=Object(n.a)(Me,1);Be=se[0]}if(We=Be.split("Twitter"),typeof We[1]!="undefined"){var ve=We,Ke=Object(n.a)(ve,1);Be=Ke[0]}var Pe={apple:{phone:N(h,Be)&&!N(v,Be),ipod:N(O,Be),tablet:!N(h,Be)&&N(S,Be)&&!N(v,Be),device:(N(h,Be)||N(O,Be)||N(S,Be))&&!N(v,Be)},amazon:{phone:N(C,Be),tablet:!N(C,Be)&&N(b,Be),device:N(C,Be)||N(b,Be)},android:{phone:!N(v,Be)&&N(C,Be)||!N(v,Be)&&N(x,Be),tablet:!N(v,Be)&&!N(C,Be)&&!N(x,Be)&&(N(b,Be)||N(A,Be)),device:!N(v,Be)&&(N(C,Be)||N(b,Be)||N(x,Be)||N(A,Be))||N(/\bokhttp\b/i,Be)},windows:{phone:N(v,Be),tablet:N(p,Be),device:N(v,Be)||N(p,Be)},other:{blackberry:N(c,Be),blackberry10:N(E,Be),opera:N(y,Be),firefox:N(P,Be),chrome:N(_,Be),device:N(c,Be)||N(E,Be)||N(y,Be)||N(P,Be)||N(_,Be)},any:null,phone:null,tablet:null};return Pe.any=Pe.apple.device||Pe.android.device||Pe.windows.device||Pe.other.device,Pe.phone=Pe.apple.phone||Pe.android.phone||Pe.windows.phone,Pe.tablet=Pe.apple.tablet||Pe.android.tablet||Pe.windows.tablet,Pe}var $=Object(q.a)(Object(q.a)({},K()),{},{isMobile:K}),B=$;function R(){}function G(at,Be,We){var Me=Be||"";return at.key||"".concat(Me,"item_").concat(We)}function Q(at){return"".concat(at,"-menu-")}function ne(at,Be){var We=-1;H.Children.forEach(at,function(Me){We+=1,Me&&Me.type&&Me.type.isMenuItemGroup?H.Children.forEach(Me.props.children,function(se){We+=1,Be(se,We)}):Be(Me,We)})}function le(at,Be,We){if(!at||We.find)return;H.Children.forEach(at,function(Me){if(Me){var se=Me.type;if(!se||!(se.isSubMenu||se.isMenuItem||se.isMenuItemGroup))return;Be.indexOf(Me.key)!==-1?We.find=!0:Me.props.children&&le(Me.props.children,Be,We)}})}var _e=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],pe=function(Be){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Me=Be&&typeof Be.getBoundingClientRect=="function"&&Be.getBoundingClientRect().width;if(Me){if(We){var se=getComputedStyle(Be),ve=se.marginLeft,Ke=se.marginRight;Me+=+ve.replace("px","")+ +Ke.replace("px","")}Me=+Me.toFixed(6)}return Me||0},Ee=function(Be,We,Me){Be&&Object(a.a)(Be.style)==="object"&&(Be.style[We]=Me)},Oe=function(){return B.any},we=W("KQm4"),he=W("Ff2n"),oe=W("i8i4"),Le=W("bdgK"),Ye=W("uciX"),nt=W("8XRh"),qe={adjustX:1,adjustY:1},it={topLeft:{points:["bl","tl"],overflow:qe,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:qe,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:qe,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:qe,offset:[4,0]}},He={topLeft:{points:["bl","tl"],overflow:qe,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:qe,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:qe,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:qe,offset:[4,0]}},$e=it,Qe=0,gt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},et=function(Be,We,Me){var se=Q(We),ve=Be.getState();Be.setState({defaultActiveFirst:Object(q.a)(Object(q.a)({},ve.defaultActiveFirst),{},Object(g.a)({},se,Me))})},tt=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(Me){var se;Object(V.a)(this,We),se=Be.call(this,Me),se.onDestroy=function(Te){se.props.onDestroy(Te)},se.onKeyDown=function(Te){var ke=Te.keyCode,rt=se.menuInstance,Ct=se.props,At=Ct.isOpen,cn=Ct.store;if(ke===f.a.ENTER)return se.onTitleClick(Te),et(cn,se.props.eventKey,!0),!0;if(ke===f.a.RIGHT)return At?rt.onKeyDown(Te):(se.triggerOpenChange(!0),et(cn,se.props.eventKey,!0)),!0;if(ke===f.a.LEFT){var yn;if(At)yn=rt.onKeyDown(Te);else return;return yn||(se.triggerOpenChange(!1),yn=!0),yn}return At&&(ke===f.a.UP||ke===f.a.DOWN)?rt.onKeyDown(Te):void 0},se.onOpenChange=function(Te){se.props.onOpenChange(Te)},se.onPopupVisibleChange=function(Te){se.triggerOpenChange(Te,Te?"mouseenter":"mouseleave")},se.onMouseEnter=function(Te){var ke=se.props,rt=ke.eventKey,Ct=ke.onMouseEnter,At=ke.store;et(At,se.props.eventKey,!1),Ct({key:rt,domEvent:Te})},se.onMouseLeave=function(Te){var ke=se.props,rt=ke.parentMenu,Ct=ke.eventKey,At=ke.onMouseLeave;rt.subMenuInstance=Object(z.a)(se),At({key:Ct,domEvent:Te})},se.onTitleMouseEnter=function(Te){var ke=se.props,rt=ke.eventKey,Ct=ke.onItemHover,At=ke.onTitleMouseEnter;Ct({key:rt,hover:!0}),At({key:rt,domEvent:Te})},se.onTitleMouseLeave=function(Te){var ke=se.props,rt=ke.parentMenu,Ct=ke.eventKey,At=ke.onItemHover,cn=ke.onTitleMouseLeave;rt.subMenuInstance=Object(z.a)(se),At({key:Ct,hover:!1}),cn({key:Ct,domEvent:Te})},se.onTitleClick=function(Te){var ke=Object(z.a)(se),rt=ke.props;if(rt.onTitleClick({key:rt.eventKey,domEvent:Te}),rt.triggerSubMenuAction==="hover")return;se.triggerOpenChange(!rt.isOpen,"click"),et(rt.store,se.props.eventKey,!1)},se.onSubMenuClick=function(Te){typeof se.props.onClick=="function"&&se.props.onClick(se.addKeyPath(Te))},se.onSelect=function(Te){se.props.onSelect(Te)},se.onDeselect=function(Te){se.props.onDeselect(Te)},se.getPrefixCls=function(){return"".concat(se.props.rootPrefixCls,"-submenu")},se.getActiveClassName=function(){return"".concat(se.getPrefixCls(),"-active")},se.getDisabledClassName=function(){return"".concat(se.getPrefixCls(),"-disabled")},se.getSelectedClassName=function(){return"".concat(se.getPrefixCls(),"-selected")},se.getOpenClassName=function(){return"".concat(se.props.rootPrefixCls,"-submenu-open")},se.saveMenuInstance=function(Te){se.menuInstance=Te},se.addKeyPath=function(Te){return Object(q.a)(Object(q.a)({},Te),{},{keyPath:(Te.keyPath||[]).concat(se.props.eventKey)})},se.triggerOpenChange=function(Te,ke){var rt=se.props.eventKey,Ct=function(){se.onOpenChange({key:rt,item:Object(z.a)(se),trigger:ke,open:Te})};ke==="mouseenter"?se.mouseenterTimeout=setTimeout(function(){Ct()},0):Ct()},se.isChildrenSelected=function(){var Te={find:!1};return le(se.props.children,se.props.selectedKeys,Te),Te.find},se.isOpen=function(){return se.props.openKeys.indexOf(se.props.eventKey)!==-1},se.adjustWidth=function(){if(!se.subMenuTitle||!se.menuInstance)return;var Te=oe.findDOMNode(se.menuInstance);if(Te.offsetWidth>=se.subMenuTitle.offsetWidth)return;Te.style.minWidth="".concat(se.subMenuTitle.offsetWidth,"px")},se.saveSubMenuTitle=function(Te){se.subMenuTitle=Te},se.getBaseProps=function(){var Te=Object(z.a)(se),ke=Te.props;return{mode:ke.mode==="horizontal"?"vertical":ke.mode,visible:se.props.isOpen,level:ke.level+1,inlineIndent:ke.inlineIndent,focusable:!1,onClick:se.onSubMenuClick,onSelect:se.onSelect,onDeselect:se.onDeselect,onDestroy:se.onDestroy,selectedKeys:ke.selectedKeys,eventKey:"".concat(ke.eventKey,"-menu-"),openKeys:ke.openKeys,motion:ke.motion,onOpenChange:se.onOpenChange,subMenuOpenDelay:ke.subMenuOpenDelay,parentMenu:Object(z.a)(se),subMenuCloseDelay:ke.subMenuCloseDelay,forceSubMenuRender:ke.forceSubMenuRender,triggerSubMenuAction:ke.triggerSubMenuAction,builtinPlacements:ke.builtinPlacements,defaultActiveFirst:ke.store.getState().defaultActiveFirst[Q(ke.eventKey)],multiple:ke.multiple,prefixCls:ke.rootPrefixCls,id:se.internalMenuId,manualRef:se.saveMenuInstance,itemIcon:ke.itemIcon,expandIcon:ke.expandIcon,direction:ke.direction}},se.getMotion=function(Te,ke){var rt=Object(z.a)(se),Ct=rt.haveRendered,At=se.props,cn=At.motion,yn=At.rootPrefixCls,en=Object(q.a)(Object(q.a)({},cn),{},{leavedClassName:"".concat(yn,"-hidden"),removeOnLeave:!1,motionAppear:Ct||!ke||Te!=="inline"});return en};var ve=Me.store,Ke=Me.eventKey,Pe=ve.getState(),st=Pe.defaultActiveFirst;se.isRootMenu=!1;var dt=!1;return st&&(dt=st[Ke]),et(ve,Ke,dt),se}return Object(M.a)(We,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var se=this,ve=this.props,Ke=ve.mode,Pe=ve.parentMenu,st=ve.manualRef;if(st&&st(this),Ke!=="horizontal"||!Pe.isRootMenu||!this.props.isOpen)return;this.minWidthTimeout=setTimeout(function(){return se.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var se=this.props,ve=se.onDestroy,Ke=se.eventKey;ve&&ve(Ke),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout)}},{key:"renderChildren",value:function(se){var ve=this,Ke=this.getBaseProps(),Pe=this.getMotion(Ke.mode,Ke.visible);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||Ke.visible||Ke.forceSubMenuRender,!this.haveOpened)return H.createElement("div",null);var st=Ke.direction;return H.createElement(nt.default,Object.assign({visible:Ke.visible},Pe),function(dt){var Te=dt.className,ke=dt.style,rt=r()("".concat(Ke.prefixCls,"-sub"),Te,Object(g.a)({},"".concat(Ke.prefixCls,"-rtl"),st==="rtl"));return H.createElement(ge,Object.assign({},Ke,{id:ve.internalMenuId,className:rt,style:ke}),se)})}},{key:"render",value:function(){var se,ve=Object(q.a)({},this.props),Ke=ve.isOpen,Pe=this.getPrefixCls(),st=ve.mode==="inline",dt=r()(Pe,"".concat(Pe,"-").concat(ve.mode),(se={},Object(g.a)(se,ve.className,!!ve.className),Object(g.a)(se,this.getOpenClassName(),Ke),Object(g.a)(se,this.getActiveClassName(),ve.active||Ke&&!st),Object(g.a)(se,this.getDisabledClassName(),ve.disabled),Object(g.a)(se,this.getSelectedClassName(),this.isChildrenSelected()),se));this.internalMenuId||(ve.eventKey?this.internalMenuId="".concat(ve.eventKey,"$Menu"):(Qe+=1,this.internalMenuId="$__$".concat(Qe,"$Menu")));var Te={},ke={},rt={};ve.disabled||(Te={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},ke={onClick:this.onTitleClick},rt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Ct={},At=ve.direction;st&&(At==="rtl"?Ct.paddingRight=ve.inlineIndent*ve.level:Ct.paddingLeft=ve.inlineIndent*ve.level);var cn={};this.props.isOpen&&(cn={"aria-owns":this.internalMenuId});var yn=null;ve.mode!=="horizontal"&&(yn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(yn=H.createElement(this.props.expandIcon,Object(q.a)({},this.props))));var en=H.createElement("div",Object.assign({ref:this.saveSubMenuTitle,style:Ct,className:"".concat(Pe,"-title"),role:"button"},rt,ke,{"aria-expanded":Ke},cn,{"aria-haspopup":"true",title:typeof ve.title=="string"?ve.title:void 0}),ve.title,yn||H.createElement("i",{className:"".concat(Pe,"-arrow")})),Dt=this.renderChildren(ve.children),Rn=ve.parentMenu.isRootMenu?ve.parentMenu.props.getPopupContainer:function(ui){return ui.parentNode},Fn=gt[ve.mode],Cn=ve.popupOffset?{offset:ve.popupOffset}:{},Qt=ve.mode==="inline"?"":ve.popupClassName;Qt+=At==="rtl"?" ".concat(Pe,"-rtl"):"";var Sn=ve.disabled,Bn=ve.triggerSubMenuAction,li=ve.subMenuOpenDelay,ct=ve.forceSubMenuRender,St=ve.subMenuCloseDelay,zn=ve.builtinPlacements;_e.forEach(function(ui){return delete ve[ui]}),delete ve.onClick;var pi=At==="rtl"?Object.assign({},He,zn):Object.assign({},it,zn);return delete ve.direction,H.createElement("li",Object.assign({},ve,Te,{className:dt,role:"menuitem"}),st&&en,st&&Dt,!st&&H.createElement(Ye.a,{prefixCls:Pe,popupClassName:r()("".concat(Pe,"-popup"),Qt),getPopupContainer:Rn,builtinPlacements:pi,popupPlacement:Fn,popupVisible:Ke,popupAlign:Cn,popup:Dt,action:Sn?[]:[Bn],mouseEnterDelay:li,mouseLeaveDelay:St,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:ct},en))}}]),We}(H.Component);tt.defaultProps={onMouseEnter:R,onMouseLeave:R,onTitleMouseEnter:R,onTitleMouseLeave:R,onTitleClick:R,manualRef:R,mode:"vertical",title:""};var Je=Object(F.b)(function(at,Be){var We=at.openKeys,Me=at.activeKey,se=at.selectedKeys,ve=Be.eventKey,Ke=Be.subMenuKey;return{isOpen:We.indexOf(ve)>-1,active:Me[Ke]===ve,selectedKeys:se}})(tt);Je.isSubMenu=!0;var vt=Je,wt="menuitem-overflowed",Et=.5,xt=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(){var Me;return Object(V.a)(this,We),Me=Be.apply(this,arguments),Me.resizeObserver=null,Me.mutationObserver=null,Me.originalTotalWidth=0,Me.overflowedItems=[],Me.menuItemSizes=[],Me.cancelFrameId=null,Me.state={lastVisibleIndex:void 0},Me.getMenuItemNodes=function(){var se=Me.props.prefixCls,ve=oe.findDOMNode(Object(z.a)(Me));return ve?[].slice.call(ve.children).filter(function(Ke){return Ke.className.split(" ").indexOf("".concat(se,"-overflowed-submenu"))<0}):[]},Me.getOverflowedSubMenuItem=function(se,ve,Ke){var Pe=Me.props,st=Pe.overflowedIndicator,dt=Pe.level,Te=Pe.mode,ke=Pe.prefixCls,rt=Pe.theme;if(dt!==1||Te!=="horizontal")return null;var Ct=Me.props.children[0],At=Ct.props,cn=At.children,yn=At.title,en=At.style,Dt=Object(he.a)(At,["children","title","style"]),Rn=Object(q.a)({},en),Fn="".concat(se,"-overflowed-indicator"),Cn="".concat(se,"-overflowed-indicator");ve.length===0&&Ke!==!0?Rn=Object(q.a)(Object(q.a)({},Rn),{},{display:"none"}):Ke&&(Rn=Object(q.a)(Object(q.a)({},Rn),{},{visibility:"hidden",position:"absolute"}),Fn="".concat(Fn,"-placeholder"),Cn="".concat(Cn,"-placeholder"));var Qt=rt?"".concat(ke,"-").concat(rt):"",Sn={};return _e.forEach(function(Bn){Dt[Bn]!==void 0&&(Sn[Bn]=Dt[Bn])}),H.createElement(vt,Object.assign({title:st,className:"".concat(ke,"-overflowed-submenu"),popupClassName:Qt},Sn,{key:Fn,eventKey:Cn,disabled:!1,style:Rn}),ve)},Me.setChildrenWidthAndResize=function(){if(Me.props.mode!=="horizontal")return;var se=oe.findDOMNode(Object(z.a)(Me));if(!se)return;var ve=se.children;if(!ve||ve.length===0)return;var Ke=se.children[ve.length-1];Ee(Ke,"display","inline-block");var Pe=Me.getMenuItemNodes(),st=Pe.filter(function(dt){return dt.className.split(" ").indexOf(wt)>=0});st.forEach(function(dt){Ee(dt,"display","inline-block")}),Me.menuItemSizes=Pe.map(function(dt){return pe(dt,!0)}),st.forEach(function(dt){Ee(dt,"display","none")}),Me.overflowedIndicatorWidth=pe(se.children[se.children.length-1],!0),Me.originalTotalWidth=Me.menuItemSizes.reduce(function(dt,Te){return dt+Te},0),Me.handleResize(),Ee(Ke,"display","none")},Me.handleResize=function(){if(Me.props.mode!=="horizontal")return;var se=oe.findDOMNode(Object(z.a)(Me));if(!se)return;var ve=pe(se);Me.overflowedItems=[];var Ke=0,Pe;Me.originalTotalWidth>ve+Et&&(Pe=-1,Me.menuItemSizes.forEach(function(st){Ke+=st,Ke+Me.overflowedIndicatorWidth<=ve&&(Pe+=1)})),Me.setState({lastVisibleIndex:Pe})},Me}return Object(M.a)(We,[{key:"componentDidMount",value:function(){var se=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var ve=oe.findDOMNode(this);if(!ve)return;this.resizeObserver=new Le.default(function(Ke){Ke.forEach(function(){var Pe=se.cancelFrameId;cancelAnimationFrame(Pe),se.cancelFrameId=requestAnimationFrame(se.setChildrenWidthAndResize)})}),[].slice.call(ve.children).concat(ve).forEach(function(Ke){se.resizeObserver.observe(Ke)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){se.resizeObserver.disconnect(),[].slice.call(ve.children).concat(ve).forEach(function(Ke){se.resizeObserver.observe(Ke)}),se.setChildrenWidthAndResize()}),this.mutationObserver.observe(ve,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(se){var ve=this,Ke=this.state.lastVisibleIndex;return(se||[]).reduce(function(Pe,st,dt){var Te=st;if(ve.props.mode==="horizontal"){var ke=ve.getOverflowedSubMenuItem(st.props.eventKey,[]);Ke!==void 0&&ve.props.className.indexOf("".concat(ve.props.prefixCls,"-root"))!==-1&&(dt>Ke&&(Te=H.cloneElement(st,{style:{display:"none"},eventKey:"".concat(st.props.eventKey,"-hidden"),className:"".concat(wt)})),dt===Ke+1&&(ve.overflowedItems=se.slice(Ke+1).map(function(Ct){return H.cloneElement(Ct,{key:Ct.props.eventKey,mode:"vertical-left"})}),ke=ve.getOverflowedSubMenuItem(st.props.eventKey,ve.overflowedItems)));var rt=[].concat(Object(we.a)(Pe),[ke,Te]);return dt===se.length-1&&rt.push(ve.getOverflowedSubMenuItem(st.props.eventKey,[],!0)),rt}return[].concat(Object(we.a)(Pe),[Te])},[])}},{key:"render",value:function(){var se=this.props,ve=se.visible,Ke=se.prefixCls,Pe=se.overflowedIndicator,st=se.mode,dt=se.level,Te=se.tag,ke=se.children,rt=se.theme,Ct=Object(he.a)(se,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),At=Te;return H.createElement(At,Object.assign({},Ct),this.renderChildren(ke))}}]),We}(H.Component);xt.defaultProps={tag:"div",className:""};var kt=xt;function Ot(at){return at.length?at.every(function(Be){return!!Be.props.disabled}):!0}function Ae(at,Be,We){var Me=at.getState();at.setState({activeKey:Object(q.a)(Object(q.a)({},Me.activeKey),{},Object(g.a)({},Be,We))})}function Ce(at){return at.eventKey||"0-menu-"}function Ge(at,Be){var We=Be,Me=at.children,se=at.eventKey;if(We){var ve;if(ne(Me,function(Ke,Pe){Ke&&Ke.props&&!Ke.props.disabled&&We===G(Ke,se,Pe)&&(ve=!0)}),ve)return We}return We=null,at.defaultActiveFirst&&ne(Me,function(Ke,Pe){!We&&Ke&&!Ke.props.disabled&&(We=G(Ke,se,Pe))}),We}function ze(at){if(at){var Be=this.instanceArray.indexOf(at);Be!==-1?this.instanceArray[Be]=at:this.instanceArray.push(at)}}var Re=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(Me){var se;return Object(V.a)(this,We),se=Be.call(this,Me),se.onKeyDown=function(ve,Ke){var Pe=ve.keyCode,st;if(se.getFlatInstanceArray().forEach(function(Te){Te&&Te.props.active&&Te.onKeyDown&&(st=Te.onKeyDown(ve))}),st)return 1;var dt=null;return(Pe===f.a.UP||Pe===f.a.DOWN)&&(dt=se.step(Pe===f.a.UP?-1:1)),dt?(ve.preventDefault(),Ae(se.props.store,Ce(se.props),dt.props.eventKey),typeof Ke=="function"&&Ke(dt),1):void 0},se.onItemHover=function(ve){var Ke=ve.key,Pe=ve.hover;Ae(se.props.store,Ce(se.props),Pe?Ke:null)},se.onDeselect=function(ve){se.props.onDeselect(ve)},se.onSelect=function(ve){se.props.onSelect(ve)},se.onClick=function(ve){se.props.onClick(ve)},se.onOpenChange=function(ve){se.props.onOpenChange(ve)},se.onDestroy=function(ve){se.props.onDestroy(ve)},se.getFlatInstanceArray=function(){return se.instanceArray},se.step=function(ve){var Ke=se.getFlatInstanceArray(),Pe=se.props.store.getState().activeKey[Ce(se.props)],st=Ke.length;if(!st)return null;ve<0&&(Ke=Ke.concat().reverse());var dt=-1;if(Ke.every(function(Ct,At){return Ct&&Ct.props.eventKey===Pe?(dt=At,!1):!0}),!se.props.defaultActiveFirst&&dt!==-1&&Ot(Ke.slice(dt,st-1)))return;var Te=(dt+1)%st,ke=Te;do{var rt=Ke[ke];if(!rt||rt.props.disabled)ke=(ke+1)%st;else return rt}while(ke!==Te);return null},se.renderCommonMenuItem=function(ve,Ke,Pe){var st=se.props.store.getState(),dt=Object(z.a)(se),Te=dt.props,ke=G(ve,Te.eventKey,Ke),rt=ve.props;if(!rt||typeof ve.type=="string")return ve;var Ct=ke===st.activeKey,At=Object(q.a)(Object(q.a)({mode:rt.mode||Te.mode,level:Te.level,inlineIndent:Te.inlineIndent,renderMenuItem:se.renderMenuItem,rootPrefixCls:Te.prefixCls,index:Ke,parentMenu:Te.parentMenu,manualRef:rt.disabled?void 0:Object(u.a)(ve.ref,ze.bind(Object(z.a)(se))),eventKey:ke,active:!rt.disabled&&Ct,multiple:Te.multiple,onClick:function(yn){(rt.onClick||R)(yn),se.onClick(yn)},onItemHover:se.onItemHover,motion:Te.motion,subMenuOpenDelay:Te.subMenuOpenDelay,subMenuCloseDelay:Te.subMenuCloseDelay,forceSubMenuRender:Te.forceSubMenuRender,onOpenChange:se.onOpenChange,onDeselect:se.onDeselect,onSelect:se.onSelect,builtinPlacements:Te.builtinPlacements,itemIcon:rt.itemIcon||se.props.itemIcon,expandIcon:rt.expandIcon||se.props.expandIcon},Pe),{},{direction:Te.direction});return(Te.mode==="inline"||Oe())&&(At.triggerSubMenuAction="click"),H.cloneElement(ve,At)},se.renderMenuItem=function(ve,Ke,Pe){if(!ve)return null;var st=se.props.store.getState(),dt={openKeys:st.openKeys,selectedKeys:st.selectedKeys,triggerSubMenuAction:se.props.triggerSubMenuAction,subMenuKey:Pe};return se.renderCommonMenuItem(ve,Ke,dt)},Me.store.setState({activeKey:Object(q.a)(Object(q.a)({},Me.store.getState().activeKey),{},Object(g.a)({},Me.eventKey,Ge(Me,Me.activeKey)))}),se.instanceArray=[],se}return Object(M.a)(We,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(se){return this.props.visible||se.visible||this.props.className!==se.className||!s()(this.props.style,se.style)}},{key:"componentDidUpdate",value:function(se){var ve=this.props,Ke="activeKey"in ve?ve.activeKey:ve.store.getState().activeKey[Ce(ve)],Pe=Ge(ve,Ke);if(Pe!==Ke)Ae(ve.store,Ce(ve),Pe);else if("activeKey"in se){var st=Ge(se,se.activeKey);Pe!==st&&Ae(ve.store,Ce(ve),Pe)}}},{key:"render",value:function(){var se=this,ve=Object(I.a)({},this.props);this.instanceArray=[];var Ke=r()(ve.prefixCls,ve.className,"".concat(ve.prefixCls,"-").concat(ve.mode)),Pe={className:Ke,role:ve.role||"menu"};ve.id&&(Pe.id=ve.id),ve.focusable&&(Pe.tabIndex=0,Pe.onKeyDown=this.onKeyDown);var st=ve.prefixCls,dt=ve.eventKey,Te=ve.visible,ke=ve.level,rt=ve.mode,Ct=ve.overflowedIndicator,At=ve.theme;return _e.forEach(function(cn){return delete ve[cn]}),delete ve.onClick,H.createElement(kt,Object.assign({},ve,{prefixCls:st,mode:rt,tag:"ul",level:ke,theme:At,visible:Te,overflowedIndicator:Ct},Pe),H.Children.map(ve.children,function(cn,yn){return se.renderMenuItem(cn,yn,dt||"0-menu-")}))}}]),We}(H.Component);Re.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:R};var je=Object(F.b)()(Re),ge=je,de=W("Kwbf");function ce(at,Be,We){var Me=at.prefixCls,se=at.motion,ve=at.defaultMotions,Ke=ve===void 0?{}:ve,Pe=at.openAnimation,st=at.openTransitionName,dt=Be.switchingModeFromInline;if(se)return se;if(Object(a.a)(Pe)==="object"&&Pe)Object(de.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof Pe=="string")return{motionName:"".concat(Me,"-open-").concat(Pe)};if(st)return{motionName:st};var Te=Ke[We];return Te||(dt?null:Ke.other)}var re=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(Me){var se;Object(V.a)(this,We),se=Be.call(this,Me),se.inlineOpenKeys=[],se.onSelect=function(Pe){var st=Object(z.a)(se),dt=st.props;if(dt.selectable){var Te=se.store.getState(),ke=Te.selectedKeys,rt=Pe.key;dt.multiple?ke=ke.concat([rt]):ke=[rt],"selectedKeys"in dt||se.store.setState({selectedKeys:ke}),dt.onSelect(Object(q.a)(Object(q.a)({},Pe),{},{selectedKeys:ke}))}},se.onClick=function(Pe){var st=se.getRealMenuMode(),dt=Object(z.a)(se),Te=dt.store,ke=dt.props.onOpenChange;st!=="inline"&&!("openKeys"in se.props)&&(Te.setState({openKeys:[]}),ke([])),se.props.onClick(Pe)},se.onKeyDown=function(Pe,st){se.innerMenu.getWrappedInstance().onKeyDown(Pe,st)},se.onOpenChange=function(Pe){var st=Object(z.a)(se),dt=st.props,Te=se.store.getState().openKeys.concat(),ke=!1,rt=function(At){var cn=!1;if(At.open)cn=Te.indexOf(At.key)===-1,cn&&Te.push(At.key);else{var yn=Te.indexOf(At.key);cn=yn!==-1,cn&&Te.splice(yn,1)}ke=ke||cn};Array.isArray(Pe)?Pe.forEach(rt):rt(Pe),ke&&("openKeys"in se.props||se.store.setState({openKeys:Te}),dt.onOpenChange(Te))},se.onDeselect=function(Pe){var st=Object(z.a)(se),dt=st.props;if(dt.selectable){var Te=se.store.getState().selectedKeys.concat(),ke=Pe.key,rt=Te.indexOf(ke);rt!==-1&&Te.splice(rt,1),"selectedKeys"in dt||se.store.setState({selectedKeys:Te}),dt.onDeselect(Object(q.a)(Object(q.a)({},Pe),{},{selectedKeys:Te}))}},se.onMouseEnter=function(Pe){se.restoreModeVerticalFromInline();var st=se.props.onMouseEnter;st&&st(Pe)},se.onTransitionEnd=function(Pe){var st=Pe.propertyName==="width"&&Pe.target===Pe.currentTarget,dt=Pe.target.className,Te=Object.prototype.toString.call(dt)==="[object SVGAnimatedString]"?dt.animVal:dt,ke=Pe.propertyName==="font-size"&&Te.indexOf("anticon")>=0;(st||ke)&&se.restoreModeVerticalFromInline()},se.setInnerMenu=function(Pe){se.innerMenu=Pe},se.isRootMenu=!0;var ve=Me.defaultSelectedKeys,Ke=Me.defaultOpenKeys;return"selectedKeys"in Me&&(ve=Me.selectedKeys||[]),"openKeys"in Me&&(Ke=Me.openKeys||[]),se.store=Object(F.c)({selectedKeys:ve,openKeys:Ke,activeKey:{"0-menu-":Ge(Me,Me.activeKey)}}),se.state={switchingModeFromInline:!1},se}return Object(M.a)(We,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(se){this.updateOpentKeysWhenSwitchMode(se),this.updateMiniStore();var ve=this.props,Ke=ve.siderCollapsed,Pe=ve.inlineCollapsed,st=ve.onOpenChange;(!se.inlineCollapsed&&Pe||!se.siderCollapsed&&Ke)&&st([]),this.updateMenuDisplay()}},{key:"updateOpentKeysWhenSwitchMode",value:function(se){var ve=this.props,Ke=this.store,Pe=this.inlineOpenKeys,st=Ke.getState(),dt={};se.mode==="inline"&&ve.mode!=="inline"&&this.setState({switchingModeFromInline:!0}),"openKeys"in ve||((ve.inlineCollapsed&&!se.inlineCollapsed||ve.siderCollapsed&&!se.siderCollapsed)&&(this.setState({switchingModeFromInline:!0}),this.inlineOpenKeys=st.openKeys.concat(),dt.openKeys=[]),(!ve.inlineCollapsed&&se.inlineCollapsed||!ve.siderCollapsed&&se.siderCollapsed)&&(dt.openKeys=Pe,this.inlineOpenKeys=[])),Object.keys(dt).length&&Ke.setState(dt)}},{key:"updateMenuDisplay",value:function(){var se=this.props.collapsedWidth,ve=this.store,Ke=this.prevOpenKeys,Pe=this.getInlineCollapsed()&&(se===0||se==="0"||se==="0px");Pe?(this.prevOpenKeys=ve.getState().openKeys.concat(),this.store.setState({openKeys:[]})):Ke&&(this.store.setState({openKeys:Ke}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var se=this.props.mode,ve=this.state.switchingModeFromInline,Ke=this.getInlineCollapsed();return ve&&Ke?"inline":Ke?"vertical":se}},{key:"getInlineCollapsed",value:function(){var se=this.props,ve=se.inlineCollapsed,Ke=se.siderCollapsed;return Ke!==void 0?Ke:ve}},{key:"restoreModeVerticalFromInline",value:function(){var se=this.state.switchingModeFromInline;se&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var se=Object(q.a)({},Object(D.default)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),ve=this.getRealMenuMode();return se.className+=" ".concat(se.prefixCls,"-root"),se.direction==="rtl"&&(se.className+=" ".concat(se.prefixCls,"-rtl")),se=Object(q.a)(Object(q.a)({},se),{},{mode:ve,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:ce(this.props,this.state,ve)}),delete se.openAnimation,delete se.openTransitionName,H.createElement(F.a,{store:this.store},H.createElement(ge,Object.assign({},se,{ref:this.setInnerMenu}),this.props.children))}}]),We}(H.Component);re.defaultProps={selectable:!0,onClick:R,onSelect:R,onOpenChange:R,onDeselect:R,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:H.createElement("span",null,"\xB7\xB7\xB7")};var ae=re,ue=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(){var Me;return Object(V.a)(this,We),Me=Be.apply(this,arguments),Me.onKeyDown=function(se){var ve=se.keyCode;return ve===f.a.ENTER?(Me.onClick(se),!0):void 0},Me.onMouseLeave=function(se){var ve=Me.props,Ke=ve.eventKey,Pe=ve.onItemHover,st=ve.onMouseLeave;Pe({key:Ke,hover:!1}),st({key:Ke,domEvent:se})},Me.onMouseEnter=function(se){var ve=Me.props,Ke=ve.eventKey,Pe=ve.onItemHover,st=ve.onMouseEnter;Pe({key:Ke,hover:!0}),st({key:Ke,domEvent:se})},Me.onClick=function(se){var ve=Me.props,Ke=ve.eventKey,Pe=ve.multiple,st=ve.onClick,dt=ve.onSelect,Te=ve.onDeselect,ke=ve.isSelected,rt={key:Ke,keyPath:[Ke],item:Object(z.a)(Me),domEvent:se};st(rt),Pe?ke?Te(rt):dt(rt):ke||dt(rt)},Me.saveNode=function(se){Me.node=se},Me}return Object(M.a)(We,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var se=this.props;se.onDestroy&&se.onDestroy(se.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var se,ve=Object(q.a)({},this.props),Ke=r()(this.getPrefixCls(),ve.className,(se={},Object(g.a)(se,this.getActiveClassName(),!ve.disabled&&ve.active),Object(g.a)(se,this.getSelectedClassName(),ve.isSelected),Object(g.a)(se,this.getDisabledClassName(),ve.disabled),se)),Pe=Object(q.a)(Object(q.a)({},ve.attribute),{},{title:typeof ve.title=="string"?ve.title:void 0,className:Ke,role:ve.role||"menuitem","aria-disabled":ve.disabled});ve.role==="option"?Pe=Object(q.a)(Object(q.a)({},Pe),{},{role:"option","aria-selected":ve.isSelected}):(ve.role===null||ve.role==="none")&&(Pe.role="none");var st={onClick:ve.disabled?null:this.onClick,onMouseLeave:ve.disabled?null:this.onMouseLeave,onMouseEnter:ve.disabled?null:this.onMouseEnter},dt=Object(q.a)({},ve.style);ve.mode==="inline"&&(ve.direction==="rtl"?dt.paddingRight=ve.inlineIndent*ve.level:dt.paddingLeft=ve.inlineIndent*ve.level),_e.forEach(function(ke){return delete ve[ke]}),delete ve.direction;var Te=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Te=H.createElement(this.props.itemIcon,this.props)),H.createElement("li",Object.assign({},Object(D.default)(ve,["onClick","onMouseEnter","onMouseLeave","onSelect"]),Pe,st,{style:dt,ref:this.saveNode}),ve.children,Te)}}]),We}(H.Component);ue.isMenuItem=!0,ue.defaultProps={onSelect:R,onMouseEnter:R,onMouseLeave:R,manualRef:R};var fe=Object(F.b)(function(at,Be){var We=at.activeKey,Me=at.selectedKeys,se=Be.eventKey,ve=Be.subMenuKey;return{active:We[ve]===se,isSelected:Me.indexOf(se)!==-1}})(ue),be=fe,Ie=function(at){Object(U.a)(We,at);var Be=Object(L.a)(We);function We(){var Me;return Object(V.a)(this,We),Me=Be.apply(this,arguments),Me.renderInnerMenuItem=function(se){var ve=Me.props,Ke=ve.renderMenuItem,Pe=ve.index;return Ke(se,Pe,Me.props.subMenuKey)},Me}return Object(M.a)(We,[{key:"render",value:function(){var se=Object(I.a)({},this.props),ve=se.className,Ke=ve===void 0?"":ve,Pe=se.rootPrefixCls,st="".concat(Pe,"-item-group-title"),dt="".concat(Pe,"-item-group-list"),Te=se.title,ke=se.children;return _e.forEach(function(rt){return delete se[rt]}),delete se.onClick,delete se.direction,H.createElement("li",Object.assign({},se,{className:"".concat(Ke," ").concat(Pe,"-item-group")}),H.createElement("div",{className:st,title:typeof Te=="string"?Te:void 0},Te),H.createElement("ul",{className:dt},H.Children.map(ke,this.renderInnerMenuItem)))}}]),We}(H.Component);Ie.isMenuItemGroup=!0,Ie.defaultProps={disabled:!0};var Xe=Ie,ut=function(Be){var We=Be.className,Me=Be.rootPrefixCls,se=Be.style;return H.createElement("li",{className:"".concat(We," ").concat(Me,"-item-divider"),style:se})};ut.defaultProps={disabled:!0,className:"",style:{}};var bt=ut,ft=Se.e=ae},"55Ip":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return n});var q=W("Ty5D"),V=W("dI71"),M=W("q1tI"),z=W.n(M),U=W("YS25"),L=W("17x9"),H=W.n(L),F=W("wx14"),D=W("zLVn"),I=W("9R94"),g=function(v){Object(V.a)(p,v);function p(){for(var E,y=arguments.length,_=new Array(y),P=0;P<y;P++)_[P]=arguments[P];return E=v.call.apply(v,[this].concat(_))||this,E.history=Object(U.a)(E.props),E}var c=p.prototype;return c.render=function(){return z.a.createElement(q.c,{history:this.history,children:this.props.children})},p}(z.a.Component),f=function(v){Object(V.a)(p,v);function p(){for(var E,y=arguments.length,_=new Array(y),P=0;P<y;P++)_[P]=arguments[P];return E=v.call.apply(v,[this].concat(_))||this,E.history=Object(U.b)(E.props),E}var c=p.prototype;return c.render=function(){return z.a.createElement(q.c,{history:this.history,children:this.props.children})},p}(z.a.Component),u=function(p,c){return typeof p=="function"?p(c):p},d=function(p,c){return typeof p=="string"?Object(U.c)(p,null,null,c):p},s=function(p){return p},l=z.a.forwardRef;typeof l=="undefined"&&(l=s);function r(v){return!!(v.metaKey||v.altKey||v.ctrlKey||v.shiftKey)}var a=l(function(v,p){var c=v.innerRef,E=v.navigate,y=v.onClick,_=Object(D.a)(v,["innerRef","navigate","onClick"]),P=_.target,N=Object(F.a)({},_,{onClick:function($){try{y&&y($)}catch(B){throw $.preventDefault(),B}!$.defaultPrevented&&$.button===0&&(!P||P==="_self")&&!r($)&&($.preventDefault(),E())}});return s!==l?N.ref=p||c:N.ref=c,z.a.createElement("a",N)}),n=l(function(v,p){var c=v.component,E=c===void 0?a:c,y=v.replace,_=v.to,P=v.innerRef,N=Object(D.a)(v,["component","replace","to","innerRef"]);return z.a.createElement(q.e.Consumer,null,function(K){K||Object(I.a)(!1);var $=K.history,B=d(u(_,K.location),K.location),R=B?$.createHref(B):"",G=Object(F.a)({},N,{href:R,navigate:function(){var ne=u(_,K.location),le=y?$.replace:$.push;le(ne)}});return s!==l?G.ref=p||P:G.innerRef=P,z.a.createElement(E,G)})});if(!1)var h,O;var S=function(p){return p},x=z.a.forwardRef;typeof x=="undefined"&&(x=S);function A(){for(var v=arguments.length,p=new Array(v),c=0;c<v;c++)p[c]=arguments[c];return p.filter(function(E){return E}).join(" ")}var C=x(function(v,p){var c=v["aria-current"],E=c===void 0?"page":c,y=v.activeClassName,_=y===void 0?"active":y,P=v.activeStyle,N=v.className,K=v.exact,$=v.isActive,B=v.location,R=v.sensitive,G=v.strict,Q=v.style,ne=v.to,le=v.innerRef,_e=Object(D.a)(v,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return z.a.createElement(q.e.Consumer,null,function(pe){pe||Object(I.a)(!1);var Ee=B||pe.location,Oe=d(u(ne,Ee),Ee),we=Oe.pathname,he=we&&we.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),oe=he?Object(q.f)(Ee.pathname,{path:he,exact:K,sensitive:R,strict:G}):null,Le=!!($?$(oe,Ee):oe),Ye=Le?A(N,_):N,nt=Le?Object(F.a)({},Q,{},P):Q,qe=Object(F.a)({"aria-current":Le&&E||null,className:Ye,style:nt,to:Oe},_e);return S!==x?qe.ref=p||le:qe.innerRef=le,z.a.createElement(n,qe)})});if(!1)var b},"5VLF":function(Fe,Se,W){"use strict";var q,V;function M(z,U,L){var H=function(F,D){return z.js_beautify(F,D)};return H.js=z.js_beautify,H.css=U.css_beautify,H.html=L.html_beautify,H.js_beautify=z.js_beautify,H.css_beautify=U.css_beautify,H.html_beautify=L.html_beautify,H}!(q=[W("6UM0"),W("TXwP"),W("psGv")],V=function(z,U,L){return M(z,U,L)}.apply(Se,q),V!==void 0&&(Fe.exports=V))},"5nXd":function(Fe,Se,W){var q=W("MFOe"),V=q.slice,M=q.pluck,z=q.each,U=q.bind,L=q.create,H=q.isList,F=q.isFunction,D=q.isObject;Fe.exports={createStore:f};var I={version:"2.0.12",enabled:!1,get:function(u,d){var s=this.storage.read(this._namespacePrefix+u);return this._deserialize(s,d)},set:function(u,d){return d===void 0?this.remove(u):(this.storage.write(this._namespacePrefix+u,this._serialize(d)),d)},remove:function(u){this.storage.remove(this._namespacePrefix+u)},each:function(u){var d=this;this.storage.each(function(s,l){u.call(d,d._deserialize(s),(l||"").replace(d._namespaceRegexp,""))})},clearAll:function(){this.storage.clearAll()},hasNamespace:function(u){return this._namespacePrefix=="__storejs_"+u+"_"},createStore:function(){return f.apply(this,arguments)},addPlugin:function(u){this._addPlugin(u)},namespace:function(u){return f(this.storage,this.plugins,u)}};function g(){var u=typeof console=="undefined"?null:console;if(!u)return;var d=u.warn?u.warn:u.log;d.apply(u,arguments)}function f(u,d,s){s||(s=""),u&&!H(u)&&(u=[u]),d&&!H(d)&&(d=[d]);var l=s?"__storejs_"+s+"_":"",r=s?new RegExp("^"+l):null,a=/^[a-zA-Z0-9_\-]*$/;if(!a.test(s))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var n={_namespacePrefix:l,_namespaceRegexp:r,_testStorage:function(O){try{var S="__storejs__test__";O.write(S,S);var x=O.read(S)===S;return O.remove(S),x}catch(A){return!1}},_assignPluginFnProp:function(O,S){var x=this[S];this[S]=function(){var C=V(arguments,0),b=this;function v(){return x?(z(arguments,function(c,E){C[E]=c}),x.apply(b,C)):void 0}var p=[v].concat(C);return O.apply(b,p)}},_serialize:function(O){return JSON.stringify(O)},_deserialize:function(O,S){if(!O)return S;var x="";try{x=JSON.parse(O)}catch(A){x=O}return x!==void 0?x:S},_addStorage:function(O){if(this.enabled)return;this._testStorage(O)&&(this.storage=O,this.enabled=!0)},_addPlugin:function(O){var S=this;if(H(O)){z(O,function(C){S._addPlugin(C)});return}var x=M(this.plugins,function(C){return O===C});if(x)return;if(this.plugins.push(O),!F(O))throw new Error("Plugins must be function values that return objects");var A=O.call(this);if(!D(A))throw new Error("Plugins must return an object of function properties");z(A,function(C,b){if(!F(C))throw new Error("Bad plugin property: "+b+" from plugin "+O.name+". Plugins should only return functions.");S._assignPluginFnProp(C,b)})},addStorage:function(O){g("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(O)}},h=L(n,I,{plugins:[]});return h.raw={},z(h,function(O,S){F(O)&&(h.raw[S]=U(h,O))}),z(u,function(O){h._addStorage(O)}),z(d,function(O){h._addPlugin(O)}),h}},"6+eU":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return x});var q=W("wx14"),V=W("rePB"),M=W("VTBJ"),z=W("1OyB"),U=W("vuIU"),L=W("Ji7U"),H=W("LK+K"),F=W("q1tI"),D=W.n(F),I=W("TSYQ"),g=W.n(I),f=function(C){var b,v="".concat(C.rootPrefixCls,"-item"),p=g()(v,"".concat(v,"-").concat(C.page),(b={},Object(V.a)(b,"".concat(v,"-active"),C.active),Object(V.a)(b,C.className,!!C.className),Object(V.a)(b,"".concat(v,"-disabled"),!C.page),b)),c=function(){C.onClick(C.page)},E=function(_){C.onKeyPress(_,C.onClick,C.page)};return D.a.createElement("li",{title:C.showTitle?C.page:null,className:p,onClick:c,onKeyPress:E,tabIndex:"0"},C.itemRender(C.page,"page",D.a.createElement("a",{rel:"nofollow"},C.page)))},u=f,d={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},s=function(A){Object(L.a)(b,A);var C=Object(H.a)(b);function b(){var v;Object(z.a)(this,b);for(var p=arguments.length,c=new Array(p),E=0;E<p;E++)c[E]=arguments[E];return v=C.call.apply(C,[this].concat(c)),v.state={goInputText:""},v.buildOptionText=function(y){return"".concat(y," ").concat(v.props.locale.items_per_page)},v.changeSize=function(y){v.props.changeSize(Number(y))},v.handleChange=function(y){v.setState({goInputText:y.target.value})},v.handleBlur=function(y){var _=v.props,P=_.goButton,N=_.quickGo,K=_.rootPrefixCls,$=v.state.goInputText;if(P||$==="")return;if(y.relatedTarget&&(y.relatedTarget.className.indexOf("".concat(K,"-prev"))>=0||y.relatedTarget.className.indexOf("".concat(K,"-next"))>=0))return;v.setState({goInputText:""}),N(v.getValidValue())},v.go=function(y){var _=v.state.goInputText;if(_==="")return;(y.keyCode===d.ENTER||y.type==="click")&&(v.setState({goInputText:""}),v.props.quickGo(v.getValidValue()))},v}return Object(U.a)(b,[{key:"getValidValue",value:function(){var p=this.state,c=p.goInputText,E=p.current;return!c||isNaN(c)?E:Number(c)}},{key:"getPageSizeOptions",value:function(){var p=this.props,c=p.pageSize,E=p.pageSizeOptions;return E.some(function(y){return y.toString()===c.toString()})?E:E.concat([c.toString()]).sort(function(y,_){var P=isNaN(Number(y))?0:Number(y),N=isNaN(Number(_))?0:Number(_);return P-N})}},{key:"render",value:function(){var p=this,c=this.props,E=c.pageSize,y=c.locale,_=c.rootPrefixCls,P=c.changeSize,N=c.quickGo,K=c.goButton,$=c.selectComponentClass,B=c.buildOptionText,R=c.selectPrefixCls,G=c.disabled,Q=this.state.goInputText,ne="".concat(_,"-options"),le=$,_e=null,pe=null,Ee=null;if(!P&&!N)return null;var Oe=this.getPageSizeOptions();if(P&&le){var we=Oe.map(function(he,oe){return D.a.createElement(le.Option,{key:oe,value:he.toString()},(B||p.buildOptionText)(he))});_e=D.a.createElement(le,{disabled:G,prefixCls:R,showSearch:!1,className:"".concat(ne,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(E||Oe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(oe){return oe.parentNode}},we)}return N&&(K&&(Ee=typeof K=="boolean"?D.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:G,className:"".concat(ne,"-quick-jumper-button")},y.jump_to_confirm):D.a.createElement("span",{onClick:this.go,onKeyUp:this.go},K)),pe=D.a.createElement("div",{className:"".concat(ne,"-quick-jumper")},y.jump_to,D.a.createElement("input",{disabled:G,type:"text",value:Q,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),y.page,Ee)),D.a.createElement("li",{className:"".concat(ne)},_e,pe)}}]),b}(D.a.Component);s.defaultProps={pageSizeOptions:["10","20","50","100"]};var l=s,r=W("N2Kk");function a(){}function n(A){return typeof A=="number"&&isFinite(A)&&Math.floor(A)===A}function h(A,C,b){return b}function O(A,C,b){var v=typeof A=="undefined"?C.pageSize:A;return Math.floor((b.total-1)/v)+1}var S=function(A){Object(L.a)(b,A);var C=Object(H.a)(b);function b(v){var p;Object(z.a)(this,b),p=C.call(this,v),p.getJumpPrevPage=function(){return Math.max(1,p.state.current-(p.props.showLessItems?3:5))},p.getJumpNextPage=function(){return Math.min(O(void 0,p.state,p.props),p.state.current+(p.props.showLessItems?3:5))},p.getItemIcon=function(P,N){var K=p.props.prefixCls,$=P||D.a.createElement("button",{type:"button","aria-label":N,className:"".concat(K,"-item-link")});return typeof P=="function"&&($=D.a.createElement(P,Object(M.a)({},p.props))),$},p.savePaginationNode=function(P){p.paginationNode=P},p.isValid=function(P){return n(P)&&P!==p.state.current},p.shouldDisplayQuickJumper=function(){var P=p.props,N=P.showQuickJumper,K=P.pageSize,$=P.total;return $<=K?!1:N},p.handleKeyDown=function(P){(P.keyCode===d.ARROW_UP||P.keyCode===d.ARROW_DOWN)&&P.preventDefault()},p.handleKeyUp=function(P){var N=p.getValidValue(P),K=p.state.currentInputValue;N!==K&&p.setState({currentInputValue:N}),P.keyCode===d.ENTER?p.handleChange(N):P.keyCode===d.ARROW_UP?p.handleChange(N-1):P.keyCode===d.ARROW_DOWN&&p.handleChange(N+1)},p.changePageSize=function(P){var N=p.state.current,K=O(P,p.state,p.props);N=N>K?K:N,K===0&&(N=p.state.current),typeof P=="number"&&("pageSize"in p.props||p.setState({pageSize:P}),"current"in p.props||p.setState({current:N,currentInputValue:N})),p.props.onShowSizeChange(N,P),"onChange"in p.props&&p.props.onChange&&p.props.onChange(N,P)},p.handleChange=function(P){var N=p.props.disabled,K=P;if(p.isValid(K)&&!N){var $=O(void 0,p.state,p.props);K>$?K=$:K<1&&(K=1),"current"in p.props||p.setState({current:K,currentInputValue:K});var B=p.state.pageSize;return p.props.onChange(K,B),K}return p.state.current},p.prev=function(){p.hasPrev()&&p.handleChange(p.state.current-1)},p.next=function(){p.hasNext()&&p.handleChange(p.state.current+1)},p.jumpPrev=function(){p.handleChange(p.getJumpPrevPage())},p.jumpNext=function(){p.handleChange(p.getJumpNextPage())},p.hasPrev=function(){return p.state.current>1},p.hasNext=function(){return p.state.current<O(void 0,p.state,p.props)},p.runIfEnter=function(P,N){if(P.key==="Enter"||P.charCode===13){for(var K=arguments.length,$=new Array(K>2?K-2:0),B=2;B<K;B++)$[B-2]=arguments[B];N.apply(void 0,$)}},p.runIfEnterPrev=function(P){p.runIfEnter(P,p.prev)},p.runIfEnterNext=function(P){p.runIfEnter(P,p.next)},p.runIfEnterJumpPrev=function(P){p.runIfEnter(P,p.jumpPrev)},p.runIfEnterJumpNext=function(P){p.runIfEnter(P,p.jumpNext)},p.handleGoTO=function(P){(P.keyCode===d.ENTER||P.type==="click")&&p.handleChange(p.state.currentInputValue)};var c=v.onChange!==a,E="current"in v;E&&!c&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var y=v.defaultCurrent;"current"in v&&(y=v.current);var _=v.defaultPageSize;return"pageSize"in v&&(_=v.pageSize),y=Math.min(y,O(_,void 0,v)),p.state={current:y,currentInputValue:y,pageSize:_},p}return Object(U.a)(b,[{key:"componentDidUpdate",value:function(p,c){var E=this.props.prefixCls;if(c.current!==this.state.current&&this.paginationNode){var y=this.paginationNode.querySelector(".".concat(E,"-item-").concat(c.current));y&&document.activeElement===y&&y.blur()}}},{key:"getValidValue",value:function(p){var c=p.target.value,E=O(void 0,this.state,this.props),y=this.state.currentInputValue,_;return c===""?_=c:isNaN(Number(c))?_=y:c>=E?_=E:_=Number(c),_}},{key:"getShowSizeChanger",value:function(){var p=this.props,c=p.showSizeChanger,E=p.total,y=p.totalBoundaryShowSizeChanger;return typeof c!="undefined"?c:E>y}},{key:"renderPrev",value:function(p){var c=this.props,E=c.prevIcon,y=c.itemRender,_=y(p,"prev",this.getItemIcon(E,"prev page")),P=!this.hasPrev();return Object(F.isValidElement)(_)?Object(F.cloneElement)(_,{disabled:P}):_}},{key:"renderNext",value:function(p){var c=this.props,E=c.nextIcon,y=c.itemRender,_=y(p,"next",this.getItemIcon(E,"next page")),P=!this.hasNext();return Object(F.isValidElement)(_)?Object(F.cloneElement)(_,{disabled:P}):_}},{key:"render",value:function(){var p=this,c=this.props,E=c.prefixCls,y=c.className,_=c.style,P=c.disabled,N=c.hideOnSinglePage,K=c.total,$=c.locale,B=c.showQuickJumper,R=c.showLessItems,G=c.showTitle,Q=c.showTotal,ne=c.simple,le=c.itemRender,_e=c.showPrevNextJumpers,pe=c.jumpPrevIcon,Ee=c.jumpNextIcon,Oe=c.selectComponentClass,we=c.selectPrefixCls,he=c.pageSizeOptions,oe=this.state,Le=oe.current,Ye=oe.pageSize,nt=oe.currentInputValue;if(N===!0&&K<=Ye)return null;var qe=O(void 0,this.state,this.props),it=[],He=null,$e=null,Qe=null,gt=null,et=null,tt=B&&B.goButton,Je=R?1:2,vt=Le-1>0?Le-1:0,wt=Le+1<qe?Le+1:qe,Et=Object.keys(this.props).reduce(function(re,ae){return(ae.substr(0,5)==="data-"||ae.substr(0,5)==="aria-"||ae==="role")&&(re[ae]=p.props[ae]),re},{});if(ne)return tt&&(typeof tt=="boolean"?et=D.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},$.jump_to_confirm):et=D.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},tt),et=D.a.createElement("li",{title:G?"".concat($.jump_to).concat(Le,"/").concat(qe):null,className:"".concat(E,"-simple-pager")},et)),D.a.createElement("ul",Object(q.a)({className:g()(E,"".concat(E,"-simple"),Object(V.a)({},"".concat(E,"-disabled"),P),y),style:_,ref:this.savePaginationNode},Et),D.a.createElement("li",{title:G?$.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:g()("".concat(E,"-prev"),Object(V.a)({},"".concat(E,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(vt)),D.a.createElement("li",{title:G?"".concat(Le,"/").concat(qe):null,className:"".concat(E,"-simple-pager")},D.a.createElement("input",{type:"text",value:nt,disabled:P,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),D.a.createElement("span",{className:"".concat(E,"-slash")},"/"),qe),D.a.createElement("li",{title:G?$.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:g()("".concat(E,"-next"),Object(V.a)({},"".concat(E,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(wt)),et);if(qe<=3+Je*2){var xt={locale:$,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:G,itemRender:le};qe||it.push(D.a.createElement(u,Object(q.a)({},xt,{key:"noPager",page:qe,className:"".concat(E,"-disabled")})));for(var kt=1;kt<=qe;kt+=1){var Ot=Le===kt;it.push(D.a.createElement(u,Object(q.a)({},xt,{key:kt,page:kt,active:Ot})))}}else{var Ae=R?$.prev_3:$.prev_5,Ce=R?$.next_3:$.next_5;_e&&(He=D.a.createElement("li",{title:G?Ae:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:g()("".concat(E,"-jump-prev"),Object(V.a)({},"".concat(E,"-jump-prev-custom-icon"),!!pe))},le(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(pe,"prev page"))),$e=D.a.createElement("li",{title:G?Ce:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:g()("".concat(E,"-jump-next"),Object(V.a)({},"".concat(E,"-jump-next-custom-icon"),!!Ee))},le(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ee,"next page")))),gt=D.a.createElement(u,{locale:$,last:!0,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:qe,page:qe,active:!1,showTitle:G,itemRender:le}),Qe=D.a.createElement(u,{locale:$,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:G,itemRender:le});var Ge=Math.max(1,Le-Je),ze=Math.min(Le+Je,qe);Le-1<=Je&&(ze=1+Je*2),qe-Le<=Je&&(Ge=qe-Je*2);for(var Re=Ge;Re<=ze;Re+=1){var je=Le===Re;it.push(D.a.createElement(u,{locale:$,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Re,page:Re,active:je,showTitle:G,itemRender:le}))}Le-1>=Je*2&&Le!==1+2&&(it[0]=Object(F.cloneElement)(it[0],{className:"".concat(E,"-item-after-jump-prev")}),it.unshift(He)),qe-Le>=Je*2&&Le!==qe-2&&(it[it.length-1]=Object(F.cloneElement)(it[it.length-1],{className:"".concat(E,"-item-before-jump-next")}),it.push($e)),Ge!==1&&it.unshift(Qe),ze!==qe&&it.push(gt)}var ge=null;Q&&(ge=D.a.createElement("li",{className:"".concat(E,"-total-text")},Q(K,[K===0?0:(Le-1)*Ye+1,Le*Ye>K?K:Le*Ye])));var de=!this.hasPrev()||!qe,ce=!this.hasNext()||!qe;return D.a.createElement("ul",Object(q.a)({className:g()(E,y,Object(V.a)({},"".concat(E,"-disabled"),P)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},Et),ge,D.a.createElement("li",{title:G?$.prev_page:null,onClick:this.prev,tabIndex:de?null:0,onKeyPress:this.runIfEnterPrev,className:g()("".concat(E,"-prev"),Object(V.a)({},"".concat(E,"-disabled"),de)),"aria-disabled":de},this.renderPrev(vt)),it,D.a.createElement("li",{title:G?$.next_page:null,onClick:this.next,tabIndex:ce?null:0,onKeyPress:this.runIfEnterNext,className:g()("".concat(E,"-next"),Object(V.a)({},"".concat(E,"-disabled"),ce)),"aria-disabled":ce},this.renderNext(wt)),D.a.createElement(l,{disabled:P,locale:$,rootPrefixCls:E,selectComponentClass:Oe,selectPrefixCls:we,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Le,pageSize:Ye,pageSizeOptions:he,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:tt}))}}],[{key:"getDerivedStateFromProps",value:function(p,c){var E={};if("current"in p&&(E.current=p.current,p.current!==c.current&&(E.currentInputValue=E.current)),"pageSize"in p&&p.pageSize!==c.pageSize){var y=c.current,_=O(p.pageSize,c,p);y=y>_?_:y,"current"in p||(E.current=y,E.currentInputValue=y),E.pageSize=p.pageSize}return E}}]),b}(D.a.Component);S.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:a,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:a,locale:r.a,style:{},itemRender:h,totalBoundaryShowSizeChanger:50};var x=S},"6RRn":function(Fe,Se,W){"use strict";var q=W("wCXF"),V=W("n6Qo");W.d(Se,"b",function(){return V.a});var M=W("IBYe"),z=W("6eGT"),U=W("hW8S");W.d(Se,"a",function(){return U.a}),Se.c=q.b},"6UM0":function(Fe,Se,W){var q,V;(function(){var M;(function(){"use strict";var U=[function(D,I,g){var f=g(1).Beautifier,u=g(5).Options;function d(s,l){var r=new f(s,l);return r.beautify()}D.exports=d,D.exports.defaultOptions=function(){return new u}},function(D,I,g){var f=g(2).Output,u=g(3).Token,d=g(4),s=g(5).Options,l=g(7).Tokenizer,r=g(7).line_starters,a=g(7).positionable_operators,n=g(7).TOKEN;function h(R,G){return G.indexOf(R)!==-1}function O(R){return R.replace(/^\s+/g,"")}function S(R){for(var G={},Q=0;Q<R.length;Q++)G[R[Q].replace(/-/g,"_")]=R[Q];return G}function x(R,G){return R&&R.type===n.RESERVED&&R.text===G}function A(R,G){return R&&R.type===n.RESERVED&&h(R.text,G)}var C=["case","return","do","if","throw","else","await","break","continue","async"],b=["before-newline","after-newline","preserve-newline"],v=S(b),p=[v.before_newline,v.preserve_newline],c={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function E(R,G){if(G.multiline_frame||G.mode===c.ForInitializer||G.mode===c.Conditional)return;R.remove_indent(G.start_line_index)}function y(R){R=R.replace(d.allLineBreaks,`
|
|
`);for(var G=[],Q=R.indexOf(`
|
|
`);Q!==-1;)G.push(R.substring(0,Q)),R=R.substring(Q+1),Q=R.indexOf(`
|
|
`);return R.length&&G.push(R),G}function _(R){return R===c.ArrayLiteral}function P(R){return h(R,[c.Expression,c.ForInitializer,c.Conditional])}function N(R,G){for(var Q=0;Q<R.length;Q++){var ne=R[Q].trim();if(ne.charAt(0)!==G)return!1}return!0}function K(R,G){for(var Q=0,ne=R.length,le;Q<ne;Q++)if(le=R[Q],le&&le.indexOf(G)!==0)return!1;return!0}function $(R,G){G=G||{},this._source_text=R||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new s(G)}$.prototype.create_flags=function(R,G){var Q=0;R&&(Q=R.indentation_level,!this._output.just_added_newline()&&R.line_indent_level>Q&&(Q=R.line_indent_level));var ne={mode:G,parent:R,last_token:R?R.last_token:new u(n.START_BLOCK,""),last_word:R?R.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Q,alignment:0,line_indent_level:R?R.line_indent_level:Q,start_line_index:this._output.get_line_number(),ternary_depth:0};return ne},$.prototype._reset=function(R){var G=R.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new f(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(c.BlockStatement);var Q=new l(R,this._options);return this._tokens=Q.tokenize(),R},$.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R,G=this._reset(this._source_text),Q=this._options.eol;this._options.eol==="auto"&&(Q=`
|
|
`,G&&d.lineBreak.test(G||"")&&(Q=G.match(d.lineBreak)[0]));for(var ne=this._tokens.next();ne;)this.handle_token(ne),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ne,ne=this._tokens.next();return R=this._output.get_code(Q),R},$.prototype.handle_token=function(R,G){R.type===n.START_EXPR?this.handle_start_expr(R):R.type===n.END_EXPR?this.handle_end_expr(R):R.type===n.START_BLOCK?this.handle_start_block(R):R.type===n.END_BLOCK?this.handle_end_block(R):R.type===n.WORD?this.handle_word(R):R.type===n.RESERVED?this.handle_word(R):R.type===n.SEMICOLON?this.handle_semicolon(R):R.type===n.STRING?this.handle_string(R):R.type===n.EQUALS?this.handle_equals(R):R.type===n.OPERATOR?this.handle_operator(R):R.type===n.COMMA?this.handle_comma(R):R.type===n.BLOCK_COMMENT?this.handle_block_comment(R,G):R.type===n.COMMENT?this.handle_comment(R,G):R.type===n.DOT?this.handle_dot(R):R.type===n.EOF?this.handle_eof(R):R.type===n.UNKNOWN?this.handle_unknown(R,G):this.handle_unknown(R,G)},$.prototype.handle_whitespace_and_comments=function(R,G){var Q=R.newlines,ne=this._options.keep_array_indentation&&_(this._flags.mode);if(R.comments_before)for(var le=R.comments_before.next();le;)this.handle_whitespace_and_comments(le,G),this.handle_token(le,G),le=R.comments_before.next();if(ne)for(var _e=0;_e<Q;_e+=1)this.print_newline(_e>0,G);else if(this._options.max_preserve_newlines&&Q>this._options.max_preserve_newlines&&(Q=this._options.max_preserve_newlines),this._options.preserve_newlines&&Q>1){this.print_newline(!1,G);for(var pe=1;pe<Q;pe+=1)this.print_newline(!0,G)}};var B=["async","break","continue","return","throw","yield"];$.prototype.allow_wrap_or_preserved_newline=function(R,G){if(G=G===void 0?!1:G,this._output.just_added_newline())return;var Q=this._options.preserve_newlines&&R.newlines||G,ne=h(this._flags.last_token.text,a)||h(R.text,a);if(ne){var le=h(this._flags.last_token.text,a)&&h(this._options.operator_position,p)||h(R.text,a);Q=Q&&le}if(Q)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(A(this._flags.last_token,B))return;this._output.set_wrap_point()}},$.prototype.print_newline=function(R,G){if(!G&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==n.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Q=this._tokens.peek();this._flags.mode===c.Statement&&!(this._flags.if_block&&x(Q,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(R)&&(this._flags.multiline_frame=!0)},$.prototype.print_token_line_indentation=function(R){this._output.just_added_newline()&&(this._options.keep_array_indentation&&R.newlines&&(R.text==="["||_(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(R.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},$.prototype.print_token=function(R){if(this._output.raw){this._output.add_raw_token(R);return}if(this._options.comma_first&&R.previous&&R.previous.type===n.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(R),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(R),this._output.non_breaking_space=!0,this._output.add_token(R.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},$.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},$.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},$.prototype.set_mode=function(R){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,R),this._flags=this.create_flags(this._previous_flags,R),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},$.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===c.Statement&&E(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},$.prototype.start_of_object_property=function(){return this._flags.parent.mode===c.ObjectLiteral&&this._flags.mode===c.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"]))},$.prototype.start_of_statement=function(R){var G=!1;return G=G||A(this._flags.last_token,["var","let","const"])&&R.type===n.WORD,G=G||x(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===c.ObjectLiteral&&this._flags.mode===c.Statement)&&A(this._flags.last_token,B)&&!R.newlines,G=G||x(this._flags.last_token,"else")&&!(x(R,"if")&&!R.comments_before),G=G||this._flags.last_token.type===n.END_EXPR&&(this._previous_flags.mode===c.ForInitializer||this._previous_flags.mode===c.Conditional),G=G||this._flags.last_token.type===n.WORD&&this._flags.mode===c.BlockStatement&&!this._flags.in_case&&!(R.text==="--"||R.text==="++")&&this._last_last_text!=="function"&&R.type!==n.WORD&&R.type!==n.RESERVED,G=G||this._flags.mode===c.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"])),G?(this.set_mode(c.Statement),this.indent(),this.handle_whitespace_and_comments(R,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(R,A(R,["do","for","if","while"])),!0):!1},$.prototype.handle_start_expr=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R);var G=c.Expression;if(R.text==="["){if(this._flags.last_token.type===n.WORD||this._flags.last_token.text===")"){A(this._flags.last_token,r)&&(this._output.space_before_token=!0),this.print_token(R),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=c.ArrayLiteral,_(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),h(this._flags.last_token.type,[n.START_EXPR,n.END_EXPR,n.WORD,n.OPERATOR,n.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===n.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=c.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=c.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&R.whitespace_before===""?this._output.space_before_token=!1:(h(this._flags.last_token.text,r)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===n.EQUALS||this._flags.last_token.type===n.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(R);else if(this._flags.last_token.type===n.WORD){this._output.space_before_token=!1;var Q=this._tokens.peek(-3);if(this._options.space_after_named_function&&Q){var ne=this._tokens.peek(-4);A(Q,["async","function"])||Q.text==="*"&&A(ne,["async","function"])?this._output.space_before_token=!0:this._flags.mode===c.ObjectLiteral?(Q.text==="{"||Q.text===","||Q.text==="*"&&(ne.text==="{"||ne.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(R);(this._flags.last_token.type===n.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===c.ObjectLiteral&&h(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===n.START_BLOCK?this.print_newline():(this._flags.last_token.type===n.END_EXPR||this._flags.last_token.type===n.START_EXPR||this._flags.last_token.type===n.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===n.COMMA)&&this.allow_wrap_or_preserved_newline(R,R.newlines),this.print_token(R),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},$.prototype.handle_end_expr=function(R){for(;this._flags.mode===c.Statement;)this.restore_mode();this.handle_whitespace_and_comments(R),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(R,R.text==="]"&&_(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===n.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(R),this.restore_mode(),E(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===c.Conditional&&(this._previous_flags.mode=c.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},$.prototype.handle_start_block=function(R){this.handle_whitespace_and_comments(R);var G=this._tokens.peek(),Q=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===n.END_EXPR?(this.set_mode(c.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(c.BlockStatement):Q&&(h(Q.text,[":",","])&&h(G.type,[n.STRING,n.WORD,n.RESERVED])||h(G.text,["get","set","..."])&&h(Q.type,[n.WORD,n.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(Q.text,[":",","])?this.set_mode(c.BlockStatement):this.set_mode(c.ObjectLiteral):this._flags.last_token.type===n.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(c.BlockStatement):h(this._flags.last_token.type,[n.EQUALS,n.START_EXPR,n.COMMA,n.OPERATOR])||A(this._flags.last_token,["return","throw","import","default"])?this.set_mode(c.ObjectLiteral):this.set_mode(c.BlockStatement),this._flags.last_token&&(A(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ne=!G.comments_before&&G.text==="}",le=ne&&this._flags.last_word==="function"&&this._flags.last_token.type===n.END_EXPR;if(this._options.brace_preserve_inline){var _e=0,pe=null;this._flags.inline_frame=!0;do if(_e+=1,pe=this._tokens.peek(_e-1),pe.newlines){this._flags.inline_frame=!1;break}while(pe.type!==n.EOF&&!(pe.type===n.END_BLOCK&&pe.opened===R))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&R.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==n.OPERATOR&&(le||this._flags.last_token.type===n.EQUALS||A(this._flags.last_token,C)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(_(this._previous_flags.mode)&&(this._flags.last_token.type===n.START_EXPR||this._flags.last_token.type===n.COMMA)&&((this._flags.last_token.type===n.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===n.COMMA||this._flags.last_token.type===n.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(R),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==n.OPERATOR&&this._flags.last_token.type!==n.START_EXPR&&(this._flags.last_token.type===n.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(R),this.indent(),!ne&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},$.prototype.handle_end_block=function(R){for(this.handle_whitespace_and_comments(R);this._flags.mode===c.Statement;)this.restore_mode();var G=this._flags.last_token.type===n.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(_(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(R)},$.prototype.handle_word=function(R){if(R.type===n.RESERVED){if(h(R.text,["set","get"])&&this._flags.mode!==c.ObjectLiteral)R.type=n.WORD;else if(R.text==="import"&&h(this._tokens.peek().text,["(","."]))R.type=n.WORD;else if(h(R.text,["as","from"])&&!this._flags.import_block)R.type=n.WORD;else if(this._flags.mode===c.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(R.type=n.WORD)}}if(this.start_of_statement(R)?A(this._flags.last_token,["var","let","const"])&&R.type===n.WORD&&(this._flags.declaration_statement=!0):R.newlines&&!P(this._flags.mode)&&(this._flags.last_token.type!==n.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==n.EQUALS&&(this._options.preserve_newlines||!A(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(R),this.print_newline()):this.handle_whitespace_and_comments(R),this._flags.do_block&&!this._flags.do_while)if(x(R,"while")){this._output.space_before_token=!0,this.print_token(R),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&x(R,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===c.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&A(R,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(R),this._flags.in_case=!0;return}if((this._flags.last_token.type===n.COMMA||this._flags.last_token.type===n.START_EXPR||this._flags.last_token.type===n.EQUALS||this._flags.last_token.type===n.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(R)),x(R,"function")){(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(h(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===n.OPERATOR))&&(!this._output.just_added_blankline()&&!R.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===n.RESERVED||this._flags.last_token.type===n.WORD?A(this._flags.last_token,["get","set","new","export"])||A(this._flags.last_token,B)?this._output.space_before_token=!0:x(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===n.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(P(this._flags.mode)||_(this._flags.mode))||this.print_newline(),this.print_token(R),this._flags.last_word=R.text;return}var Q="NONE";if(this._flags.last_token.type===n.END_BLOCK?this._previous_flags.inline_frame?Q="SPACE":A(R,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&R.newlines?Q="NEWLINE":(Q="SPACE",this._output.space_before_token=!0):Q="NEWLINE":this._flags.last_token.type===n.SEMICOLON&&this._flags.mode===c.BlockStatement?Q="NEWLINE":this._flags.last_token.type===n.SEMICOLON&&P(this._flags.mode)?Q="SPACE":this._flags.last_token.type===n.STRING?Q="NEWLINE":this._flags.last_token.type===n.RESERVED||this._flags.last_token.type===n.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===c.ObjectLiteral&&h(this._last_last_text,["{",","]))?Q="SPACE":this._flags.last_token.type===n.START_BLOCK?this._flags.inline_frame?Q="SPACE":Q="NEWLINE":this._flags.last_token.type===n.END_EXPR&&(this._output.space_before_token=!0,Q="NEWLINE"),A(R,r)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Q="SPACE":Q="NEWLINE"),A(R,["else","catch","finally"]))if((!(this._flags.last_token.type===n.END_BLOCK&&this._previous_flags.mode===c.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&R.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ne=this._output.current_line;ne.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Q==="NEWLINE"?A(this._flags.last_token,C)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&A(R,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==n.END_EXPR?(this._flags.last_token.type!==n.START_EXPR||!A(R,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(R,"if")&&x(R.previous,"else")?this._output.space_before_token=!0:this.print_newline()):A(R,r)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&_(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Q==="SPACE"&&(this._output.space_before_token=!0);R.previous&&(R.previous.type===n.WORD||R.previous.type===n.RESERVED)&&(this._output.space_before_token=!0),this.print_token(R),this._flags.last_word=R.text,R.type===n.RESERVED&&(R.text==="do"?this._flags.do_block=!0:R.text==="if"?this._flags.if_block=!0:R.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(R,"from")&&(this._flags.import_block=!1))},$.prototype.handle_semicolon=function(R){this.start_of_statement(R)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(R);for(var G=this._tokens.peek();this._flags.mode===c.Statement&&!(this._flags.if_block&&x(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(R)},$.prototype.handle_string=function(R){R.text.startsWith("`")&&R.newlines===0&&R.whitespace_before===""&&(R.previous.text===")"||this._flags.last_token.type===n.WORD)||(this.start_of_statement(R)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(R),this._flags.last_token.type===n.RESERVED||this._flags.last_token.type===n.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===n.COMMA||this._flags.last_token.type===n.START_EXPR||this._flags.last_token.type===n.EQUALS||this._flags.last_token.type===n.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(R):R.text.startsWith("`")&&this._flags.last_token.type===n.END_EXPR&&(R.previous.text==="]"||R.previous.text===")")&&R.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(R)},$.prototype.handle_equals=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(R),this._output.space_before_token=!0},$.prototype.handle_comma=function(R){this.handle_whitespace_and_comments(R,!0),this.print_token(R),this._output.space_before_token=!0,this._flags.declaration_statement?(P(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(R)):this._flags.mode===c.ObjectLiteral||this._flags.mode===c.Statement&&this._flags.parent.mode===c.ObjectLiteral?(this._flags.mode===c.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(R)},$.prototype.handle_operator=function(R){var G=R.text==="*"&&(A(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[n.START_BLOCK,n.COMMA,n.END_BLOCK,n.SEMICOLON])),Q=h(R.text,["-","+"])&&(h(this._flags.last_token.type,[n.START_BLOCK,n.START_EXPR,n.EQUALS,n.OPERATOR])||h(this._flags.last_token.text,r)||this._flags.last_token.text===",");if(!this.start_of_statement(R)){var ne=!G;this.handle_whitespace_and_comments(R,ne)}if(R.text==="*"&&this._flags.last_token.type===n.DOT){this.print_token(R);return}if(R.text==="::"){this.print_token(R);return}if(this._flags.last_token.type===n.OPERATOR&&h(this._options.operator_position,p)&&this.allow_wrap_or_preserved_newline(R),R.text===":"&&this._flags.in_case){this.print_token(R),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==n.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var le=!0,_e=!0,pe=!1;if(R.text===":"?this._flags.ternary_depth===0?le=!1:(this._flags.ternary_depth-=1,pe=!0):R.text==="?"&&(this._flags.ternary_depth+=1),!Q&&!G&&this._options.preserve_newlines&&h(R.text,a)){var Ee=R.text===":",Oe=Ee&&pe,we=Ee&&!pe;switch(this._options.operator_position){case v.before_newline:this._output.space_before_token=!we,this.print_token(R),(!Ee||Oe)&&this.allow_wrap_or_preserved_newline(R),this._output.space_before_token=!0;return;case v.after_newline:this._output.space_before_token=!0,!Ee||Oe?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(R):this._output.space_before_token=!1,this.print_token(R),this._output.space_before_token=!0;return;case v.preserve_newline:we||this.allow_wrap_or_preserved_newline(R),le=!(this._output.just_added_newline()||we),this._output.space_before_token=le,this.print_token(R),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(R),le=!1;var he=this._tokens.peek();_e=he&&h(he.type,[n.WORD,n.RESERVED])}else if(R.text==="...")this.allow_wrap_or_preserved_newline(R),le=this._flags.last_token.type===n.START_BLOCK,_e=!1;else if(h(R.text,["--","++","!","~"])||Q){if((this._flags.last_token.type===n.COMMA||this._flags.last_token.type===n.START_EXPR)&&this.allow_wrap_or_preserved_newline(R),le=!1,_e=!1,R.newlines&&(R.text==="--"||R.text==="++"||R.text==="~")){var oe=A(this._flags.last_token,C)&&R.newlines;oe&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(oe,!0)}this._flags.last_token.text===";"&&P(this._flags.mode)&&(le=!0),this._flags.last_token.type===n.RESERVED?le=!0:this._flags.last_token.type===n.END_EXPR?le=!(this._flags.last_token.text==="]"&&(R.text==="--"||R.text==="++")):this._flags.last_token.type===n.OPERATOR&&(le=h(R.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(R.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(_e=!0)),(this._flags.mode===c.BlockStatement&&!this._flags.inline_frame||this._flags.mode===c.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||le,this.print_token(R),this._output.space_before_token=_e},$.prototype.handle_block_comment=function(R,G){if(this._output.raw){this._output.add_raw_token(R),R.directives&&R.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(R.directives){this.print_newline(!1,G),this.print_token(R),R.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!d.newline.test(R.text)&&!R.newlines){this._output.space_before_token=!0,this.print_token(R),this._output.space_before_token=!0;return}else this.print_block_commment(R,G)},$.prototype.print_block_commment=function(R,G){var Q=y(R.text),ne,le=!1,_e=!1,pe=R.whitespace_before,Ee=pe.length;if(this.print_newline(!1,G),this.print_token_line_indentation(R),this._output.add_token(Q[0]),this.print_newline(!1,G),Q.length>1){for(Q=Q.slice(1),le=N(Q,"*"),_e=K(Q,pe),le&&(this._flags.alignment=1),ne=0;ne<Q.length;ne++)le?(this.print_token_line_indentation(R),this._output.add_token(O(Q[ne]))):_e&&Q[ne]?(this.print_token_line_indentation(R),this._output.add_token(Q[ne].substring(Ee))):(this._output.current_line.set_indent(-1),this._output.add_token(Q[ne])),this.print_newline(!1,G);this._flags.alignment=0}},$.prototype.handle_comment=function(R,G){R.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(R),this.print_newline(!1,G)},$.prototype.handle_dot=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),A(this._flags.last_token,C)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(R,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(R)},$.prototype.handle_unknown=function(R,G){this.print_token(R),R.text[R.text.length-1]===`
|
|
`&&this.print_newline(!1,G)},$.prototype.handle_eof=function(R){for(;this._flags.mode===c.Statement;)this.restore_mode();this.handle_whitespace_and_comments(R)},D.exports.Beautifier=$},function(D){function I(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}I.prototype.clone_empty=function(){var u=new I(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},I.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},I.prototype.has_match=function(u){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(u))return!0;return!1},I.prototype.set_indent=function(u,d){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},I.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(u){this.__items.push(u);var d=u.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=u.length-d:this.__character_count+=u.length},I.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function g(u,d){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),d=d||"",u.indent_level>0&&(d=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(u,d){var s=this.__base_string_length;return d=d||0,u<0&&(s=0),s+=u*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(u,d){var s=this.__base_string;return d=d||0,u<0&&(u=0,s=""),d+=u*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},g.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var u=this.__cache.length,d=0,s="";this.__indent_size&&u>=this.__indent_size&&(d=Math.floor(u/this.__indent_size),u-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),u&&(s+=new Array(u+1).join(" ")),this.__cache.push(s)};function f(u,d){this.__indent_cache=new g(u,d),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(u,d){return this.__indent_cache.get_indent_string(u,d)},f.prototype.get_indent_size=function(u,d){return this.__indent_cache.get_indent_size(u,d)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(u){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
|
|
`);return u!==`
|
|
`&&(s=s.replace(/[\n]/g,u)),s},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(u,d){return u=u||0,d=d||0,this.next_line.set_indent(u,d),this.__lines.length>1?(this.current_line.set_indent(u,d),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(u){for(var d=0;d<u.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},f.prototype.remove_indent=function(u){for(var d=this.__lines.length;u<d;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(u,d){for(var s=this.__lines.length-2;s>=0;){var l=this.__lines[s];if(l.is_empty())break;if(l.item(0).indexOf(u)!==0&&l.item(-1)!==d){this.__lines.splice(s+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},D.exports.Output=f},function(D){function I(g,f,u,d){this.type=g,this.text=f,this.comments_before=null,this.newlines=u||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}D.exports.Token=I},function(D,I){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",u="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",d="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",s="(?:\\\\u[0-9a-fA-F]{4}|["+g+u+"])",l="(?:\\\\u[0-9a-fA-F]{4}|["+f+u+d+"])*";I.identifier=new RegExp(s+l,"g"),I.identifierStart=new RegExp(s),I.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+f+u+d+"])+");var r=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;I.newline=/[\n\r\u2028\u2029]/,I.lineBreak=new RegExp(`\r
|
|
|`+I.newline.source),I.allLineBreaks=new RegExp(I.lineBreak.source,"g")},function(D,I,g){var f=g(6).Options,u=["before-newline","after-newline","preserve-newline"];function d(s){f.call(this,s,"js");var l=this.raw_options.brace_style||null;l==="expand-strict"?this.raw_options.brace_style="expand":l==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var r=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var a=0;a<r.length;a++)r[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=r[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",u),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}d.prototype=new f,D.exports.Options=d},function(D){function I(u,d){this.raw_options=g(u,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}I.prototype._get_array=function(u,d){var s=this.raw_options[u],l=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(l=s.concat()):typeof s=="string"&&(l=s.split(/[^a-zA-Z0-9_\/\-]+/)),l},I.prototype._get_boolean=function(u,d){var s=this.raw_options[u],l=s===void 0?!!d:!!s;return l},I.prototype._get_characters=function(u,d){var s=this.raw_options[u],l=d||"";return typeof s=="string"&&(l=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},I.prototype._get_number=function(u,d){var s=this.raw_options[u];d=parseInt(d,10),isNaN(d)&&(d=0);var l=parseInt(s,10);return isNaN(l)&&(l=d),l},I.prototype._get_selection=function(u,d,s){var l=this._get_selection_list(u,d,s);if(l.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l[0]},I.prototype._get_selection_list=function(u,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var l=this._get_array(u,s);if(!this._is_valid_selection(l,d))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l},I.prototype._is_valid_selection=function(u,d){return u.length&&d.length&&!u.some(function(s){return d.indexOf(s)===-1})};function g(u,d){var s={};u=f(u);var l;for(l in u)l!==d&&(s[l]=u[l]);if(d&&u[d])for(l in u[d])s[l]=u[d][l];return s}function f(u){var d={},s;for(s in u){var l=s.replace(/-/g,"_");d[l]=u[s]}return d}D.exports.Options=I,D.exports.normalizeOpts=f,D.exports.mergeOpts=g},function(D,I,g){var f=g(8).InputScanner,u=g(9).Tokenizer,d=g(9).TOKEN,s=g(13).Directives,l=g(4),r=g(12).Pattern,a=g(14).TemplatablePattern;function n(N,K){return K.indexOf(N)!==-1}var h={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:d.START,RAW:d.RAW,EOF:d.EOF},O=new s(/\/\*/,/\*\//),S=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,A=/[^\d\.]/,C=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),b=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";b=b.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),b="\\?\\.(?!\\d) "+b,b=b.replace(/ /g,"|");var v=new RegExp(b),p="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),c=p.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),E=new RegExp("^(?:"+c.join("|")+")$"),y,_=function(N,K){u.call(this,N,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var $=new r(this._input),B=new a(this._input).read_options(this._options);this.__patterns={template:B,identifier:B.starting_with(l.identifier).matching(l.identifierMatch),number:$.matching(S),punct:$.matching(v),comment:$.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:$.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:$.matching(/<!--/),html_comment_end:$.matching(/-->/),include:$.starting_with(/#include/).until_after(l.lineBreak),shebang:$.starting_with(/#!/).until_after(l.lineBreak),xml:$.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:B.until(/['\\\n\r\u2028\u2029]/),double_quote:B.until(/["\\\n\r\u2028\u2029]/),template_text:B.until(/[`\\$]/),template_expression:B.until(/[`}\\]/)}};_.prototype=new u,_.prototype._is_comment=function(N){return N.type===h.COMMENT||N.type===h.BLOCK_COMMENT||N.type===h.UNKNOWN},_.prototype._is_opening=function(N){return N.type===h.START_BLOCK||N.type===h.START_EXPR},_.prototype._is_closing=function(N,K){return(N.type===h.END_BLOCK||N.type===h.END_EXPR)&&K&&(N.text==="]"&&K.text==="["||N.text===")"&&K.text==="("||N.text==="}"&&K.text==="{")},_.prototype._reset=function(){y=!1},_.prototype._get_next_token=function(N,K){var $=null;this._readWhitespace();var B=this._input.peek();return B===null?this._create_token(h.EOF,""):($=$||this._read_non_javascript(B),$=$||this._read_string(B),$=$||this._read_word(N),$=$||this._read_singles(B),$=$||this._read_comment(B),$=$||this._read_regexp(B,N),$=$||this._read_xml(B,N),$=$||this._read_punctuation(),$=$||this._create_token(h.UNKNOWN,this._input.next()),$)},_.prototype._read_word=function(N){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(l.allLineBreaks,`
|
|
`),!(N.type===h.DOT||N.type===h.RESERVED&&(N.text==="set"||N.text==="get"))&&E.test(K)?(K==="in"||K==="of")&&(N.type===h.WORD||N.type===h.STRING)?this._create_token(h.OPERATOR,K):this._create_token(h.RESERVED,K):this._create_token(h.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(h.WORD,K)},_.prototype._read_singles=function(N){var K=null;return N==="("||N==="["?K=this._create_token(h.START_EXPR,N):N===")"||N==="]"?K=this._create_token(h.END_EXPR,N):N==="{"?K=this._create_token(h.START_BLOCK,N):N==="}"?K=this._create_token(h.END_BLOCK,N):N===";"?K=this._create_token(h.SEMICOLON,N):N==="."&&A.test(this._input.peek(1))?K=this._create_token(h.DOT,N):N===","&&(K=this._create_token(h.COMMA,N)),K&&this._input.next(),K},_.prototype._read_punctuation=function(){var N=this.__patterns.punct.read();if(N!=="")return N==="="?this._create_token(h.EQUALS,N):N==="?."?this._create_token(h.DOT,N):this._create_token(h.OPERATOR,N)},_.prototype._read_non_javascript=function(N){var K="";if(N==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(h.UNKNOWN,K.trim()+`
|
|
`);if(K=this.__patterns.include.read(),K)return this._create_token(h.UNKNOWN,K.trim()+`
|
|
`);N=this._input.next();var $="#";if(this._input.hasNext()&&this._input.testChar(x)){do N=this._input.next(),$+=N;while(this._input.hasNext()&&N!=="#"&&N!=="=");return N==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?($+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&($+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,$)}this._input.back()}else if(N==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(l.newline);)K+=this._input.next();return y=!0,this._create_token(h.COMMENT,K)}}else if(y&&N==="-"&&(K=this.__patterns.html_comment_end.read(),K))return y=!1,this._create_token(h.COMMENT,K);return null},_.prototype._read_comment=function(N){var K=null;if(N==="/"){var $="";if(this._input.peek(1)==="*"){$=this.__patterns.block_comment.read();var B=O.get_directives($);B&&B.ignore==="start"&&($+=O.readIgnored(this._input)),$=$.replace(l.allLineBreaks,`
|
|
`),K=this._create_token(h.BLOCK_COMMENT,$),K.directives=B}else this._input.peek(1)==="/"&&($=this.__patterns.comment.read(),K=this._create_token(h.COMMENT,$))}return K},_.prototype._read_string=function(N){if(N==="`"||N==="'"||N==='"'){var K=this._input.next();return this.has_char_escapes=!1,N==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(N),this.has_char_escapes&&this._options.unescape_strings&&(K=P(K)),this._input.peek()===N&&(K+=this._input.next()),K=K.replace(l.allLineBreaks,`
|
|
`),this._create_token(h.STRING,K)}return null},_.prototype._allow_regexp_or_xml=function(N){return N.type===h.RESERVED&&n(N.text,["return","case","throw","else","do","typeof","yield"])||N.type===h.END_EXPR&&N.text===")"&&N.opened.previous.type===h.RESERVED&&n(N.opened.previous.text,["if","while","for"])||n(N.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},_.prototype._read_regexp=function(N,K){if(N==="/"&&this._allow_regexp_or_xml(K)){for(var $=this._input.next(),B=!1,R=!1;this._input.hasNext()&&(B||R||this._input.peek()!==N)&&!this._input.testChar(l.newline);)$+=this._input.peek(),B?B=!1:(B=this._input.peek()==="\\",this._input.peek()==="["?R=!0:this._input.peek()==="]"&&(R=!1)),this._input.next();return this._input.peek()===N&&($+=this._input.next(),$+=this._input.read(l.identifier)),this._create_token(h.STRING,$)}return null},_.prototype._read_xml=function(N,K){if(this._options.e4x&&N==="<"&&this._allow_regexp_or_xml(K)){var $="",B=this.__patterns.xml.read_match();if(B){for(var R=B[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=R.indexOf("{")===0,Q=0;B;){var ne=!!B[1],le=B[2],_e=!!B[B.length-1]||le.slice(0,8)==="![CDATA[";if(!_e&&(le===R||G&&le.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ne?--Q:++Q),$+=B[0],Q<=0)break;B=this.__patterns.xml.read_match()}return B||($+=this._input.match(/[\s\S]*/g)[0]),$=$.replace(l.allLineBreaks,`
|
|
`),this._create_token(h.STRING,$)}}return null};function P(N){for(var K="",$=0,B=new f(N),R=null;B.hasNext();)if(R=B.match(/([\s]|[^\\]|\\\\)+/g),R&&(K+=R[0]),B.peek()==="\\"){if(B.next(),B.peek()==="x")R=B.match(/x([0-9A-Fa-f]{2})/g);else if(B.peek()==="u")R=B.match(/u([0-9A-Fa-f]{4})/g);else{K+="\\",B.hasNext()&&(K+=B.next());continue}if(!R)return N;if($=parseInt(R[1],16),$>126&&$<=255&&R[0].indexOf("x")===0)return N;if($>=0&&$<32){K+="\\"+R[0];continue}else $===34||$===39||$===92?K+="\\"+String.fromCharCode($):K+=String.fromCharCode($)}return K}_.prototype._read_string_recursive=function(N,K,$){var B,R;N==="'"?R=this.__patterns.single_quote:N==='"'?R=this.__patterns.double_quote:N==="`"?R=this.__patterns.template_text:N==="}"&&(R=this.__patterns.template_expression);for(var G=R.read(),Q="";this._input.hasNext();){if(Q=this._input.next(),Q===N||!K&&l.newline.test(Q)){this._input.back();break}else Q==="\\"&&this._input.hasNext()?(B=this._input.peek(),B==="x"||B==="u"?this.has_char_escapes=!0:B==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),Q+=this._input.next()):$&&($==="${"&&Q==="$"&&this._input.peek()==="{"&&(Q+=this._input.next()),$===Q&&(N==="`"?Q+=this._read_string_recursive("}",K,"`"):Q+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(Q+=this._input.next())));Q+=R.read(),G+=Q}return G},D.exports.Tokenizer=_,D.exports.TOKEN=h,D.exports.positionable_operators=C.slice(),D.exports.line_starters=p.slice()},function(D){var I=RegExp.prototype.hasOwnProperty("sticky");function g(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},g.prototype.peek=function(f){var u=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(u=this.__input.charAt(f)),u},g.prototype.__match=function(f,u){f.lastIndex=u;var d=f.exec(this.__input);return d&&!(I&&f.sticky)&&(d.index!==u&&(d=null)),d},g.prototype.test=function(f,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(f,u):!1},g.prototype.testChar=function(f,u){var d=this.peek(u);return f.lastIndex=0,d!==null&&f.test(d)},g.prototype.match=function(f){var u=this.__match(f,this.__position);return u?this.__position+=u[0].length:u=null,u},g.prototype.read=function(f,u,d){var s="",l;return f&&(l=this.match(f),l&&(s+=l[0])),u&&(l||!f)&&(s+=this.readUntil(u,d)),s},g.prototype.readUntil=function(f,u){var d="",s=this.__position;f.lastIndex=this.__position;var l=f.exec(this.__input);return l?(s=l.index,u&&(s+=l[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},g.prototype.get_regexp=function(f,u){var d=null,s="g";return u&&I&&(s="y"),typeof f=="string"&&f!==""?d=new RegExp(f,s):f&&(d=new RegExp(f.source,s)),d},g.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(f){var u=this.__position,d=this.readUntilAfter(f);return this.__position=u,d},g.prototype.lookBack=function(f){var u=this.__position-1;return u>=f.length&&this.__input.substring(u-f.length,u).toLowerCase()===f},D.exports.InputScanner=g},function(D,I,g){var f=g(8).InputScanner,u=g(3).Token,d=g(10).TokenStream,s=g(11).WhitespacePattern,l={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},r=function(a,n){this._input=new f(a),this._options=n||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};r.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var a,n=new u(l.START,""),h=null,O=[],S=new d;n.type!==l.EOF;){for(a=this._get_next_token(n,h);this._is_comment(a);)S.add(a),a=this._get_next_token(n,h);S.isEmpty()||(a.comments_before=S,S=new d),a.parent=h,this._is_opening(a)?(O.push(h),h=a):h&&this._is_closing(a,h)&&(a.opened=h,h.closed=a,h=O.pop(),a.parent=h),a.previous=n,n.next=a,this.__tokens.add(a),n=a}return this.__tokens},r.prototype._is_first_token=function(){return this.__tokens.isEmpty()},r.prototype._reset=function(){},r.prototype._get_next_token=function(a,n){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(l.RAW,h):this._create_token(l.EOF,"")},r.prototype._is_comment=function(a){return!1},r.prototype._is_opening=function(a){return!1},r.prototype._is_closing=function(a,n){return!1},r.prototype._create_token=function(a,n){var h=new u(a,n,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},r.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},D.exports.Tokenizer=r,D.exports.TOKEN=l},function(D){function I(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}I.prototype.restart=function(){this.__position=0},I.prototype.isEmpty=function(){return this.__tokens_length===0},I.prototype.hasNext=function(){return this.__position<this.__tokens_length},I.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},I.prototype.peek=function(g){var f=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(f=this.__tokens[g]),f},I.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},D.exports.TokenStream=I},function(D,I,g){var f=g(12).Pattern;function u(d,s){f.call(this,d,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}u.prototype=new f,u.prototype.__set_whitespace_patterns=function(d,s){d+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},u.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var s=this.__split(this._newline_regexp,d);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return d},u.prototype.matching=function(d,s){var l=this._create();return l.__set_whitespace_patterns(d,s),l._update(),l},u.prototype._create=function(){return new u(this._input,this)},u.prototype.__split=function(d,s){d.lastIndex=0;for(var l=0,r=[],a=d.exec(s);a;)r.push(s.substring(l,a.index)),l=a.index+a[0].length,a=d.exec(s);return l<s.length?r.push(s.substring(l,s.length)):r.push(""),r},D.exports.WhitespacePattern=u},function(D){function I(g,f){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,f&&(this._starting_pattern=this._input.get_regexp(f._starting_pattern,!0),this._match_pattern=this._input.get_regexp(f._match_pattern,!0),this._until_pattern=this._input.get_regexp(f._until_pattern),this._until_after=f._until_after)}I.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},I.prototype.read_match=function(){return this._input.match(this._match_pattern)},I.prototype.until_after=function(g){var f=this._create();return f._until_after=!0,f._until_pattern=this._input.get_regexp(g),f._update(),f},I.prototype.until=function(g){var f=this._create();return f._until_after=!1,f._until_pattern=this._input.get_regexp(g),f._update(),f},I.prototype.starting_with=function(g){var f=this._create();return f._starting_pattern=this._input.get_regexp(g,!0),f._update(),f},I.prototype.matching=function(g){var f=this._create();return f._match_pattern=this._input.get_regexp(g,!0),f._update(),f},I.prototype._create=function(){return new I(this._input,this)},I.prototype._update=function(){},D.exports.Pattern=I},function(D){function I(g,f){g=typeof g=="string"?g:g.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+f,"g")}I.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(g);u;)f[u[1]]=u[2],u=this.__directive_pattern.exec(g);return f},I.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=I},function(D,I,g){var f=g(12).Pattern,u={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(s,l){f.call(this,s,l),this.__template_pattern=null,this._disabled=Object.assign({},u),this._excluded=Object.assign({},u),l&&(this.__template_pattern=this._input.get_regexp(l.__template_pattern),this._excluded=Object.assign(this._excluded,l._excluded),this._disabled=Object.assign(this._disabled,l._disabled));var r=new f(s);this.__patterns={handlebars_comment:r.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:r.starting_with(/{{{/).until_after(/}}}/),handlebars:r.starting_with(/{{/).until_after(/}}/),php:r.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:r.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:r.starting_with(/{%/).until_after(/%}/),django_value:r.starting_with(/{{/).until_after(/}}/),django_comment:r.starting_with(/{#/).until_after(/#}/),smarty:r.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:r.starting_with(/{\*/).until_after(/\*}/),smarty_literal:r.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new f,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(s){var l=this._create();return l._disabled[s]=!0,l._update(),l},d.prototype.read_options=function(s){var l=this._create();for(var r in u)l._disabled[r]=s.templating.indexOf(r)===-1;return l._update(),l},d.prototype.exclude=function(s){var l=this._create();return l._excluded[s]=!0,l._update(),l},d.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var l=this._read_template();l;)this._match_pattern?l+=this._input.read(this._match_pattern):l+=this._input.readUntil(this.__template_pattern),s+=l,l=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},d.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},d.prototype._read_template=function(){var s="",l=this._input.peek();if(l==="<"){var r=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&r==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&r==="%"&&(s=s||this.__patterns.erb.read())}else l==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},D.exports.TemplatablePattern=d}],L={};function H(D){var I=L[D];if(I!==void 0)return I.exports;var g=L[D]={exports:{}};return U[D](g,g.exports,H),g.exports}var F=H(0);M=F})();var z=M;!(q=[],V=function(){return{js_beautify:z}}.apply(Se,q),V!==void 0&&(Fe.exports=V))})()},"6eGT":function(Fe,Se,W){"use strict";function q(V){return null}Se.a=q},"7Cbv":function(Fe,Se,W){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function M(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(V)}var z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(u){return typeof u=="string"&&z.test(u)}for(var L=U,H=[],F=0;F<256;++F)H.push((F+256).toString(16).substr(1));function D(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(H[u[d+0]]+H[u[d+1]]+H[u[d+2]]+H[u[d+3]]+"-"+H[u[d+4]]+H[u[d+5]]+"-"+H[u[d+6]]+H[u[d+7]]+"-"+H[u[d+8]]+H[u[d+9]]+"-"+H[u[d+10]]+H[u[d+11]]+H[u[d+12]]+H[u[d+13]]+H[u[d+14]]+H[u[d+15]]).toLowerCase();if(!L(s))throw TypeError("Stringified UUID is invalid");return s}var I=D;function g(u,d,s){u=u||{};var l=u.random||(u.rng||M)();if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,d){s=s||0;for(var r=0;r<16;++r)d[s+r]=l[r];return d}return I(l)}var f=Se.a=g},"7ahc":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return O});var q=W("k1fw"),V=W("0Owb"),M=W("+L6B"),z=W("2/Rp"),U=W("y8nQ"),L=W("Vl3Y"),H=W("tJVT"),F=W("OaEy"),D=W("2fM7"),I=W("q1tI"),g=W.n(I),f=W("VrN/"),u=W.n(f),d=W("p77/"),s=W.n(d),l=W("c5Ni"),r=W.n(l),a=D.a.Option,n={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};Se.b=function(S){var x=S.callback,A=S.onCancel,C=Object(I.useState)("python"),b=Object(H.a)(C,2),v=b[0],p=b[1];function c(y){p(h[y][1])}function E(y){x(y)}return g.a.createElement(L.a,Object(V.a)({},n,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),g.a.createElement(L.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(D.a,{onChange:c},Object.keys(h).map(function(y){return g.a.createElement(a,{key:y,value:y},h[y][0])}))),g.a.createElement(L.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(O,{mode:v})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(z.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function O(S){var x=S.value,A=S.onChange,C=S.mode,b=S.options,v=b===void 0?{}:b,p=Object(I.useRef)(),c=Object(I.useState)(),E=Object(H.a)(c,2),y=E[0],_=E[1];return Object(I.useEffect)(function(){if(y){function P(N){var K=N.getValue();A&&A(K)}return y.on("change",P),function(){y.off("change",P)}}},[y,A]),Object(I.useEffect)(function(){y&&y.setOption("mode",C)},[y,C]),Object(I.useEffect)(function(){y&&((x!==y.getValue()||x==="")&&setTimeout(function(){y.setValue(x||" ")},300))},[y,x]),Object(I.useEffect)(function(){if(p.current&&!y){var P=u.a.fromTextArea(p.current,Object(q.a)({mode:C,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},v));_(P)}},[p.current,y]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:p}))}},"7ixt":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return M});var q={adjustX:1,adjustY:1},V=[0,0],M={left:{points:["cr","cl"],overflow:q,offset:[-4,0],targetOffset:V},right:{points:["cl","cr"],overflow:q,offset:[4,0],targetOffset:V},top:{points:["bc","tc"],overflow:q,offset:[0,-4],targetOffset:V},bottom:{points:["tc","bc"],overflow:q,offset:[0,4],targetOffset:V},topLeft:{points:["bl","tl"],overflow:q,offset:[0,-4],targetOffset:V},leftTop:{points:["tr","tl"],overflow:q,offset:[-4,0],targetOffset:V},topRight:{points:["br","tr"],overflow:q,offset:[0,-4],targetOffset:V},rightTop:{points:["tl","tr"],overflow:q,offset:[4,0],targetOffset:V},bottomRight:{points:["tr","br"],overflow:q,offset:[0,4],targetOffset:V},rightBottom:{points:["bl","br"],overflow:q,offset:[4,0],targetOffset:V},bottomLeft:{points:["tl","bl"],overflow:q,offset:[0,4],targetOffset:V},leftBottom:{points:["br","bl"],overflow:q,offset:[-4,0],targetOffset:V}},z=M},"815F":function(Fe,Se,W){"use strict";W.d(Se,"e",function(){return H}),W.d(Se,"c",function(){return D}),W.d(Se,"d",function(){return I}),W.d(Se,"a",function(){return f}),W.d(Se,"f",function(){return u}),W.d(Se,"b",function(){return d});var q=W("KQm4"),V=W("VTBJ"),M=W("Ff2n"),z=W("Zm9Q"),U=W("Kwbf"),L=W("OZM5");function H(s,l){return s!=null?s:l}function F(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=new Map;function r(a){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(a||[]).forEach(function(h){var O=h.key,S=h.children;Object(U.a)(O!=null,"Tree node must have a certain key: [".concat(n).concat(O,"]"));var x=String(O);Object(U.a)(!l.has(x)||O===null||O===void 0,"Same 'key' exist in the Tree: ".concat(x)),l.set(x,!0),r(S,"".concat(n).concat(x," > "))})}r(s)}function D(s){function l(r){var a=Object(z.a)(r);return a.map(function(n){if(!Object(L.i)(n))return Object(U.a)(!n,"Tree/TreeNode can only accept TreeNode as children."),null;var h=n.key,O=n.props,S=O.children,x=Object(M.a)(O,["children"]),A=Object(V.a)({key:h},x),C=l(S);return C.length&&(A.children=C),A}).filter(function(n){return n})}return l(s)}function I(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=new Set(l===!0?[]:l),a=[];function n(h){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return h.map(function(S,x){var A=Object(L.h)(O?O.pos:"0",x),C=H(S.key,A),b=Object(V.a)(Object(V.a)({},S),{},{parent:O,pos:A,children:null,data:S,isStart:[].concat(Object(q.a)(O?O.isStart:[]),[x===0]),isEnd:[].concat(Object(q.a)(O?O.isEnd:[]),[x===h.length-1])});return a.push(b),l===!0||r.has(C)?b.children=n(S.children||[],b):b.children=[],b})}return n(s),a}function g(s,l,r){var a;r?typeof r=="string"?a=function(O){return O[r]}:typeof r=="function"&&(a=function(O){return r(O)}):a=function(O,S){return H(O.key,S)};function n(h,O,S){var x=h?h.children:s,A=h?Object(L.h)(S.pos,O):"0";if(h){var C=a(h,A),b={node:h,index:O,pos:A,key:C,parentPos:S.node?S.pos:null,level:S.level+1};l(b)}x&&x.forEach(function(v,p){n(v,p,{node:h,pos:A,level:S?S.level+1:-1})})}n(null)}function f(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=l.initWrapper,a=l.processEntity,n=l.onProcessFinished,h=arguments.length>2?arguments[2]:void 0,O={},S={},x={posEntities:O,keyEntities:S};return r&&(x=r(x)||x),g(s,function(A){var C=A.node,b=A.index,v=A.pos,p=A.key,c=A.parentPos,E=A.level,y={node:C,index:b,key:p,pos:v,level:E},_=H(p,v);O[v]=y,S[_]=y,y.parent=O[c],y.parent&&(y.parent.children=y.parent.children||[],y.parent.children.push(y)),a&&a(y,x)},h),n&&n(x),x}function u(s,l){var r=l.expandedKeys,a=l.selectedKeys,n=l.loadedKeys,h=l.loadingKeys,O=l.checkedKeys,S=l.halfCheckedKeys,x=l.dragOverNodeKey,A=l.dropPosition,C=l.keyEntities,b=C[s],v={eventKey:s,expanded:r.indexOf(s)!==-1,selected:a.indexOf(s)!==-1,loaded:n.indexOf(s)!==-1,loading:h.indexOf(s)!==-1,checked:O.indexOf(s)!==-1,halfChecked:S.indexOf(s)!==-1,pos:String(b?b.pos:""),dragOver:x===s&&A===0,dragOverGapTop:x===s&&A===-1,dragOverGapBottom:x===s&&A===1};return v}function d(s){var l=s.data,r=s.expanded,a=s.selected,n=s.checked,h=s.loaded,O=s.loading,S=s.halfChecked,x=s.dragOver,A=s.dragOverGapTop,C=s.dragOverGapBottom,b=s.pos,v=s.active,p=Object(V.a)(Object(V.a)({},l),{},{expanded:r,selected:a,checked:n,loaded:h,loading:O,halfChecked:S,dragOver:x,dragOverGapTop:A,dragOverGapBottom:C,pos:b,active:v});return"props"in p||Object.defineProperty(p,"props",{get:function(){return Object(U.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),s}}),p}},"8EBN":function(Fe,Se,W){(function(q){q(W("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 V=0;V<q.modeInfo.length;V++){var M=q.modeInfo[V];M.mimes&&(M.mime=M.mimes[0])}q.findModeByMIME=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var L=q.modeInfo[U];if(L.mime==z)return L;if(L.mimes){for(var H=0;H<L.mimes.length;H++)if(L.mimes[H]==z)return L}}if(/\+xml$/.test(z))return q.findModeByMIME("application/xml");if(/\+json$/.test(z))return q.findModeByMIME("application/json")},q.findModeByExtension=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var L=q.modeInfo[U];if(L.ext){for(var H=0;H<L.ext.length;H++)if(L.ext[H]==z)return L}}},q.findModeByFileName=function(z){for(var U=0;U<q.modeInfo.length;U++){var L=q.modeInfo[U];if(L.file&&L.file.test(z))return L}var H=z.lastIndexOf("."),F=H>-1&&z.substring(H+1,z.length);if(F)return q.findModeByExtension(F)},q.findModeByName=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var L=q.modeInfo[U];if(L.name.toLowerCase()==z)return L;if(L.alias){for(var H=0;H<L.alias.length;H++)if(L.alias[H].toLowerCase()==z)return L}}}})},"8hTe":function(Fe,Se,W){Fe.exports={button:"button___1wy9m"}},"9Bee":function(Fe,Se,W){"use strict";var q=W("DYRE"),V=W("zeV3"),M=W("+L6B"),z=W("2/Rp"),U=W("k1fw"),L=W("9og8"),H=W("tJVT"),F=W("WmNS"),D=W.n(F),I=W("q1tI"),g=W.n(I),f=W("vg9a"),u=W("DlQD"),d=W.n(u),s=W("rUJ1");function l(J,w){var T=J.match(/^(\s+)(?:```)/);if(T===null)return w;var j=T[1];return w.split(`
|
|
`).map(function(ee){var X=ee.match(/^\s+/);if(X===null)return ee;var ye=Object(H.a)(X,1),Ve=ye[0];return Ve.length>=j.length?ee.slice(j.length):ee}).join(`
|
|
`)}var r=[],a=["<ul>"],n=new d.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){r.length=0,a=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(J,w,T,j){if(w>=J.length||J[w].level<=T)return w;var ee=J[w];j.push("<li><a href='#"+ee.anchor+"'>"+ee.text+"</a>"),w++;var X=[];return w=x(J,w,ee.level,X),X.length>0&&(j.push("<ul>"),X.forEach(function(ye){j.push(ye)}),j.push("</ul>")),j.push("</li>"),w=x(J,w,T,j),w}function A(){return x(r,0,0,a),a.push("</ul>"),a.join("")}var C={heading:function(w){var T=h.exec(w);if(T)return{type:"heading",raw:T[0],depth:T[1].length,text:T[2]}},fences:function(w){var T=this.rules.block.fences.exec(w);if(T){var j=T[0],ee=l(j,T[3]||""),X=T[2]?T[2].trim():T[2];if(["latex","katex","math"].indexOf(X)>=0){var ye=p(),Ve=ee;ee=ye,c[ye]={type:"block",expression:Ve}}return{type:"code",raw:j,lang:X,text:ee}}}},b=/(?:\${2})([^\n`]+?)(?:\${2})/gi,v=0,p=function(){return"__special_katext_id_".concat(v++,"__")},c={};function E(){return c}function y(){v=0,c={}}function _(J){return J=J.replace(b,function(w,T){var j=p();return c[j]={type:"inline",expression:T},j}),J}var P=n.listitem;n.listitem=function(J){return P(_(J))};var N=n.paragraph;n.paragraph=function(J){return N(_(J))};var K=n.tablecell;n.tablecell=function(J,w){return K(_(J),w)},n.code=function(J,w,T){var j=(w||"").match(/\S*/)[0];return j?["latex","katex","math"].indexOf(j)>=0?"<p class='editormd-tex'>".concat(J,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(w,'">').concat(T?J:Object(s.escape)(J,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(T?J:Object(s.escape)(J,!0))+"</code></pre>"},n.heading=function(J,w,T){var j=this.options.headerPrefix+T.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return r.push({anchor:j,level:w,text:J}),"<h"+w+' id="'+j+'">'+J+"</h"+w+">"},d.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),d.a.use({tokenizer:C,renderer:n});var $=d.a,B=W("SJMd"),R=W("ulZh"),G=W.n(R),Q=W("m3rI"),ne=W("Oy/b"),le=W("p5ED"),_e=W("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var pe=function(J,w){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,j){T.__proto__=j}||function(T,j){for(var ee in j)Object.prototype.hasOwnProperty.call(j,ee)&&(T[ee]=j[ee])})(J,w)};function Ee(J,w){function T(){this.constructor=J}pe(J,w),J.prototype=w===null?Object.create(w):(T.prototype=w.prototype,new T)}function Oe(J,w,T,j){return new(T||(T=Promise))(function(ee,X){function ye(ht){try{ot(j.next(ht))}catch(Ue){X(Ue)}}function Ve(ht){try{ot(j.throw(ht))}catch(Ue){X(Ue)}}function ot(ht){var Ue;ht.done?ee(ht.value):(Ue=ht.value,Ue instanceof T?Ue:new T(function(mt){mt(Ue)})).then(ye,Ve)}ot((j=j.apply(J,w||[])).next())})}function we(J,w){var T,j,ee,X,ye={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Ve(ot){return function(ht){return function(Ue){if(T)throw new TypeError("Generator is already executing.");for(;ye;)try{if(T=1,j&&(ee=2&Ue[0]?j.return:Ue[0]?j.throw||((ee=j.return)&&ee.call(j),0):j.next)&&!(ee=ee.call(j,Ue[1])).done)return ee;switch(j=0,ee&&(Ue=[2&Ue[0],ee.value]),Ue[0]){case 0:case 1:ee=Ue;break;case 4:return ye.label++,{value:Ue[1],done:!1};case 5:ye.label++,j=Ue[1],Ue=[0];continue;case 7:Ue=ye.ops.pop(),ye.trys.pop();continue;default:if(!(ee=ye.trys,(ee=ee.length>0&&ee[ee.length-1])||Ue[0]!==6&&Ue[0]!==2)){ye=0;continue}if(Ue[0]===3&&(!ee||Ue[1]>ee[0]&&Ue[1]<ee[3])){ye.label=Ue[1];break}if(Ue[0]===6&&ye.label<ee[1]){ye.label=ee[1],ee=Ue;break}if(ee&&ye.label<ee[2]){ye.label=ee[2],ye.ops.push(Ue);break}ee[2]&&ye.ops.pop(),ye.trys.pop();continue}Ue=w.call(J,ye)}catch(mt){Ue=[6,mt],j=0}finally{T=ee=0}if(5&Ue[0])throw Ue[1];return{value:Ue[0]?Ue[1]:void 0,done:!0}}([ot,ht])}}}function he(){for(var J=0,w=0,T=arguments.length;w<T;w++)J+=arguments[w].length;var j=Array(J),ee=0;for(w=0;w<T;w++)for(var X=arguments[w],ye=0,Ve=X.length;ye<Ve;ye++,ee++)j[ee]=X[ye];return j}var oe=function(){function J(){}return J.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},J.setAttributes=function(w,T){for(var j=0,ee=T;j<ee.length;j++){var X=ee[j],ye=X[0],Ve=X[1];w.setAttribute(ye,Ve)}},J.createRect=function(w,T,j){var ee=document.createElementNS("http://www.w3.org/2000/svg","rect");return ee.setAttribute("width",w.toString()),ee.setAttribute("height",T.toString()),j&&J.setAttributes(ee,j),ee},J.createLine=function(w,T,j,ee,X){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",w.toString()),ye.setAttribute("y1",T.toString()),ye.setAttribute("x2",j.toString()),ye.setAttribute("y2",ee.toString()),X&&J.setAttributes(ye,X),ye},J.createPolygon=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","polygon");return j.setAttribute("points",w),T&&J.setAttributes(j,T),j},J.createCircle=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","circle");return j.setAttribute("cx",(w/2).toString()),j.setAttribute("cy",(w/2).toString()),j.setAttribute("r",w.toString()),T&&J.setAttributes(j,T),j},J.createEllipse=function(w,T,j){var ee=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ee.setAttribute("cx",(w/2).toString()),ee.setAttribute("cy",(T/2).toString()),ee.setAttribute("rx",(w/2).toString()),ee.setAttribute("ry",(T/2).toString()),j&&J.setAttributes(ee,j),ee},J.createGroup=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return w&&J.setAttributes(T,w),T},J.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},J.createMarker=function(w,T,j,ee,X,ye,Ve){var ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return J.setAttributes(ot,[["id",w],["orient",T],["markerWidth",j.toString()],["markerHeight",ee.toString()],["refX",X.toString()],["refY",ye.toString()]]),ot.appendChild(Ve),ot},J.createText=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),w&&J.setAttributes(T,w),T},J.createTSpan=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","tspan");return j.textContent=w,T&&J.setAttributes(j,T),j},J.createImage=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return w&&J.setAttributes(T,w),T},J.createPoint=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return j.x=w,j.y=T,j},J.createPath=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","path");return j.setAttribute("d",w),T&&J.setAttributes(j,T),j},J}(),Le=function(){function J(){}return J.addKey=function(w){J.key=w},Object.defineProperty(J,"isLicensed",{get:function(){return!!J.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(J.key)},enumerable:!1,configurable:!0}),J}(),Ye=function(){function J(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return J.prototype.rasterize=function(w,T,j){var ee=this;return new Promise(function(X){var ye=j!==void 0?j:document.createElement("canvas");w===null&&(ee.markersOnly=!0,ee.naturalSize=!1);var Ve=document.createElementNS("http://www.w3.org/2000/svg","svg");Ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ve.setAttribute("width",T.width.baseVal.valueAsString),Ve.setAttribute("height",T.height.baseVal.valueAsString),Ve.setAttribute("viewBox","0 0 "+T.viewBox.baseVal.width.toString()+" "+T.viewBox.baseVal.height.toString()),Ve.innerHTML=T.innerHTML,ee.naturalSize===!0?(Ve.width.baseVal.value=w.naturalWidth,Ve.height.baseVal.value=w.naturalHeight):ee.width!==void 0&&ee.height!==void 0&&(Ve.width.baseVal.value=ee.width,Ve.height.baseVal.value=ee.height),ye.width=Ve.width.baseVal.value,ye.height=Ve.height.baseVal.value;var ot=Ve.outerHTML,ht=ye.getContext("2d");ee.markersOnly!==!0&&ht.drawImage(w,0,0,ye.width,ye.height);var Ue=window.URL,mt=new Image(ye.width,ye.height);mt.setAttribute("crossOrigin","anonymous");var Rt=new Blob([ot],{type:"image/svg+xml"}),Mt=Ue.createObjectURL(Rt);mt.onload=function(){ht.drawImage(mt,0,0),Ue.revokeObjectURL(Mt);var Jt=ye.toDataURL(ee.imageType,ee.imageQuality);X(Jt)},mt.src=Mt})},J}(),nt=function(){},qe=function(){function J(w){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+w+"_"}return Object.defineProperty(J.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),J.prototype.addClass=function(w){return this.styleSheet===void 0&&this.addStyleSheet(),w.name=""+this.classNamePrefix+w.localName,this.classes.push(w),this.styleSheet.sheet.insertRule("."+w.name+" {"+w.style+"}",this.styleSheet.sheet.cssRules.length),w},J.prototype.addRule=function(w){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(w),this.styleSheet.sheet.insertRule(w.selector+" {"+w.style+"}",this.styleSheet.sheet.cssRules.length)},J.prototype.addStyleSheet=function(){var w;this.styleSheet=document.createElement("style"),((w=this.styleSheetRoot)!==null&&w!==void 0?w:document.head).appendChild(this.styleSheet),this.addRule(new it("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new it("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new it("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new He("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new He("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},J.prototype.removeStyleSheet=function(){var w;this.styleSheet&&(((w=this.styleSheetRoot)!==null&&w!==void 0?w:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},J}(),it=function(J,w){this.selector=J,this.style=w},He=function(J,w){this.localName=J,this.style=w},$e=function(){function J(w,T,j,ee,X){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=w,this.displayMode=T,this.markerItems=j,this.uiStyleSettings=ee,this.styles=X,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return J.prototype.show=function(w){var T=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=w,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var j=document.createElement("div");j.className=this.toolbarBlockStyleClass.name,j.style.whiteSpace="nowrap",this.uiContainer.appendChild(j),this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(j,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(X){var ye=document.createElement("div");ye.className=""+T.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",X.typeName),ye.innerHTML=X.icon,ye.addEventListener("click",function(){T.markerToolbarButtonClicked(ye,X)}),T.buttons.push(ye),T.markerButtons.push(ye)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var ee=document.createElement("div");ee.className=this.toolbarBlockStyleClass.name,ee.style.whiteSpace="nowrap",ee.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(ee),this.addActionButton(ee,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(ee,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},J.prototype.addButtonClickListener=function(w){this.buttonClickListeners.push(w)},J.prototype.removeButtonClickListener=function(w){this.buttonClickListeners.indexOf(w)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(w),1)},J.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},J.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var w=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var T=0;T<this.markerButtons.length;T++)T<w||T===w&&this.markerButtons.length-1===w?this.markerButtonBlock.appendChild(this.markerButtons[T]):(T===w&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[T]))}},J.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},J.prototype.resetButtonStyles=function(){var w=this;this.buttons.forEach(function(T){T.className=T.className.replace(w.uiStyleSettings.toolbarButtonStyleColorsClassName?w.uiStyleSettings.toolbarButtonStyleColorsClassName:w.toolbarButtonStyleColorsClass.name,"").trim(),T.className=T.className.replace(w.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?w.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:w.toolbarActiveButtonStyleColorsClass.name,"").trim(),T.className+=" "+(w.uiStyleSettings.toolbarButtonStyleColorsClassName?w.uiStyleSettings.toolbarButtonStyleColorsClassName:w.toolbarButtonStyleColorsClass.name)})},J.prototype.addActionButton=function(w,T,j){var ee=this,X=document.createElement("div");switch(X.className=""+this.toolbarButtonStyleClass.name,X.innerHTML=T,X.setAttribute("data-action",j),X.addEventListener("click",function(){ee.actionToolbarButtonClicked(X,j)}),j){case"select":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":X.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":X.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":X.style.fill=this.uiStyleSettings.closeButtonColor}w.appendChild(X),this.buttons.push(X)},J.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new He("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new He("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new He("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new He("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new He("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var w=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new He("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*w)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*w)+`px;
|
|
padding: `+w+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new He("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new He("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new it("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new it("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},J.prototype.markerToolbarButtonClicked=function(w,T){this.setActiveButton(w),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(j){return j("marker",T)}),this.markerButtonOverflowBlock.style.display="none"},J.prototype.actionToolbarButtonClicked=function(w,T){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(j){return j("action",T)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},J.prototype.setActiveButton=function(w){this.resetButtonStyles(),w.className=w.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),w.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},J.prototype.setActiveMarkerButton=function(w){var T=this.markerButtons.find(function(j){return j.getAttribute("data-type-name")===w});T&&this.setActiveButton(T)},J.prototype.setCurrentMarker=function(w){var T=this;this.currentMarker=w,this.buttons.filter(function(j){return/delete|notes/.test(j.getAttribute("data-action"))}).forEach(function(j){T.currentMarker===void 0?(j.style.fillOpacity="0.4",j.style.pointerEvents="none"):(j.style.fillOpacity="1",j.style.pointerEvents="all")})},J}(),Qe=function(){function J(w,T,j,ee){this.panels=[],this.panelButtons=[],this.markerjsContainer=w,this.displayMode=T,this.uiStyleSettings=j,this.styles=ee,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return J.prototype.addStyles=function(){var w;this.toolboxStyleClass=this.styles.addClass(new He("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new He("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var T=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new He("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new He("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new He("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new He("toolbox-panel-row_colors",`
|
|
background-color: `+((w=this.uiStyleSettings.toolboxBackgroundColor)!==null&&w!==void 0?w:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new He("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
padding: `+T+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new He("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new He("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new it("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new it("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},J.prototype.show=function(w){var T;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=w,this.uiContainer.className=this.toolboxStyleClass.name+" "+((T=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},J.prototype.setPanelButtons=function(w){var T,j,ee=this;this.panels=w,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((T=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((j=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&j!==void 0?j:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(X){var ye;X.uiStyleSettings=ee.uiStyleSettings;var Ve=document.createElement("div");Ve.className=ee.toolboxButtonStyleClass.name+" "+((ye=ee.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:ee.toolboxButtonStyleColorsClass.name),Ve.innerHTML=X.icon,Ve.title=X.title,Ve.addEventListener("click",function(){ee.panelButtonClick(X)}),ee.panelButtons.push(Ve),ee.buttonRow.appendChild(Ve)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},J.prototype.panelButtonClick=function(w){var T=this,j=-1;if(w!==this.activePanel){j=this.panels.indexOf(w),this.panelRow.innerHTML="";var ee=w.getUi();ee.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(ee),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=w}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){T.displayMode==="inline"?T.panelRow.style.display="none":T.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(X,ye){var Ve,ot;X.className=T.toolboxButtonStyleClass.name+" "+(ye===j?""+((Ve=T.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ve!==void 0?Ve:T.toolboxActiveButtonStyleColorsClass.name):""+((ot=T.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ot!==void 0?ot:T.toolboxButtonStyleColorsClass.name))})},J}(),gt=function(J,w){this.title=J,this.icon=w},et=function(J){function w(T,j,ee,X){var ye=J.call(this,T,X||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=j,ye.currentColor=ee,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");return j.style.overflow="hidden",j.style.whiteSpace="nowrap",this.colors.forEach(function(ee){var X=T.getColorBox(ee);j.appendChild(X),T.colorBoxes.push(X)}),j},w.prototype.getColorBox=function(T){var j=this,ee=this.uiStyleSettings.toolbarHeight/4,X=this.uiStyleSettings.toolbarHeight-ee,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=X-2+"px",ye.style.height=X-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(X+2)/2+"px",ye.style.borderColor=T===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){j.setCurrentColor(T,ye)});var Ve=document.createElement("div");return Ve.style.display="inline-block",Ve.style.width=X-2+"px",Ve.style.height=X-2+"px",Ve.style.backgroundColor=T,Ve.style.borderRadius=X/2+"px",T==="transparent"&&(Ve.style.fill=this.uiStyleSettings.toolboxAccentColor,Ve.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ye.appendChild(Ve),ye},w.prototype.setCurrentColor=function(T,j){var ee=this;this.currentColor=T,this.colorBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(T)},w}(gt),tt=function(){function J(w,T,j){this._state="new",this._isSelected=!1,this._container=w,this._overlayContainer=T,this.globalSettings=j,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(J.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),J.prototype.ownsTarget=function(w){return!1},Object.defineProperty(J.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),J.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},J.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},J.prototype.pointerDown=function(w,T){},J.prototype.dblClick=function(w,T){},J.prototype.manipulate=function(w){},J.prototype.pointerUp=function(w){this.stateChanged()},J.prototype.dispose=function(){},J.prototype.addMarkerVisualToContainer=function(w){this.container.childNodes.length>0?this.container.insertBefore(w,this.container.childNodes[0]):this.container.appendChild(w)},J.prototype.getState=function(){return{typeName:J.typeName,state:this.state,notes:this.notes}},J.prototype.restoreState=function(w){this._state=w.state,this.notes=w.notes},J.prototype.scale=function(w,T){},J.prototype.colorChanged=function(w){this.onColorChanged&&this.onColorChanged(w),this.stateChanged()},J.prototype.fillColorChanged=function(w){this.onFillColorChanged&&this.onFillColorChanged(w),this.stateChanged()},J.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var w=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),w.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(w)&&this.onStateChanged(this)}},J.typeName="MarkerBase",J}(),Je=function(){function J(){this.findGripByVisual=this.findGripByVisual.bind(this)}return J.prototype.findGripByVisual=function(w){return this.topLeft.ownsTarget(w)?this.topLeft:this.topCenter.ownsTarget(w)?this.topCenter:this.topRight.ownsTarget(w)?this.topRight:this.centerLeft.ownsTarget(w)?this.centerLeft:this.centerRight.ownsTarget(w)?this.centerRight:this.bottomLeft.ownsTarget(w)?this.bottomLeft:this.bottomCenter.ownsTarget(w)?this.bottomCenter:this.bottomRight.ownsTarget(w)?this.bottomRight:void 0},J}(),vt=function(){function J(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return J.prototype.ownsTarget=function(w){return w===this.visual||w===this.visual.childNodes[0]||w===this.visual.childNodes[1]},J}(),wt=function(){function J(){}return J.toITransformMatrix=function(w){return{a:w.a,b:w.b,c:w.c,d:w.d,e:w.e,f:w.f}},J.toSVGMatrix=function(w,T){return w.a=T.a,w.b=T.b,w.c=T.c,w.d=T.d,w.e=T.e,w.f=T.f,w},J}(),Et=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.left=0,X.top=0,X.width=0,X.height=0,X.defaultSize={x:50,y:20},X.offsetX=0,X.offsetY=0,X.rotationAngle=0,X.CB_DISTANCE=10,X._suppressMarkerCreateEvent=!1,X.container.transform.baseVal.appendItem(oe.createTransform()),X.setupControlBox(),X}return Ee(w,J),Object.defineProperty(w.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"visual",{get:function(){return this._visual},set:function(T){this._visual=T;var j=oe.createTransform();this._visual.transform.baseVal.appendItem(j)},enumerable:!1,configurable:!0}),w.prototype.ownsTarget=function(T){return!!J.prototype.ownsTarget.call(this,T)||!!(this.controlGrips.findGripByVisual(T)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(T))},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="new"&&(this.left=T.x,this.top=T.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var ee=this.unrotatePoint(T);if(this.manipulationStartX=ee.x,this.manipulationStartY=ee.y,this.offsetX=ee.x-this.left,this.offsetY=ee.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(j),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(j)){this.activeGrip=this.rotatorGrip;var X=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=X.x-this.width/2,this.top=X.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},w.prototype.pointerUp=function(T){var j=this.state;J.prototype.pointerUp.call(this,T),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(T),this._state="select",j==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},w.prototype.moveVisual=function(T){this.visual.style.transform="translate("+T.x+"px, "+T.y+"px)"},w.prototype.manipulate=function(T){var j=this.unrotatePoint(T);this.state==="creating"?this.resize(T):this.state==="move"?(this.left=this.manipulationStartLeft+(j.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(j.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(j):this.state==="rotate"&&this.rotate(T)},w.prototype.resize=function(T){var j=this.manipulationStartLeft,ee=this.manipulationStartWidth,X=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:j=this.manipulationStartLeft+T.x-this.manipulationStartX,ee=this.manipulationStartWidth+this.manipulationStartLeft-j;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:ee=this.manipulationStartWidth+T.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:X=this.manipulationStartTop+T.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-X;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+T.y-this.manipulationStartY}ee>=0?(this.left=j,this.width=ee):(this.left=j+ee,this.width=-ee),ye>=0?(this.top=X,this.height=ye):(this.top=X+ye,this.height=-ye),this.setSize()},w.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},w.prototype.rotate=function(T){if(Math.abs(T.x-this.centerX)>.1){var j=Math.sign(T.x-this.centerX);this.rotationAngle=180*Math.atan((T.y-this.centerY)/(T.x-this.centerX))/Math.PI+90*j,this.applyRotation()}},w.prototype.applyRotation=function(){var T=this.container.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(T,0)},w.prototype.rotatePoint=function(T){if(this.rotationAngle===0)return T;var j=this.container.getCTM(),ee=oe.createPoint(T.x,T.y);return{x:(ee=ee.matrixTransform(j)).x,y:ee.y}},w.prototype.unrotatePoint=function(T){if(this.rotationAngle===0)return T;var j=this.container.getCTM();j=j.inverse();var ee=oe.createPoint(T.x,T.y);return{x:(ee=ee.matrixTransform(j)).x,y:ee.y}},w.prototype.select=function(){J.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},w.prototype.deselect=function(){J.prototype.deselect.call(this),this.controlBox.style.display="none"},w.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var T=oe.createTransform();T.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(T),this.container.appendChild(this.controlBox),this.controlRect=oe.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=oe.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Je,this.addControlGrips(),this.controlBox.style.display="none"},w.prototype.adjustControlBox=function(){var T=this.controlBox.transform.baseVal.getItem(0);T.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(T,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},w.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},w.prototype.createGrip=function(){var T=new vt;return T.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(T.visual),T},w.prototype.positionGrips=function(){var T=this.controlGrips.topLeft.GRIP_SIZE,j=-T/2,ee=j,X=(this.width+this.CB_DISTANCE)/2-T/2,ye=(this.height+this.CB_DISTANCE)/2-T/2,Ve=this.height+this.CB_DISTANCE-T/2,ot=this.width+this.CB_DISTANCE-T/2;this.positionGrip(this.controlGrips.topLeft.visual,j,ee),this.positionGrip(this.controlGrips.topCenter.visual,X,ee),this.positionGrip(this.controlGrips.topRight.visual,ot,ee),this.positionGrip(this.controlGrips.centerLeft.visual,j,ye),this.positionGrip(this.controlGrips.centerRight.visual,ot,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,j,Ve),this.positionGrip(this.controlGrips.bottomCenter.visual,X,Ve),this.positionGrip(this.controlGrips.bottomRight.visual,ot,Ve),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,X,ee-3*this.CB_DISTANCE)},w.prototype.positionGrip=function(T,j,ee){var X=T.transform.baseVal.getItem(0);X.setTranslate(j,ee),T.transform.baseVal.replaceItem(X,0)},w.prototype.hideControlBox=function(){this.controlBox.style.display="none"},w.prototype.showControlBox=function(){this.controlBox.style.display=""},w.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:wt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:wt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},J.prototype.getState.call(this))},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T);var j=T;this.left=j.left,this.top=j.top,this.width=j.width,this.height=j.height,this.rotationAngle=j.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(wt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,j.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(wt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,j.containerTransformMatrix))},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j);var ee=this.rotatePoint({x:this.left,y:this.top}),X=this.unrotatePoint({x:ee.x*T,y:ee.y*j});this.left=X.x,this.top=X.y,this.width=this.width*T,this.height=this.height*j,this.adjustControlBox()},w}(tt),xt=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.createVisual=X.createVisual.bind(X),X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.visual)},w.prototype.createVisual=function(){this.visual=oe.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},w.prototype.manipulate=function(T){J.prototype.manipulate.call(this,T)},w.prototype.resize=function(T){J.prototype.resize.call(this,T),this.setSize()},w.prototype.setSize=function(){J.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},w.prototype.pointerUp=function(T){J.prototype.pointerUp.call(this,T),this.setSize()},w.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},w.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},w.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},w.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},w.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},J.prototype.getState.call(this))},w.prototype.restoreState=function(T){var j=T;this.fillColor=j.fillColor,this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.opacity=j.opacity,this.createVisual(),J.prototype.restoreState.call(this,T),this.setSize()},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.setSize()},w.title="Rectangle marker",w}(Et),kt=function(J){function w(T,j,ee,X){var ye=J.call(this,T,X||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=j,ye.currentWidth=ee,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",this.widths.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.flexGrow="2",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===T.currentWidth?T.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){T.setCurrentWidth(ee,X)}),j.appendChild(X);var ye=document.createElement("div");ye.innerText=ee.toString(),ye.style.marginRight="5px",X.appendChild(ye);var Ve=document.createElement("div");Ve.style.minHeight="20px",Ve.style.flexGrow="2",Ve.style.display="flex",Ve.style.alignItems="center";var ot=document.createElement("hr");ot.style.minWidth="20px",ot.style.border="0px",ot.style.borderTop=ee+"px solid "+T.uiStyleSettings.toolboxColor,ot.style.flexGrow="2",Ve.appendChild(ot),X.appendChild(Ve),T.widthBoxes.push(X)}),j},w.prototype.setCurrentWidth=function(T,j){var ee=this;this.currentWidth=T,this.widthBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},w}(gt),Ot=function(J){function w(T,j,ee,X){var ye=J.call(this,T,X||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ye.styles=[],ye.styleBoxes=[],ye.styles=j,ye.currentStyle=ee,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",this.styles.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/T.styles.length-5+"%",X.style.borderColor=ee===T.currentStyle?T.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){T.setCurrentStyle(ee,X)}),j.appendChild(X);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var Ve=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+T.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(ee!==""?'stroke-dasharray="'+ee+'"':"")+` />
|
|
</svg>`;ye.innerHTML=Ve,X.appendChild(ye),T.styleBoxes.push(X)}),j},w.prototype.setCurrentStyle=function(T,j){var ee=this;this.currentStyle=T,this.styleBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},w}(gt),Ae=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new et("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new kt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Ot("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(w,J),Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=J.prototype.getState.call(this);return T.typeName=w.typeName,T},w.typeName="FrameMarker",w.title="Frame marker",w.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',w}(xt),Ce=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Ge=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.x1=0,X.y1=0,X.x2=0,X.y2=0,X.defaultLength=50,X.manipulationStartX=0,X.manipulationStartY=0,X.manipulationStartX1=0,X.manipulationStartY1=0,X.manipulationStartX2=0,X.manipulationStartY2=0,X.setupControlBox(),X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!!J.prototype.ownsTarget.call(this,T)||!(!this.grip1.ownsTarget(T)&&!this.grip2.ownsTarget(T))},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.manipulationStartX=T.x,this.manipulationStartY=T.y,this.state==="new"&&(this.x1=T.x,this.y1=T.y,this.x2=T.x,this.y2=T.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(j)?this.activeGrip=this.grip1:this.grip2.ownsTarget(j)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},w.prototype.pointerUp=function(T){var j=this.state;J.prototype.pointerUp.call(this,T),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(T),this._state="select",j==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},w.prototype.adjustVisual=function(){},w.prototype.manipulate=function(T){this.state==="creating"?this.resize(T):this.state==="move"?(this.x1=this.manipulationStartX1+T.x-this.manipulationStartX,this.y1=this.manipulationStartY1+T.y-this.manipulationStartY,this.x2=this.manipulationStartX2+T.x-this.manipulationStartX,this.y2=this.manipulationStartY2+T.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(T)},w.prototype.resize=function(T){switch(this.activeGrip){case this.grip1:this.x1=T.x,this.y1=T.y;break;case this.grip2:case void 0:this.x2=T.x,this.y2=T.y}this.adjustVisual(),this.adjustControlBox()},w.prototype.select=function(){J.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},w.prototype.deselect=function(){J.prototype.deselect.call(this),this.controlBox.style.display="none"},w.prototype.setupControlBox=function(){this.controlBox=oe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},w.prototype.adjustControlBox=function(){this.positionGrips()},w.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},w.prototype.createGrip=function(){var T=new vt;return T.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(T.visual),T},w.prototype.positionGrips=function(){var T=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-T/2,this.y1-T/2),this.positionGrip(this.grip2.visual,this.x2-T/2,this.y2-T/2)},w.prototype.positionGrip=function(T,j,ee){var X=T.transform.baseVal.getItem(0);X.setTranslate(j,ee),T.transform.baseVal.replaceItem(X,0)},w.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},J.prototype.getState.call(this))},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T);var j=T;this.x1=j.x1,this.y1=j.y1,this.x2=j.x2,this.y2=j.y2},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.x1=this.x1*T,this.y1=this.y1*j,this.x2=this.x2*T,this.y2=this.y2*j,this.adjustVisual(),this.adjustControlBox()},w}(tt),ze=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new et("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new kt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Ot("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorLine&&T!==this.visibleLine)},w.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},w.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},w.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},w.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},w.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T);var j=T;this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.createVisual(),this.adjustVisual()},w.typeName="LineMarker",w.title="Line marker",w.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',w}(Ge),Re=function(J){function w(T,j,ee,X){var ye=J.call(this,T,X||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ye.fonts=[],ye.fontBoxes=[],ye.fonts=j,ye.currentFont=ee,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");return j.style.overflow="hidden",j.style.flexGrow="2",this.fonts.forEach(function(ee){var X=document.createElement("div");X.style.display="inline-block",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/T.fonts.length-5+"%",X.style.borderColor=ee===T.currentFont?T.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){T.setCurrentFont(ee,X)}),j.appendChild(X);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=ee,ye.style.overflow="hidden";var Ve=document.createElement("div");Ve.style.whiteSpace="nowrap",Ve.style.overflow="hidden",Ve.style.textOverflow="ellipsis",Ve.innerHTML="The quick brown fox jumps over the lazy dog",ye.appendChild(Ve),X.appendChild(ye),T.fontBoxes.push(X)}),j},w.prototype.setCurrentFont=function(T,j){var ee=this;this.currentFont=T,this.fontBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},w}(gt),je=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.color="transparent",X.padding=5,X.DEFAULT_TEXT="your text here",X.text=X.DEFAULT_TEXT,X.isMoved=!1,X.color=ee.defaultColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setColor=X.setColor.bind(X),X.setFont=X.setFont.bind(X),X.renderText=X.renderText.bind(X),X.sizeText=X.sizeText.bind(X),X.textEditDivClicked=X.textEditDivClicked.bind(X),X.showTextEditor=X.showTextEditor.bind(X),X.setSize=X.setSize.bind(X),X.positionTextEditor=X.positionTextEditor.bind(X),X.colorPanel=new et("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.fontFamilyPanel=new Re("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X}return Ee(w,J),w.prototype.ownsTarget=function(T){if(J.prototype.ownsTarget.call(this,T)||T===this.visual||T===this.textElement||T===this.bgRectangle)return!0;var j=!1;return this.textElement.childNodes.forEach(function(ee){ee===T&&(j=!0)}),j},w.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.isMoved=!1,this.pointerDownPoint=T,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},w.prototype.renderText=function(){var T=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(j){T.textElement.appendChild(oe.createTSpan(j.trim()===""?" ":j.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},w.prototype.getTextScale=function(){var T=this.textElement.getBBox(),j=1;if(T.width>0&&T.height>0){var ee=(1*this.width-this.width*this.padding*2/100)/T.width,X=(1*this.height-this.height*this.padding*2/100)/T.height;j=Math.min(ee,X)}return j},w.prototype.getTextPosition=function(T){var j=this.textElement.getBBox(),ee=0,X=0;return j.width>0&&j.height>0&&(ee=(this.width-j.width*T)/2,X=this.height/2-j.height*T/2),{x:ee,y:X}},w.prototype.sizeText=function(){var T=this.textElement.getBBox(),j=this.getTextScale(),ee=this.getTextPosition(j);ee.y-=T.y*j,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+ee.x+"px, "+ee.y+"px) scale("+j+", "+j+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(ee.x,ee.y),this.textElement.transform.baseVal.getItem(1).setScale(j,j))},w.prototype.manipulate=function(T){J.prototype.manipulate.call(this,T),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(T.x-this.pointerDownPoint.x)>5||Math.abs(T.y-this.pointerDownPoint.y)>5)},w.prototype.resize=function(T){J.prototype.resize.call(this,T),this.isMoved=!0,this.setSize(),this.sizeText()},w.prototype.setSize=function(){J.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},w.prototype.pointerUp=function(T){var j=this.state;j==="creating"&&(this._suppressMarkerCreateEvent=!0),J.prototype.pointerUp.call(this,T),this.setSize(),(j==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},w.prototype.showTextEditor=function(){var T=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(j){j.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var j=Number.parseFloat(T.textEditor.style.fontSize);T.textEditor.clientWidth>=Number.parseInt(T.textEditor.style.maxWidth)&&j>.9;)j-=.1,T.textEditor.style.fontSize=Math.max(j,.9)+"em"}),this.textEditor.addEventListener("keyup",function(j){j.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(j){if(j.clipboardData){var ee=j.clipboardData.getData("text"),X=window.getSelection();if(!X.rangeCount)return!1;X.deleteFromDocument(),X.getRangeAt(0).insertNode(document.createTextNode(ee)),j.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){T.textEditDivClicked(T.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},w.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var T=this.getTextScale(),j=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),ee=this.textElement.getBBox(),X={x:ee.width*T,y:ee.height*T};j.x-=X.x/2,j.y-=X.y/2,this.textEditor.style.top=j.y+"px",this.textEditor.style.left=j.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-j.x+"px",this.textEditor.style.fontSize=Math.max(16*T,12)+"px",this.textElement.style.display="none"}},w.prototype.textEditDivClicked=function(T){this.text=T.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},w.prototype.select=function(){J.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},w.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),J.prototype.deselect.call(this)},w.prototype.dblClick=function(T,j){J.prototype.dblClick.call(this,T,j),this.showTextEditor()},w.prototype.setColor=function(T){this.textElement&&oe.setAttributes(this.textElement,[["fill",T]]),this.color=T,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(T)},w.prototype.setFont=function(T){this.textElement&&oe.setAttributes(this.textElement,[["font-family",T]]),this.fontFamily=T,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},w.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},w.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){var j=T;this.color=j.color,this.fontFamily=j.fontFamily,this.padding=j.padding,this.text=j.text,this.createVisual(),J.prototype.restoreState.call(this,T),this.setSize()},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.setSize(),this.sizeText(),this.positionTextEditor()},w.typeName="TextMarker",w.title="Text marker",w.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',w}(Et),ge=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.color="transparent",X.lineWidth=3,X.drawing=!1,X.pixelRatio=1,X.color=ee.defaultColor,X.lineWidth=ee.defaultStrokeWidth,X.pixelRatio=ee.freehandPixelRatio,X.setColor=X.setColor.bind(X),X.addCanvas=X.addCanvas.bind(X),X.finishCreation=X.finishCreation.bind(X),X.setLineWidth=X.setLineWidth.bind(X),X.colorPanel=new et("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.lineWidthPanel=new kt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.lineWidthPanel.onWidthChanged=X.setLineWidth,X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.drawingImage)},w.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var T=oe.createTransform();this.visual.transform.baseVal.appendItem(T),this.addMarkerVisualToContainer(this.visual)},w.prototype.pointerDown=function(T,j){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(T.x,T.y),this.drawing=!0):J.prototype.pointerDown.call(this,T,j)},w.prototype.manipulate=function(T){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(T.x,T.y),this.canvasContext.stroke()):J.prototype.manipulate.call(this,T)},w.prototype.resize=function(T){J.prototype.resize.call(this,T),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},w.prototype.pointerUp=function(T){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):J.prototype.pointerUp.call(this,T)},w.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},w.prototype.select=function(){this.state==="creating"&&this.finishCreation(),J.prototype.select.call(this)},w.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),J.prototype.deselect.call(this)},w.prototype.finishCreation=function(){for(var T=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),j=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],ee=j[0],X=j[1],ye=j[2],Ve=j[3],ot=!1,ht=0;ht<this.canvasElement.height;ht++)for(var Ue=0;Ue<this.canvasElement.width;Ue++)T.data[ht*this.canvasElement.width*4+4*Ue+3]>0&&(ot=!0,ht<X&&(X=ht),Ue<ee&&(ee=Ue),ht>Ve&&(Ve=ht),Ue>ye&&(ye=Ue));if(ot){this.left=ee/this.pixelRatio,this.top=X/this.pixelRatio,this.width=(ye-ee)/this.pixelRatio,this.height=(Ve-X)/this.pixelRatio;var mt=document.createElement("canvas");mt.width=ye-ee,mt.height=Ve-X,mt.getContext("2d").putImageData(this.canvasContext.getImageData(ee,X,ye-ee,Ve-X),0,0),this.drawingImgUrl=mt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},w.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},w.prototype.setColor=function(T){this.color=T,this.colorChanged(T)},w.prototype.setLineWidth=function(T){this.lineWidth=T},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({drawingImgUrl:this.drawingImgUrl},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){this.createVisual(),J.prototype.restoreState.call(this,T),this.drawingImgUrl=T.drawingImgUrl,this.setDrawingImage()},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.setDrawingImage()},w.typeName="FreehandMarker",w.title="Freehand marker",w.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',w}(Et),de=function(J){function w(T,j,ee){var X=J.call(this,T,ee||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return X.typeBoxes=[],X.currentType=j,X.setCurrentType=X.setCurrentType.bind(X),X}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2";for(var ee=function(Ve){var ot="both";switch(Ve){case 0:ot="both";break;case 1:ot="start";break;case 2:ot="end";break;case 3:ot="none"}var ht=document.createElement("div");if(ht.style.display="flex",ht.style.flexGrow="2",ht.style.alignItems="center",ht.style.justifyContent="space-between",ht.style.padding="5px",ht.style.borderWidth="2px",ht.style.borderStyle="solid",ht.style.borderColor=ot===X.currentType?X.uiStyleSettings.toolboxAccentColor:"transparent",ht.addEventListener("click",function(){T.setCurrentType(ot,ht)}),j.appendChild(ht),ot==="both"||ot==="start"){var Ue=document.createElement("div");Ue.style.display="flex",Ue.style.alignItems="center",Ue.style.minHeight="20px",Ue.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ue.style.marginLeft="5px",ht.appendChild(Ue)}var mt=document.createElement("div");mt.style.display="flex",mt.style.alignItems="center",mt.style.minHeight="20px",mt.style.flexGrow="2";var Rt=document.createElement("hr");if(Rt.style.minWidth="20px",Rt.style.border="0px",Rt.style.borderTop="3px solid "+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee"),Rt.style.flexGrow="2",mt.appendChild(Rt),ht.appendChild(mt),ot==="both"||ot==="end"){var Mt=document.createElement("div");Mt.style.display="flex",Mt.style.alignItems="center",Mt.style.minHeight="20px",Mt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Mt.style.marginRight="5px",ht.appendChild(Mt)}X.typeBoxes.push(ht)},X=this,ye=0;ye<4;ye++)ee(ye);return j},w.prototype.setCurrentType=function(T,j){var ee=this;this.currentType=T,this.typeBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings!==void 0?ee.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},w}(gt),ce=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.arrowType="end",X.arrowBaseHeight=10,X.arrowBaseWidth=10,X.getArrowPoints=X.getArrowPoints.bind(X),X.setArrowType=X.setArrowType.bind(X),X.arrowTypePanel=new de("Arrow type","end"),X.arrowTypePanel.onArrowTypeChanged=X.setArrowType,X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.arrow1&&T!==this.arrow2)},w.prototype.getArrowPoints=function(T,j){var ee=this.arrowBaseWidth+2*this.strokeWidth,X=this.arrowBaseHeight+2*this.strokeWidth;return T-ee/2+","+(j+X/2)+" "+T+","+(j-X/2)+" "+(T+ee/2)+","+(j+X/2)},w.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="creating"&&this.createTips()},w.prototype.adjustVisual=function(){if(J.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),j=this.arrow1.transform.baseVal.getItem(0);j.setRotate(T,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(j,0);var ee=this.arrow2.transform.baseVal.getItem(0);ee.setRotate(T+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(ee,0)}},w.prototype.setArrowType=function(T){this.arrowType=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({arrowType:this.arrowType},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T);var j=T;this.arrowType=j.arrowType,this.createTips(),this.adjustVisual()},w.typeName="ArrowMarker",w.title="Arrow marker",w.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',w}(ze),re=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.fillColor=ee.defaultFillColor,X.strokeWidth=0,X.fillPanel=new et("Color",ee.defaultColorSet,ee.defaultFillColor),X.fillPanel.onColorChanged=X.setFillColor,X}return Ee(w,J),Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=J.prototype.getState.call(this);return T.typeName=w.typeName,T},w.typeName="CoverMarker",w.title="Cover marker",w.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',w}(xt),ae=function(J){function w(T,j,ee,X){var ye=J.call(this,T,X||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ye.opacities=[],ye.opacityBoxes=[],ye.opacities=j,ye.currentOpacity=ee,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return Ee(w,J),w.prototype.getUi=function(){var T=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",j.style.justifyContent="space-between",this.opacities.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="center",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===T.currentOpacity?T.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){T.setCurrentOpacity(ee,X)}),j.appendChild(X);var ye=document.createElement("div");ye.innerText=100*ee+"%",X.appendChild(ye),T.opacityBoxes.push(X)}),j},w.prototype.setCurrentOpacity=function(T,j){var ee=this;this.currentOpacity=T,this.opacityBoxes.forEach(function(X){X.style.borderColor=X===j?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},w}(gt),ue=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.setOpacity=X.setOpacity.bind(X),X.fillColor=ee.defaultHighlightColor,X.strokeWidth=0,X.opacity=ee.defaultHighlightOpacity,X.fillPanel=new et("Color",ee.defaultColorSet,X.fillColor),X.fillPanel.onColorChanged=X.setFillColor,X.opacityPanel=new ae("Opacity",ee.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return Ee(w,J),w.prototype.setOpacity=function(T){this.opacity=T,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=J.prototype.getState.call(this);return T.typeName=w.typeName,T},w.typeName="HighlightMarker",w.title="Highlight marker",w.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',w}(re),fe='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',be=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.bgColor="transparent",X.tipPosition={x:0,y:0},X.tipBase1Position={x:0,y:0},X.tipBase2Position={x:0,y:0},X.tipMoving=!1,X.color=ee.defaultStrokeColor,X.bgColor=ee.defaultFillColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setBgColor=X.setBgColor.bind(X),X.getTipPoints=X.getTipPoints.bind(X),X.positionTip=X.positionTip.bind(X),X.setTipPoints=X.setTipPoints.bind(X),X.colorPanel=new et("Text color",ee.defaultColorSet,X.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),X.colorPanel.onColorChanged=X.setColor,X.bgColorPanel=new et("Fill color",ee.defaultColorSet,X.bgColor,fe),X.bgColorPanel.onColorChanged=X.setBgColor,X.fontFamilyPanel=new Re("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X.tipGrip=new vt,X.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),X.controlBox.appendChild(X.tipGrip.visual),X}return Ee(w,J),w.prototype.ownsTarget=function(T){return J.prototype.ownsTarget.call(this,T)||this.tipGrip.ownsTarget(T)||this.tip===T},w.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},w.prototype.pointerDown=function(T,j){this.state==="new"&&J.prototype.pointerDown.call(this,T,j),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(j)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):J.prototype.pointerDown.call(this,T,j)},w.prototype.pointerUp=function(T){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,J.prototype.pointerUp.call(this,T);else{var j=this.state==="creating";J.prototype.pointerUp.call(this,T),this.setTipPoints(j),this.positionTip()}},w.prototype.manipulate=function(T){if(this.tipMoving){var j=this.unrotatePoint(T);this.tipPosition={x:j.x-this.manipulationStartLeft,y:j.y-this.manipulationStartTop},this.positionTip()}else J.prototype.manipulate.call(this,T)},w.prototype.setBgColor=function(T){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",T]]),oe.setAttributes(this.tip,[["fill",T]])),this.bgColor=T,this.fillColorChanged(T)},w.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},w.prototype.setTipPoints=function(T){T===void 0&&(T=!1);var j=Math.min(this.height/2,15),ee=this.height/5;T&&(this.tipPosition={x:j+ee/2,y:this.height+20});var X=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(ee=this.width/5,j=Math.min(this.width/2,15),this.tipBase1Position={x:j,y:0},this.tipBase2Position={x:j+ee,y:0}):(this.tipBase1Position={x:0,y:j},this.tipBase2Position={x:0,y:j+ee}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(ee=this.width/5,j=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-j-ee,y:0},this.tipBase2Position={x:this.width-j,y:0}):(this.tipBase1Position={x:this.width,y:j},this.tipBase2Position={x:this.width,y:j+ee}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?X<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(ee=this.width/5,j=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-j-ee,y:this.height},this.tipBase2Position={x:this.width-j,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-j-ee},this.tipBase2Position={x:this.width,y:this.height-j}):X<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(ee=this.width/5,j=Math.min(this.width/2,15),this.tipBase1Position={x:j,y:this.height},this.tipBase2Position={x:j+ee,y:this.height}):(this.tipBase1Position={x:0,y:this.height-j},this.tipBase2Position={x:0,y:this.height-j-ee})},w.prototype.resize=function(T){J.prototype.resize.call(this,T),this.positionTip()},w.prototype.positionTip=function(){oe.setAttributes(this.tip,[["points",this.getTipPoints()]]);var T=this.tipGrip.visual.transform.baseVal.getItem(0);T.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(T,0)},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),w.prototype.select=function(){this.positionTip(),J.prototype.select.call(this)},w.prototype.getState=function(){var T=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){var j=T;this.bgColor=j.bgColor,this.tipPosition=j.tipPosition,J.prototype.restoreState.call(this,T),this.createTip(),this.setTipPoints()},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.tipPosition={x:this.tipPosition.x*T,y:this.tipPosition.y*j},this.positionTip()},w.typeName="CalloutMarker",w.title="Callout marker",w.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',w}(je),Ie=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.fillColor=ee.defaultFillColor,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.setOpacity=X.setOpacity.bind(X),X.createVisual=X.createVisual.bind(X),X.strokePanel=new et("Line color",he(ee.defaultColorSet,["transparent"]),ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.fillPanel=new et("Fill color",he(ee.defaultColorSet,["transparent"]),X.fillColor,fe),X.fillPanel.onColorChanged=X.setFillColor,X.strokeWidthPanel=new kt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Ot("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X.opacityPanel=new ae("Opacity",ee.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.visual)},w.prototype.createVisual=function(){this.visual=oe.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},w.prototype.manipulate=function(T){J.prototype.manipulate.call(this,T)},w.prototype.resize=function(T){J.prototype.resize.call(this,T),this.setSize()},w.prototype.setSize=function(){J.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},w.prototype.pointerUp=function(T){J.prototype.pointerUp.call(this,T),this.setSize()},w.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},w.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(T),this.stateChanged()},w.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},w.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},w.prototype.setOpacity=function(T){this.opacity=T,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){var j=T;this.fillColor=j.fillColor,this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.opacity=j.opacity,this.createVisual(),J.prototype.restoreState.call(this,T),this.setSize()},w.prototype.scale=function(T,j){J.prototype.scale.call(this,T,j),this.setSize()},w.typeName="EllipseMarker",w.title="Ellipse marker",w.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',w}(Et),Xe=function(J){function w(T,j,ee){return J.call(this,T,j,ee)||this}return Ee(w,J),Object.defineProperty(w.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.tip1&&T!==this.tip2)},w.prototype.createTips=function(){this.tip1=oe.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.tip2)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.state==="creating"&&this.createTips()},w.prototype.adjustVisual=function(){if(J.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),j=this.tip1.transform.baseVal.getItem(0);j.setRotate(T,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(j,0);var ee=this.tip2.transform.baseVal.getItem(0);ee.setRotate(T+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(ee,0)}},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=J.prototype.getState.call(this);return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T),this.createTips(),this.adjustVisual()},w.typeName="MeasurementMarker",w.title="Measurement marker",w.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',w}(ze),ut=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.strokePanel.colors=ee.defaultColorSet,X.fillColor="transparent",X}return Ee(w,J),Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=J.prototype.getState.call(this);return T.typeName=w.typeName,T},w.typeName="EllipseFrameMarker",w.title="Ellipse frame marker",w.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',w}(Ie),bt=function(){function J(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(J.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),J.prototype.addUndoStep=function(w){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(w)||(this.undoStack.push(w),JSON.stringify(this.lastRedoStep)!==JSON.stringify(w)&&this.redoStack.splice(0,this.redoStack.length))},J.prototype.replaceLastUndoStep=function(w){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=w)},J.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},J.prototype.undo=function(){if(this.undoStack.length>1){var w=this.undoStack.pop();return w!==void 0&&this.redoStack.push(w),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},J.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},J}(),ft=function(J){function w(T,j,ee){var X=J.call(this,T,j,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.curveX=0,X.curveY=0,X.manipulationStartCurveX=0,X.manipulationStartCurveY=0,X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.positionGrips=X.positionGrips.bind(X),X.addControlGrips=X.addControlGrips.bind(X),X.adjustVisual=X.adjustVisual.bind(X),X.setupControlBox=X.setupControlBox.bind(X),X.resize=X.resize.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new et("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new kt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Ot("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(w,J),w.prototype.ownsTarget=function(T){return!(!J.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorCurve&&T!==this.visibleCurve&&!this.curveGrip.ownsTarget(T))},w.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},w.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},w.prototype.pointerDown=function(T,j){J.prototype.pointerDown.call(this,T,j),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=T.x,this.curveY=T.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(j)&&(this.activeGrip=this.curveGrip,this._state="resize")},w.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},w.prototype.setupControlBox=function(){J.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},w.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,J.prototype.addControlGrips.call(this)},w.prototype.positionGrips=function(){J.prototype.positionGrips.call(this);var T=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-T/2,this.curveY-T/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},w.prototype.manipulate=function(T){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+T.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+T.y-this.manipulationStartY),J.prototype.manipulate.call(this,T)},w.prototype.resize=function(T){this.activeGrip===this.curveGrip&&(this.curveX=T.x,this.curveY=T.y),J.prototype.resize.call(this,T),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},w.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},w.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},w.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual()},w.prototype.scale=function(T,j){this.curveX=this.curveX*T,this.curveY=this.curveY*j,J.prototype.scale.call(this,T,j)},Object.defineProperty(w.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),w.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},J.prototype.getState.call(this));return T.typeName=w.typeName,T},w.prototype.restoreState=function(T){J.prototype.restoreState.call(this,T);var j=T;this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.curveX=j.curveX,this.curveY=j.curveY,this.createVisual(),this.adjustVisual()},w.typeName="CurveMarker",w.title="Curve marker",w.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',w}(Ge),at=function(){function J(w,T){T===void 0&&(T=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=w,this.cancelable=T}return Object.defineProperty(J.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),J.prototype.preventDefault=function(){this._defaultPrevented=!0},J}(),Be=function(J){function w(T,j,ee){var X=J.call(this,T,!1)||this;return X.dataUrl=j,X.state=ee,X}return Ee(w,J),w}(at),We=function(J){function w(T,j,ee){ee===void 0&&(ee=!1);var X=J.call(this,T,ee)||this;return X.marker=j,X}return Ee(w,J),w}(at),Me=function(){function J(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return J.prototype.addEventListener=function(w,T){this[w].push(T)},J.prototype.removeEventListener=function(w,T){var j=this[w].indexOf(T);j>-1&&this[w].splice(j,1)},J}(),se=function(){function J(w){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ce,this._isOpen=!1,this.undoRedoManager=new bt,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Me,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=J.instanceCounter++,this.styles=new qe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=w,this.targetRoot=document.body,this.width=w.clientWidth,this.height=w.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(J.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ae,ge,ce,je,ut,Ie,ue,be,Xe,re,ze,ft]},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ae,ge,ce,je,Ie,ue,be]},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ae,ge,ce,je,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(w){var T=this;this._availableMarkerTypes.splice(0),w.forEach(function(j){if(typeof j=="string"){var ee=T.ALL_MARKER_TYPES.find(function(X){return X.typeName===j});ee!==void 0&&T._availableMarkerTypes.push(ee)}else T._availableMarkerTypes.push(j)})},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(w){this._zoomLevel=w,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),J.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Le.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},J.prototype.show=function(){var w=this;this.styles.styleSheetRoot===void 0&&nt.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=nt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(T){return T(new at(w))})},J.prototype.render=function(){return Oe(this,void 0,void 0,function(){var w;return we(this,function(T){switch(T.label){case 0:return this.setCurrentMarker(),(w=new Ye).naturalSize=this.renderAtNaturalSize,w.imageType=this.renderImageType,w.imageQuality=this.renderImageQuality,w.markersOnly=this.renderMarkersOnly,w.width=this.renderWidth,w.height=this.renderHeight,[4,w.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return T.sent(),[4,w.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,T.sent()]}})})},J.prototype.close=function(w){var T=this;if(w===void 0&&(w=!1),this.isOpen){var j=!1;w||this.eventListeners.beforeclose.forEach(function(ee){var X=new at(T,!0);ee(X),X.defaultPrevented&&(j=!0)}),j||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(ee){return ee(new at(T))}),this.detachEvents(),this._isOpen=!1)}},J.prototype.addMarkersToToolbar=function(){for(var w,T=[],j=0;j<arguments.length;j++)T[j]=arguments[j];(w=this._availableMarkerTypes).push.apply(w,T)},J.prototype.addRenderEventListener=function(w){this.addEventListener("render",function(T){w(T.dataUrl,T.state)})},J.prototype.removeRenderEventListener=function(w){},J.prototype.addCloseEventListener=function(w){this.addEventListener("close",function(){w()})},J.prototype.removeCloseEventListener=function(w){},J.prototype.setupResizeObserver=function(){var w=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){w.resize(w.target.clientWidth,w.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return w.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},J.prototype.onPopupTargetResize=function(){var w=1*this.target.clientWidth/this.target.clientHeight,T=this.editorCanvas.clientWidth/w>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*w:this.editorCanvas.clientWidth,j=T<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/w;this.resize(T,j)},J.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},J.prototype.resize=function(w,T){this._isResizing=!0;var j=w/this.imageWidth,ee=T/this.imageHeight;this.imageWidth=Math.round(w),this.imageHeight=Math.round(T),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(j,ee),this._isResizing=!1},J.prototype.scaleMarkers=function(w,T){var j,ee=this;this._currentMarker&&this._currentMarker instanceof je?this._currentMarker.scale(w,T):(j=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(X){X!==ee._currentMarker&&X.scale(w,T)}),j!==void 0&&this.setCurrentMarker(j)},J.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},J.prototype.setTopLeft=function(){var w=this.editingTarget.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=w.left-T.left,this.top=w.top-T.top},J.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},J.prototype.addDefs=function(){for(var w,T=[],j=0;j<arguments.length;j++)T[j]=arguments[j];this.defs=oe.createDefs(),this.addDefsToImage(),(w=this.defs).append.apply(w,T)},J.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},J.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},J.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},J.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},J.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},J.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},J.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},J.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var w=document.createElement("a");w.href="https://markerjs.com/",w.target="_blank",w.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',w.title="Powered by marker.js",w.style.display="grid",w.style.alignItems="center",w.style.justifyItems="center",w.style.padding="3px",w.style.width="20px",w.style.height="20px",this.logoUI.appendChild(w),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},J.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},J.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},J.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},J.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var w=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=w+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new $e(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Qe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},J.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},J.prototype.removeMarker=function(w){this.markerImage.removeChild(w.container),this.markers.indexOf(w)>-1&&this.markers.splice(this.markers.indexOf(w),1),w.dispose()},J.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},J.prototype.toolbarButtonClicked=function(w,T){if(w==="marker"&&T!==void 0)this.createNewMarker(T);else if(w==="action")switch(T){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},J.prototype.deleteSelectedMarker=function(){var w=this;if(this._currentMarker!==void 0){var T=!1;if(this.eventListeners.markerbeforedelete.forEach(function(ee){var X=new We(w,w._currentMarker,!0);ee(X),X.defaultPrevented&&(T=!0)}),!T){var j=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(ee){return ee(new We(w,j))})}}},J.prototype.clear=function(){var w=this,T=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var Ve=new We(w,void 0,!0);ye(Ve),Ve.defaultPrevented&&(T=!0)}),!T)){this.setCurrentMarker();for(var j=function(ye){var Ve=ee.markers[ye];ee.setCurrentMarker(ee.markers[ye]),ee._currentMarker.dispose(),ee.markerImage.removeChild(ee._currentMarker.container),ee.markers.splice(ee.markers.indexOf(ee._currentMarker),1),ee.eventListeners.markerdelete.forEach(function(ot){return ot(new We(w,Ve))})},ee=this,X=this.markers.length-1;X>=0;X--)j(X);this.addUndoStep()}},Object.defineProperty(J.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),J.prototype.showNotesEditor=function(){var w;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(w=this._currentMarker.notes)!==null&&w!==void 0?w:"",this.overlayContainer.appendChild(this.notesArea))},J.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},J.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},J.prototype.addUndoStep=function(){var w=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var T=this.getState(),j=this.undoRedoManager.getLastUndoStep();if(!j||j.width===T.width&&j.height===T.height){var ee=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(T),ee<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(X){return X(new at(w))})}else this.undoRedoManager.replaceLastUndoStep(T),this.eventListeners.statechange.forEach(function(X){return X(new at(w))})}},J.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},J.prototype.undoStep=function(){var w=this,T=this.undoRedoManager.undo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(j){return j(new at(w))}))},J.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},J.prototype.redoStep=function(){var w=this,T=this.undoRedoManager.redo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(j){return j(new at(w))}))},J.prototype.stepZoom=function(){var w=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=w<this.zoomSteps.length-1?this.zoomSteps[w+1]:this.zoomSteps[0]},J.prototype.panTo=function(w){this.contentDiv.scrollBy({left:this.prevPanPoint.x-w.x,top:this.prevPanPoint.y-w.y}),this.prevPanPoint=w},J.prototype.startRenderAndClose=function(){return Oe(this,void 0,void 0,function(){var w,T,j=this;return we(this,function(ee){switch(ee.label){case 0:return[4,this.render()];case 1:return w=ee.sent(),T=this.getState(),this.eventListeners.render.forEach(function(X){return X(new Be(j,w,T))}),this.close(!0),[2]}})})},J.prototype.getState=function(w){w===!0&&this.setCurrentMarker();var T={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(j){return T.markers.push(j.getState())}),T},J.prototype.restoreState=function(w){var T=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);w.markers.forEach(function(j){var ee=T._availableMarkerTypes.find(function(ye){return ye.typeName===j.typeName});if(ee!==void 0){var X=T.addNewMarker(ee);X.restoreState(j),T.markers.push(X)}}),w.width&&w.height&&(w.width!==this.imageWidth||w.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/w.width,this.imageHeight/w.height),this.eventListeners.restorestate.forEach(function(j){return j(new at(T))})},J.prototype.addNewMarker=function(w){var T=oe.createGroup();return this.markerImage.appendChild(T),new w(T,this.overlayContainer,this.settings)},J.prototype.createNewMarker=function(w){var T,j=this;(T=typeof w=="string"?this._availableMarkerTypes.find(function(ee){return ee.typeName===w}):w)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(T),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(T.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(ee){return ee(new We(j,j._currentMarker))}))},J.prototype.markerCreated=function(w){var T=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(w),this.setCurrentMarker(w),w instanceof ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(j){return j(new We(T,T._currentMarker))})},J.prototype.colorChanged=function(w){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=w,this.settings.defaultStrokeColor=w)},J.prototype.fillColorChanged=function(w){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=w)},J.prototype.markerStateChanged=function(w){var T=this;this.eventListeners.markerchange.forEach(function(j){return j(new We(T,w))})},J.prototype.setCurrentMarker=function(w){var T=this;this._currentMarker!==w&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(j){return j(new We(T,T._currentMarker))})),this._currentMarker=w,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(j){return j(new We(T,T._currentMarker))}))},J.prototype.onPointerDown=function(w){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||w.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var T=this.markers.find(function(j){return j.ownsTarget(w.target)});T!==void 0?(this.setCurrentMarker(T),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(w.clientX,w.clientY),w.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:w.clientX,y:w.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(w.clientX,w.clientY))},J.prototype.onDblClick=function(w){if(this._isFocused||this.focus(),this.mode==="select"){var T=this.markers.find(function(j){return j.ownsTarget(w.target)});T!==void 0&&T!==this._currentMarker&&this.setCurrentMarker(T),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(w.clientX,w.clientY),w.target):this.setCurrentMarker()}},J.prototype.onPointerMove=function(w){this.touchPoints!==1&&w.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||w.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(w.clientX,w.clientY)):this.zoomLevel>1&&this.panTo({x:w.clientX,y:w.clientY}))},J.prototype.onPointerUp=function(w){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(w.clientX,w.clientY)),this.isDragging=!1,this.addUndoStep()},J.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},J.prototype.onKeyUp=function(w){this._currentMarker===void 0||this.notesArea!==void 0||w.key!=="Delete"&&w.key!=="Backspace"||this.deleteSelectedMarker()},J.prototype.clientToLocalCoordinates=function(w,T){var j=this.markerImage.getBoundingClientRect();return{x:(w-j.left)/this.zoomLevel,y:(T-j.top)/this.zoomLevel}},J.prototype.onWindowResize=function(){this.positionUI()},J.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var w=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=w+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},J.prototype.addLicenseKey=function(w){Le.addKey(w)},J.prototype.addEventListener=function(w,T){this.eventListeners.addEventListener(w,T)},J.prototype.removeEventListener=function(w,T){this.eventListeners.removeEventListener(w,T)},J.prototype.renderState=function(w){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(w),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(J.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),J.prototype.focus=function(){var w=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(T){return T(new at(w))}))},J.prototype.blur=function(){var w=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(T){return T(new at(w))}))},J.instanceCounter=0,J}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var ve=function(J,w){return(ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,j){T.__proto__=j}||function(T,j){for(var ee in j)Object.prototype.hasOwnProperty.call(j,ee)&&(T[ee]=j[ee])})(J,w)};function Ke(J,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function T(){this.constructor=J}ve(J,w),J.prototype=w===null?Object.create(w):(T.prototype=w.prototype,new T)}function Pe(J,w,T,j){return new(T||(T=Promise))(function(ee,X){function ye(ht){try{ot(j.next(ht))}catch(Ue){X(Ue)}}function Ve(ht){try{ot(j.throw(ht))}catch(Ue){X(Ue)}}function ot(ht){var Ue;ht.done?ee(ht.value):(Ue=ht.value,Ue instanceof T?Ue:new T(function(mt){mt(Ue)})).then(ye,Ve)}ot((j=j.apply(J,w||[])).next())})}function st(J,w){var T,j,ee,X,ye={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Ve(ot){return function(ht){return function(Ue){if(T)throw new TypeError("Generator is already executing.");for(;ye;)try{if(T=1,j&&(ee=2&Ue[0]?j.return:Ue[0]?j.throw||((ee=j.return)&&ee.call(j),0):j.next)&&!(ee=ee.call(j,Ue[1])).done)return ee;switch(j=0,ee&&(Ue=[2&Ue[0],ee.value]),Ue[0]){case 0:case 1:ee=Ue;break;case 4:return ye.label++,{value:Ue[1],done:!1};case 5:ye.label++,j=Ue[1],Ue=[0];continue;case 7:Ue=ye.ops.pop(),ye.trys.pop();continue;default:if(!(ee=ye.trys,(ee=ee.length>0&&ee[ee.length-1])||Ue[0]!==6&&Ue[0]!==2)){ye=0;continue}if(Ue[0]===3&&(!ee||Ue[1]>ee[0]&&Ue[1]<ee[3])){ye.label=Ue[1];break}if(Ue[0]===6&&ye.label<ee[1]){ye.label=ee[1],ee=Ue;break}if(ee&&ye.label<ee[2]){ye.label=ee[2],ye.ops.push(Ue);break}ee[2]&&ye.ops.pop(),ye.trys.pop();continue}Ue=w.call(J,ye)}catch(mt){Ue=[6,mt],j=0}finally{T=ee=0}if(5&Ue[0])throw Ue[1];return{value:Ue[0]?Ue[1]:void 0,done:!0}}([ot,ht])}}}var dt=function(){function J(){}return J.addKey=function(w){J.key=w},Object.defineProperty(J,"isLicensed",{get:function(){return!!J.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(J.key)},enumerable:!1,configurable:!0}),J}(),Te=function(){function J(){}return J.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},J.setAttributes=function(w,T){for(var j=0,ee=T;j<ee.length;j++){var X=ee[j],ye=X[0],Ve=X[1];w.setAttribute(ye,Ve)}},J.createRect=function(w,T,j){var ee=document.createElementNS("http://www.w3.org/2000/svg","rect");return ee.setAttribute("width",w.toString()),ee.setAttribute("height",T.toString()),j&&J.setAttributes(ee,j),ee},J.createLine=function(w,T,j,ee,X){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",w.toString()),ye.setAttribute("y1",T.toString()),ye.setAttribute("x2",j.toString()),ye.setAttribute("y2",ee.toString()),X&&J.setAttributes(ye,X),ye},J.createPolygon=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","polygon");return j.setAttribute("points",w),T&&J.setAttributes(j,T),j},J.createCircle=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","circle");return j.setAttribute("cx",(w/2).toString()),j.setAttribute("cy",(w/2).toString()),j.setAttribute("r",w.toString()),T&&J.setAttributes(j,T),j},J.createEllipse=function(w,T,j){var ee=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ee.setAttribute("cx",(w/2).toString()),ee.setAttribute("cy",(T/2).toString()),ee.setAttribute("rx",(w/2).toString()),ee.setAttribute("ry",(T/2).toString()),j&&J.setAttributes(ee,j),ee},J.createGroup=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return w&&J.setAttributes(T,w),T},J.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},J.createMarker=function(w,T,j,ee,X,ye,Ve){var ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return J.setAttributes(ot,[["id",w],["orient",T],["markerWidth",j.toString()],["markerHeight",ee.toString()],["refX",X.toString()],["refY",ye.toString()]]),ot.appendChild(Ve),ot},J.createText=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),w&&J.setAttributes(T,w),T},J.createTSpan=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","tspan");return j.textContent=w,T&&J.setAttributes(j,T),j},J.createImage=function(w){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return w&&J.setAttributes(T,w),T},J.createPoint=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return j.x=w,j.y=T,j},J.createPath=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg","path");return j.setAttribute("d",w),T&&J.setAttributes(j,T),j},J.createElement=function(w,T){var j=document.createElementNS("http://www.w3.org/2000/svg",w);return T&&J.setAttributes(j,T),j},J.getHollowRectanglePath=function(w,T,j,ee,X,ye,Ve,ot){return"M"+w+","+T+"V"+(T+ee)+"H"+(w+j)+"V"+T+"H"+X+"V"+ye+"H"+(X+Ve)+"V"+(ye+ot)+"H"+X+"V"+T+"Z"},J}(),ke=function(){function J(w){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+w+"_"}return Object.defineProperty(J.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),J.prototype.addClass=function(w){return this.styleSheet===void 0&&this.addStyleSheet(),w.name=""+this.classNamePrefix+w.localName,this.classes.push(w),this.styleSheet.sheet.insertRule("."+w.name+" {"+w.style+"}",this.styleSheet.sheet.cssRules.length),w},J.prototype.addRule=function(w){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(w),this.styleSheet.sheet.insertRule(w.selector+" {"+w.style+"}",this.styleSheet.sheet.cssRules.length)},J.prototype.addStyleSheet=function(){var w;this.styleSheet=document.createElement("style"),((w=this.styleSheetRoot)!==null&&w!==void 0?w:document.head).appendChild(this.styleSheet),this.addRule(new rt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new rt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new rt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ct("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ct("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},J.prototype.removeStyleSheet=function(){var w;this.styleSheet&&(((w=this.styleSheetRoot)!==null&&w!==void 0?w:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},J}(),rt=function(J,w){this.selector=J,this.style=w},Ct=function(J,w){this.localName=J,this.style=w},At=function(){function J(){this.blocks=[],this.display=""}return J.prototype.addButtonBlock=function(w){w.className=this.blockClassName,w.buttonClassName=this.buttonClassName,w.buttonColorsClassName=this.buttonColorsClassName,w.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(w)},J.prototype.addElementBlock=function(w){w.className===void 0&&(w.className=this.blockClassName),this.blocks.push(w)},J.prototype.getUI=function(){var w=document.createElement("div");return w.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,w.style.display=this.display,this.blocks.forEach(function(T){return w.appendChild(T.getUI())}),w},J}(),cn=function(){function J(){}return J.prototype.getUI=function(){var w=document.createElement("div");if(w.className=this.className,this.minWidth!==void 0&&(w.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":w.style.justifyContent="flex-start";break;case"center":w.style.justifyContent="center";break;case"end":w.style.justifyContent="flex-end"}return w.style.whiteSpace="nowrap",w},J}(),yn=function(J){function w(){var T=J!==null&&J.apply(this,arguments)||this;return T.buttons=[],T}return Ke(w,J),w.prototype.addButton=function(T){T.className=this.buttonClassName,T.colorsClassName=this.buttonColorsClassName,T.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(T)},w.prototype.getUI=function(){var T=J.prototype.getUI.call(this);return this.buttons.forEach(function(j){return T.appendChild(j.getUI())}),T},w}(cn),en=function(){function J(w,T){this._isActive=!1,this._isHidden=!1,this._icon=w,this.title=T,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(J.prototype,"icon",{get:function(){return this._icon},set:function(w){this._icon=w,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isActive",{get:function(){return this._isActive},set:function(w){this._isActive=w,this.adjustClassName()},enumerable:!1,configurable:!0}),J.prototype.getUI=function(){var w=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return w.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},J.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},J.prototype.hide=function(){this._isHidden=!0},J}(),Dt=function(J){function w(){var T=J!==null&&J.apply(this,arguments)||this;return T.elements=[],T}return Ke(w,J),w.prototype.addElement=function(T){this.elements.push(T)},w.prototype.getUI=function(){var T=J.prototype.getUI.call(this);return this.elements.forEach(function(j){return T.appendChild(j)}),T},w}(cn),Rn=function(){function J(w,T){this.horizontal=w,this.vertical=T}return Object.defineProperty(J.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),J.prototype.getVerticalLength=function(w){return w/this.ratio},J.prototype.getHorizontalLength=function(w){return w*this.ratio},J}(),Fn=function(){function J(){}return J.getIcon=function(w,T){if(w>0&&T>0){var j=new Rn(w,T),ee=j.ratio>=1?20:j.getHorizontalLength(20),X=j.ratio<1?20:j.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var Ve=Te.createDefs();ye.appendChild(Ve);var ot=Te.createElement("clipPath",[["id","text-bg-clip"]]);Ve.appendChild(ot);var ht=Te.createPath(Te.getHollowRectanglePath((24-ee)/2,(24-X)/2,ee,X,(24-ee)/2+2,(24-X)/2+2,ee-4,X-4));ye.appendChild(ht);var Ue=Te.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ue.appendChild(Te.createTSpan(w+":"+T)),ye.appendChild(Ue);var mt=Ue.getBBox();Te.setAttributes(Ue,[["x",((24-mt.width)/2).toString()],["y",((24-mt.height)/2-mt.y).toString()]]);var Rt=Te.createPath(Te.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(mt.width))/2,(24-Math.ceil(mt.height))/2,Math.ceil(mt.width),Math.ceil(mt.height)));return ot.appendChild(Rt),Te.setAttributes(ht,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},J}(),Cn=function(J){function w(T,j,ee){var X=J.call(this,T,j)||this;return X.isDropdownOpen=!1,X.onClick=X.dropdownButtonClicked,X.dropdownButtons=ee,X}return Ke(w,J),w.prototype.setupDropdown=function(){var T=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(j){j.className=T.className,j.colorsClassName=T.colorsClassName,T.dropdownBlock.appendChild(j.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},w.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},w.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},w.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},w.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},w.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},w}(en),Qt=function(){function J(w,T){this.GRIP_SIZE=10,this.color=w,this.fillColor=T,this.visual=Te.createGroup(),this.visual.appendChild(Te.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Te.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return J.prototype.ownsTarget=function(w){return w===this.visual||w===this.visual.childNodes[0]||w===this.visual.childNodes[1]},J.prototype.setCenter=function(w,T){this.visual.childNodes.forEach(function(j){return Te.setAttributes(j,[["cx",w.toString()],["cy",T.toString()]])})},J}(),Sn=function(){function J(w,T,j,ee){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=w,this.canvasHeight=T,this.margin=j,this.container=ee,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(J.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(w){this._aspectRatio=w,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(w){this._isGridVisible=w,this.gridContainer&&Te.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(w){this._zoomFactor=w,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),J.prototype.open=function(){var w=this;this.cropShadeElement=Te.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Te.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var T=0;T<this.numberOfGridLines;T++)this.horizontalGridLines.push(Te.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Te.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(j){return w.gridContainer.appendChild(j)}),this.verticalGridLines.forEach(function(j){return w.gridContainer.appendChild(j)}),this.cropRectElement=Te.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},J.prototype.setCropRectangle=function(w){this.cropRect=w;var T=Object.assign({},this.cropRect);this.zoomFactor!==1&&(T.width=this.cropRect.width*this.zoomFactor,T.height=this.cropRect.height*this.zoomFactor,T.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-T.width/2,T.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-T.height/2),Te.setAttributes(this.cropRectElement,[["x",T.x.toString()],["y",T.y.toString()],["width",T.width.toString()],["height",T.height.toString()]]);var j=T.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(X,ye){var Ve=T.y+j*(ye+1);Te.setAttributes(X,[["x1",""+T.x],["y1",""+Ve],["x2",""+(T.x+T.width)],["y2",""+Ve]])});var ee=T.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(X,ye){var Ve=T.x+ee*(ye+1);Te.setAttributes(X,[["x1",""+Ve],["y1",""+T.y],["x2",""+Ve],["y2",""+(T.y+T.height)]])}),Te.setAttributes(this.cropShadeElement,[["d",Te.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,T.x,T.y,T.width,T.height)]]),this.topLeftGrip.setCenter(T.x,T.y),this.topRightGrip.setCenter(T.x+T.width,T.y),this.bottomLeftGrip.setCenter(T.x,T.y+T.height),this.bottomRightGrip.setCenter(T.x+T.width,T.y+T.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},J.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},J.prototype.clientToLocalCoordinates=function(w,T){var j=this.container.getBoundingClientRect();return{x:w-j.left+this.margin,y:T-j.top+this.margin}},J.prototype.onPointerDown=function(w){this.container.setPointerCapture(w.pointerId),this.previousPoint=this.clientToLocalCoordinates(w.clientX,w.clientY),this.cropRectElement===w.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(w.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(w.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(w.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(w.target)&&(this.activeGrip=this.bottomRightGrip)},J.prototype.onPointerMove=function(w){if(this.isMoving)this.move(this.clientToLocalCoordinates(w.clientX,w.clientY));else if(this.activeGrip){var T=this.clientToLocalCoordinates(w.clientX,w.clientY);this.resize(T)}w.preventDefault()},J.prototype.onPointerUp=function(w){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(w.pointerId)},J.prototype.move=function(w){var T=w.x-this.previousPoint.x,j=w.y-this.previousPoint.y;this.zoomFactor!==1&&(T=-T/this.zoomFactor,j=-j/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+T),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+j),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=w},J.prototype.resize=function(w){var T=Object.assign({},this.cropRect),j=w.x-this.previousPoint.x,ee=w.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:T.x+j<this.margin&&(j=this.margin-T.x),T.x+=j,T.width=this.cropRect.x+this.cropRect.width-T.x;break;case this.bottomRightGrip:case this.topRightGrip:T.width+j>this.canvasWidth*this.zoomFactor&&(j=this.canvasWidth*this.zoomFactor-T.width),T.width+=j}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(T.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(j),T.height=this.aspectRatio.getVerticalLength(T.width)):(T.y+=ee,T.height=this.cropRect.y+this.cropRect.height-T.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?T.height=this.aspectRatio.getVerticalLength(T.width):T.height+=ee}T.width<10&&(T.x=this.cropRect.x,T.width=10),T.height<10&&(T.y=this.cropRect.y,T.height=10),this.previousPoint=w,T.x>=this.margin&&T.y>=this.margin&&T.x-this.margin+T.width<=this.canvasWidth&&T.y-this.margin+T.height<=this.canvasHeight&&(this.cropRect=T,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},J.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var w=this.cropRect.x+this.cropRect.width/2,T=this.cropRect.y+this.cropRect.height/2,j=this.aspectRatio.getHorizontalLength(this.cropRect.height),ee=this.aspectRatio.getVerticalLength(this.cropRect.width);j/this.canvasWidth<ee/this.canvasHeight?this.cropRect.width=j:this.cropRect.height=ee,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=w-this.cropRect.width/2,this.cropRect.y=T-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},J.prototype.getRescaledRect=function(w,T,j,ee,X,ye){var Ve=j/w,ot=ee/T;return{x:(X.x-ye)*Ve+ye,y:(X.y-ye)*ot+ye,width:X.width*Ve,height:X.height*ot}},J.prototype.scaleCanvas=function(w,T){var j=this.getRescaledRect(this.canvasWidth,this.canvasHeight,w,T,this.cropRect,this.margin);this.canvasWidth=w,this.canvasHeight=T,this.onCropChange&&this.onCropChange(j),this.setCropRectangle(j)},J}(),Bn=function(){function J(w){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=w,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(J.prototype,"angle",{get:function(){return this._angle},set:function(w){this._angle=w,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),J.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},J.prototype.onPointerDown=function(w){this.controlContainer.setPointerCapture(w.pointerId),this.isDragging=!0,this.previousPoint={x:w.clientX,y:w.clientY}},J.prototype.onPointerMove=function(w){this.isDragging&&(this.onAngleChange&&this.onAngleChange((w.clientX-this.previousPoint.x)/5),this.previousPoint.x=w.clientX)},J.prototype.onPointerUp=function(w){this.isDragging&&this.onAngleChange&&this.onAngleChange((w.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(w.pointerId)},J.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var w=this.angleLabelText.getBBox();Te.setAttributes(this.angleLabelElement,[["x",((this.width-w.width)/2).toString()],["y",(this.height/2).toString()]])}},J.prototype.positionScaleShape=function(){if(this.scaleShape){var w=this.scaleShape.transform.baseVal.getItem(0);w.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(w,0)}},J.prototype.getVisual=function(){var w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("xmlns","http://www.w3.org/2000/svg"),w.setAttribute("width",this.width+"px"),w.setAttribute("height",this.height+"px"),w.setAttribute("viewBox","0 0 "+this.width+" "+this.height),w.style.flexShrink="0",document.body.appendChild(w);for(var T="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,j=1;j<=this.width/5+10;j++){var ee=j%5==0?this.height/3:this.height/6;T+="h4v"+-ee+"h1v"+ee}T+="v1H0Z",this.scaleShape=Te.createPath(T);var X=Te.createTransform();this.scaleShape.transform.baseVal.appendItem(X),w.appendChild(this.scaleShape),this.angleLabelElement=Te.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Te.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=Te.createTSpan("");return ye.innerHTML="°",this.angleLabelElement.appendChild(ye),w.appendChild(this.angleLabelElement),document.body.removeChild(w),w},J}(),li=function(){function J(){this.naturalSize=!1,this.imageType="image/png"}return J.prototype.rasterize=function(w,T,j,ee,X,ye,Ve){var ot=this;return new Promise(function(ht){var Ue=document.createElement("canvas");Ue.width=w.width.baseVal.value-2*ee,Ue.height=w.height.baseVal.value-2*ee;var mt=1,Rt=1;ot.naturalSize===!0?(mt=T.naturalWidth/(w.width.baseVal.value-2*ee)/ye,Rt=T.naturalHeight/(w.height.baseVal.value-2*ee)/Ve,Ue.width=T.naturalWidth/ye,Ue.height=T.naturalHeight/Ve):ot.width!==void 0&&ot.height!==void 0&&(mt=ot.width/j.width,Rt=ot.height/j.height,Ue.width*=mt,Ue.height*=Rt);var Mt=Ue.getContext("2d");Mt.translate(Ue.width/2,Ue.height/2),Mt.rotate(X*Math.PI/180),Mt.scale(ye,Ve),Mt.translate(-Ue.width/2,-Ue.height/2),Mt.drawImage(T,0,0,Ue.width,Ue.height);var Jt=document.createElement("canvas");Jt.width=j.width*mt,Jt.height=j.height*Rt,Jt.getContext("2d").putImageData(Mt.getImageData((j.x-ee)*mt,(j.y-ee)*Rt,j.width*mt,j.height*Rt),0,0),ht(Jt.toDataURL(ot.imageType,ot.imageQuality))})},J}(),ct=function(){function J(w){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=J.instanceCounter++,this.styles=new ke(this.instanceNo),this.target=w,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(J.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(w){this._zoomToCropEnabled=w,w?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(w){this._isGridVisible=w,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"gridLines",{get:function(){return this._gridLines},set:function(w){this._gridLines=w,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(w){this._rotationAngle=w,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(J.prototype,"aspectRatio",{get:function(){var w;return(w=this._aspectRatio)!==null&&w!==void 0?w:this.aspectRatios[0]},set:function(w){this._aspectRatio=w},enumerable:!1,configurable:!0}),J.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},J.prototype.show=function(){this.showUI(),this.open()},J.prototype.close=function(w){w===void 0&&(w=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),w||this.closeEventListeners.forEach(function(T){return T()}),this._isOpen=!1)},J.prototype.addRenderEventListener=function(w){this.renderEventListeners.push(w)},J.prototype.removeRenderEventListener=function(w){this.renderEventListeners.indexOf(w)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(w),1)},J.prototype.addCloseEventListener=function(w){this.closeEventListeners.push(w)},J.prototype.removeCloseEventListener=function(w){this.closeEventListeners.indexOf(w)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(w),1)},J.prototype.setupResizeObserver=function(){var w=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){w.resize(w.target.clientWidth,w.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},J.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var w=1*this.target.clientWidth/this.target.clientHeight,T=this.contentDiv.clientWidth/w>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*w:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,j=T+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/w;this.resize(T,j)}},J.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},J.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Te.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},J.prototype.resize=function(w,T){this.imageWidth=Math.round(w),this.imageHeight=Math.round(T),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},J.prototype.setEditingTarget=function(){var w=document.createElement("canvas");w.width=this.target.naturalWidth,w.height=this.target.naturalHeight,w.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var T=w.toDataURL();Te.setAttributes(this.editingTarget,[["href",T]]),this.setEditingTargetSize()},J.prototype.setTopLeft=function(){var w=this.target.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=w.left-T.left-this.CANVAS_MARGIN,this.top=w.top-T.top-this.CANVAS_MARGIN},J.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Te.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Te.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Te.createGroup(),this.editingTargetRotationScaleContainer=Te.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var w=Te.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(w);var T=Te.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(T),this.editingTargetContainer=Te.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},J.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},J.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Te.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Sn(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},J.prototype.zoomToCrop=function(){if(this.cropRect){var w=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,T=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=w+"px "+T+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-w+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-T+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},J.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},J.prototype.cropRectChanged=function(w){this.cropRect=w,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},J.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},J.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},J.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},J.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var w=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,T=this.target.offsetTop>w+this.CANVAS_MARGIN?this.target.offsetTop-(w+this.CANVAS_MARGIN):0;this.coverDiv.style.top=T+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},J.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},J.prototype.addTopToolbar=function(){var w=this;this.topToolbar=new At,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var T=new yn;T.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(T);var j=[];this.aspectRatios.forEach(function(Rt){var Mt=new en(Fn.getIcon(Rt.horizontal,Rt.vertical),Rt.horizontal===0&&Rt.vertical===0?"FREE":Rt.horizontal+":"+Rt.vertical);Mt.onClick=function(){return w.ratioButtonClicked(Rt)},j.push(Mt)}),this.aspectRatioButton=new Cn(Fn.getIcon(0,0),"Aspect ratio",j),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,T.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ee=new en('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");ee.isActive=this.isGridVisible,ee.onClick=function(){w.isGridVisible=!w.isGridVisible,ee.isActive=w.isGridVisible},T.addButton(ee);var X=new en('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(X.isActive=this.zoomToCropEnabled,X.onClick=function(){w.zoomToCropEnabled=!w.zoomToCropEnabled,X.isActive=w.zoomToCropEnabled},T.addButton(X),!dt.isLicensed){var ye=new Dt;this.topToolbar.addElementBlock(ye);var Ve=document.createElement("div");Ve.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ot=document.createElement("a");ot.style.color="currentColor",ot.href="https://markerjs.com/products/cropro",ot.target="_blank",ot.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ve.appendChild(ot),ye.addElement(Ve)}var ht=new yn;ht.minWidth=3*this.toolbarHeight+"px",ht.contentAlign="end",this.topToolbar.addButtonBlock(ht);var Ue=new en('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ue.onClick=this.startRenderAndClose,ht.addButton(Ue),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ue.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var mt=new en('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");mt.onClick=this.close,ht.addButton(mt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(mt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},J.prototype.addBottomToolbar=function(){var w=this;this.bottomToolbar=new At,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var T=new yn;T.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(T);var j=new en('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");j.onClick=this.rotateLeftButtonClicked,T.addButton(j);var ee=new en('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");ee.onClick=this.rotateRightButtonClicked,T.addButton(ee);var X=new Dt;X.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(X),this.straightener=new Bn("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ht){w.rotateBy(ht),w.straightener.angle=w.rotationAngle},X.addElement(this.straightener.getUI());var ye=new yn;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var Ve=new en('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ve.onClick=this.flipHorizontallyButtonClicked,ye.addButton(Ve);var ot=new en('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");ot.onClick=this.flipVerticallyButtonClicked,ye.addButton(ot)},J.prototype.ratioButtonClicked=function(w){this.aspectRatio=w,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},J.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Fn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},J.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Rn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},J.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},J.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},J.prototype.restoreState=function(w){if(w){var T=this.cropLayer.getRescaledRect(w.width,w.height,this.imageWidth,this.imageHeight,w.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(T),this.cropRectChanged(T),this.flippedHorizontally=w.flippedHorizontally,this.flippedVertically=w.flippedVertically,this.applyFlip(),this.rotationAngle=w.rotationAngle,this.applyRotation()}},J.prototype.clientToLocalCoordinates=function(w,T){var j=this.cropImage.getBoundingClientRect();return{x:w-j.left,y:T-j.top}},J.prototype.onWindowResize=function(){this.positionUI()},J.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var w=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=w+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},J.prototype.rotateLeftButtonClicked=function(){var w=this.rotationAngle-90;this.rotationAngle%90!=0&&(w+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(w)},J.prototype.rotateRightButtonClicked=function(){var w=this.rotationAngle+90;this.rotationAngle%90!=0&&(w-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(w)},J.prototype.rotateTo=function(w){w=(w=w>180?w-360:w)<=-180?w+360:w,this.rotationAngle=w,this.applyRotation()},J.prototype.rotateBy=function(w){this.rotateTo((this.rotationAngle+w)%360)},J.prototype.applyRotation=function(){var w=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var T=this.editingTargetRotationContainer.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(T,0);var j=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/j.width,this.imageHeight/j.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=w},J.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},J.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},J.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},J.prototype.startRenderAndClose=function(){return Pe(this,void 0,void 0,function(){var w,T;return st(this,function(j){switch(j.label){case 0:return[4,this.render()];case 1:return w=j.sent(),T=this.getState(),this.renderEventListeners.forEach(function(ee){return ee(w,T)}),this.close(!0),[2]}})})},J.prototype.render=function(){return Pe(this,void 0,void 0,function(){var w;return st(this,function(T){switch(T.label){case 0:return(w=new li).naturalSize=this.renderAtNaturalSize,w.imageType=this.renderImageType,w.imageQuality=this.renderImageQuality,w.width=this.renderWidth,w.height=this.renderHeight,this.unzoomFromCrop(),Te.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,w.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return T.sent(),[4,w.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,T.sent()]}})})},J.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ct("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ct("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ct("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var w=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ct("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*w)+`px;
|
|
height: `+(this.toolbarHeight-2*w)+`px;
|
|
padding: `+w+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new rt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new rt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ct("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ct("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ct("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ct("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*w)+`px;
|
|
padding: `+w+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ct("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},J.instanceCounter=0,J}(),St=W("8hTe"),zn=W.n(St),pi=/<pre[^>]*>/g;function ui(J){var w=document.createElement("div");return w.innerHTML=J,w.childNodes.length===0?"":w.childNodes[0].nodeValue}var ki=Se.a=function(J){var w=J.value,T=w===void 0?"":w,j=J.edit,ee=j===void 0?!1:j,X=J.className,ye=J.showTextOnly,Ve=J.showLines,ot=J.replaces,ht=J.zoomImg,Ue=J.hasMask,mt=J.style,Rt=mt===void 0?{}:mt,Mt=J.stylesPrev,Jt=Mt===void 0?{}:Mt,Tt=String(T),qt=Object(I.useRef)(),Zt=Object(I.useRef)(),Mn=Object(I.useState)(""),Gt=Object(H.a)(Mn,2),wn=Gt[0],On=Gt[1],Ln=Object(I.useState)("office"),xn=Object(H.a)(Ln,2),In=xn[0],Hn=xn[1],ri=function(){var yt=new ct(Zt.current);yt.displayMode="popup",yt.addRenderEventListener(function(){var Wt=Object(L.a)(D.a.mark(function pt($t){var Nt;return D.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:return qt.current.style.display="none",sn.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:$t}});case 3:Nt=sn.sent,Nt!=null&&Nt.id&&ot(Zt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(Nt==null?void 0:Nt.id,"?type=").concat(Nt.content_type));case 5:case"end":return sn.stop()}},pt)}));return function(pt){return Wt.apply(this,arguments)}}()),yt.show()},Vn=function(){var yt=new se(Zt.current);yt.settings.displayMode="popup",yt.addEventListener("render",function(){var Wt=Object(L.a)(D.a.mark(function pt($t){var Nt;return D.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:if(qt.current.style.display="none",!Zt.current){sn.next=6;break}return sn.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:$t.dataUrl}});case 4:Nt=sn.sent,Nt!=null&&Nt.id&&ot(Zt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(Nt==null?void 0:Nt.id,"?type=").concat(Nt.content_type));case 6:case"end":return sn.stop()}},pt)}));return function(pt){return Wt.apply(this,arguments)}}()),yt.show(),window.markerArea=yt},_n=Object(I.useMemo)(function(){qt.current&&(qt.current.style.zIndex=-1);try{var zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,yt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Wt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Tt=Tt.replace(zt,"("+Q.a.API_SERVER+"/api/attachments/").replace(yt,'"'+Q.a.API_SERVER+"/api/attachments/").replace(Wt,'"'+Q.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Xn){}var pt=$(Tt),$t=E();if(Tt.match(/\[TOC\]/)&&(pt=pt.replace("<p>[TOC]</p>",A()),O()),pt=pt.replace(/(__special_katext_id_\d+__)/g,function(Xn,sn){var Zn=$t[sn],Ki=Zn.type,Ci=Zn.expression;return Object(ne.renderToString)(ui(Ci)||"",{displayMode:Ki==="block",throwOnError:!1,output:"html"})}),pt=pt.replace(/▁/g,"\u2581\u2581\u2581"),y(),ye){var Nt=document.createElement("div");return Nt.innerHTML=pt,Nt.innerText}return setTimeout(function(){return pn()},500),pt},[Tt]),jn=Object(I.useRef)();S.WebkitLineClamp=Ve,Ve&&(Rt=Object(U.a)(Object(U.a)({},Rt),S));function dn(zt){var yt=zt.target;if(yt.tagName.toUpperCase()==="IMG"){if(ht){var Wt=yt.getAttribute("src");On(Wt),Hn("image")}}else if(yt.tagName.toUpperCase()==="A"){var pt=yt.getAttribute("href");if(pt.indexOf("office")>-1)zt.preventDefault(),On(pt),Hn("office");else if(pt.indexOf("application/pdf")>-1)zt.preventDefault(),On(pt),Hn("pdf");else if(pt.indexOf("text/html")>-1)zt.preventDefault(),On(pt),Hn("html");else if(pt.startsWith("#")){zt.preventDefault();var $t=document.getElementById(pt.replace("#",""));$t&&$t.scrollIntoView(!0)}}}var pn=function(){var yt,Wt=(yt=jn.current)===null||yt===void 0?void 0:yt.querySelectorAll("video");Wt==null||Wt.forEach(function(pt){if(pt.oncontextmenu=function(){return!1},pt.src.indexOf(".m3u8")>-1&&!pt.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var $t=new G.a;$t.loadSource(pt.src),$t.attachMedia(pt)}}})};Object(I.useEffect)(function(){if(jn.current&&_n&&(_n.match(pi)&&window.PR.prettyPrint()),jn.current)return jn.current.addEventListener("click",dn),function(){jn.current.removeEventListener("click",dn),y(),O()}},[_n,jn.current,dn]);var mn=function(yt){if(!ee)return;yt.target.nodeName==="IMG"?(qt.current.style.zIndex=1,qt.current.style.display="flex",qt.current.style.width=yt.target.clientWidth+"px",qt.current.style.height=yt.target.clientHeight+"px",qt.current.style.top=yt.target.offsetTop+"px",qt.current.style.left=yt.target.offsetLeft+"px",Zt.current.src=yt.target.getAttribute("src")):qt.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:jn,style:Object(U.a)({},Rt),className:"".concat(X||""," markdown-body ").concat(zn.a.mdBody),onMouseOver:mn,dangerouslySetInnerHTML:{__html:_n}}),g.a.createElement("div",{ref:qt,className:zn.a.button},g.a.createElement(V.a,null,g.a.createElement(z.a,{onClick:function(){return ri()}},"\u88C1\u526A"),g.a.createElement(z.a,{onClick:function(){return Vn()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Zt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(le.a,{close:!0,data:wn,type:wn!=null&&wn.length?In:"",style:Object(U.a)({},Jt),onClose:function(){return On("")}}))}},"9VGf":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return M});var q=W("q1tI"),V=W.n(q);function M(z,U){var L=Object(q.useRef)();Object(q.useEffect)(function(){L.current=z}),Object(q.useEffect)(function(){function H(){L.current()}if(U!==null){var F=setInterval(H,U);return function(){return clearInterval(F)}}},[U])}},AMnG:function(Fe,Se,W){"use strict";var q=W("miYZ"),V=W("tsqr"),M=W("tJVT"),z=W("q1tI"),U=W.n(z),L=W("nWbc"),H=W.n(L),F=W("Ot1p");Se.a=function(D){var I=D.id,g=D.activeDiscussIndex,f=D.onReplyDiscuss,u=Object(z.useState)(""),d=Object(M.a)(u,2),s=d[0],l=d[1];function r(n){l(n)}function a(){if(!s){V.b.info("\u56DE\u590D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A!");return}f(I,s),l("")}return U.a.createElement("div",{key:I,className:"discuss-item-editor",style:{display:g===I?"block":"none",width:"100%"}},U.a.createElement(F.a,{miniToolbar:!0,startInit:g===I,defaultValue:s,id:I,noStorage:!0,watch:!1,height:155,placeholder:"\u6211\u8981\u56DE\u590D",showResizeBar:!0,onChange:r}),U.a.createElement("a",{onClick:a,className:"btn-send"},"\u53D1\u9001"))}},BU3w:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return L});var q=W("MNnm"),V="rc-util-key";function M(H){if(H.attachTo)return H.attachTo;var F=document.querySelector("head");return F||document.body}function z(H){var F,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(q.a)())return null;var I=document.createElement("style");if((F=D.csp)===null||F===void 0?void 0:F.nonce){var g;I.nonce=(g=D.csp)===null||g===void 0?void 0:g.nonce}I.innerHTML=H;var f=M(D),u=f.firstChild;return D.prepend&&f.prepend?f.prepend(I):D.prepend&&u?f.insertBefore(I,u):f.appendChild(I),I}var U=new Map;function L(H,F){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=M(D);if(!U.has(I)){var g=z("",D),f=g.parentNode;U.set(I,f),f.removeChild(g)}var u=Array.from(U.get(I).children).find(function(a){return a.tagName==="STYLE"&&a[V]===F});if(u){var d,s;if(((d=D.csp)===null||d===void 0?void 0:d.nonce)&&u.nonce!==((s=D.csp)===null||s===void 0?void 0:s.nonce)){var l;u.nonce=(l=D.csp)===null||l===void 0?void 0:l.nonce}return u.innerHTML!==H&&(u.innerHTML=H),u}var r=z(H,D);return r[V]=F,r}},Bd2K:function(Fe,Se,W){(function(q){q(W("VrN/"),W("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(D,I,g){if(g!=q.Init&&g&&D.removeKeyMap("autoCloseTags"),!I)return;var f={name:"autoCloseTags"};(typeof I!="object"||I.whenClosing!==!1)&&(f["'/'"]=function(u){return L(u)}),(typeof I!="object"||I.whenOpening!==!1)&&(f["'>'"]=function(u){return z(u)}),D.addKeyMap(f)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],M=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(D){if(D.getOption("disableInput"))return q.Pass;for(var I=D.listSelections(),g=[],f=D.getOption("autoCloseTags"),u=0;u<I.length;u++){if(!I[u].empty())return q.Pass;var d=I[u].head,s=D.getTokenAt(d),l=q.innerMode(D.getMode(),s.state),r=l.state,a=l.mode.xmlCurrentTag&&l.mode.xmlCurrentTag(r),n=a&&a.name;if(!n)return q.Pass;var h=l.mode.configuration=="html",O=typeof f=="object"&&f.dontCloseTags||h&&V,S=typeof f=="object"&&f.indentTags||h&&M;s.end>d.ch&&(n=n.slice(0,n.length-s.end+d.ch));var x=n.toLowerCase();if(!n||s.type=="string"&&(s.end!=d.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&a.close||s.string.indexOf("/")==d.ch-s.start-1||O&&H(O,x)>-1||F(D,l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(r)||[],n,d,!0))return q.Pass;var A=typeof f=="object"&&f.emptyTags;if(A&&H(A,n)>-1){g[u]={text:"/>",newPos:q.Pos(d.line,d.ch+2)};continue}var C=S&&H(S,x)>-1;g[u]={indent:C,text:">"+(C?`
|
|
|
|
`:"")+"</"+n+">",newPos:C?q.Pos(d.line+1,0):q.Pos(d.line,d.ch+1)}}for(var b=typeof f=="object"&&f.dontIndentOnAutoClose,u=I.length-1;u>=0;u--){var v=g[u];D.replaceRange(v.text,I[u].head,I[u].anchor,"+insert");var p=D.listSelections().slice(0);p[u]={head:v.newPos,anchor:v.newPos},D.setSelections(p),!b&&v.indent&&(D.indentLine(v.newPos.line,null,!0),D.indentLine(v.newPos.line+1,null,!0))}}function U(D,I){for(var g=D.listSelections(),f=[],u=I?"/":"</",d=D.getOption("autoCloseTags"),s=typeof d=="object"&&d.dontIndentOnSlash,l=0;l<g.length;l++){if(!g[l].empty())return q.Pass;var r=g[l].head,a=D.getTokenAt(r),n=q.innerMode(D.getMode(),a.state),h=n.state;if(I&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=r.ch-1))return q.Pass;var O,S=n.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(S&&n.mode.name=="javascript")O=u+"script";else if(S&&n.mode.name=="css")O=u+"style";else{var x=n.mode.xmlCurrentContext&&n.mode.xmlCurrentContext(h);if(!x||x.length&&F(D,x,x[x.length-1],r))return q.Pass;O=u+x[x.length-1]}D.getLine(r.line).charAt(a.end)!=">"&&(O+=">"),f[l]=O}if(D.replaceSelections(f),g=D.listSelections(),!s)for(var l=0;l<g.length;l++)(l==g.length-1||g[l].head.line<g[l+1].head.line)&&D.indentLine(g[l].head.line)}function L(D){return D.getOption("disableInput")?q.Pass:U(D,!0)}q.commands.closeTag=function(D){return U(D)};function H(D,I){if(D.indexOf)return D.indexOf(I);for(var g=0,f=D.length;g<f;++g)if(D[g]==I)return g;return-1}function F(D,I,g,f,u){if(!q.scanForClosingTag)return!1;var d=Math.min(D.lastLine()+1,f.line+500),s=q.scanForClosingTag(D,f,null,d);if(!s||s.tag!=g)return!1;for(var l=u?1:0,r=I.length-1;r>=0&&I[r]==g;r--)++l;f=s.to;for(var r=1;r<l;r++){var a=q.scanForClosingTag(D,f,null,d);if(!a||a.tag!=g)return!1;f=a.to}return!0}})},BdwD:function(Fe,Se,W){"use strict";var q=W("+L6B"),V=W("2/Rp"),M=W("0Owb"),z=W("k1fw"),U=W("q1tI"),L=W.n(U),H=W("FOrL"),F=W.n(H),D=function(g){var f=g.buttonProps,u=f===void 0?{}:f,d=g.styles,s=d===void 0?{}:d,l=g.customText,r=g.ButtonText,a=g.ButtonClick,n=g.Buttonclass,h=g.ButtonTwo;return L.a.createElement("section",{className:"tc animated fadeIn",style:Object(z.a)(Object(z.a)({},{color:"#999",margin:"200px auto"}),s)},L.a.createElement("img",{src:F.a}),L.a.createElement("p",{className:"mt20 font14"},l||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),r&&L.a.createElement(V.a,Object(M.a)({className:n,onClick:a},u),r),h&&h)};Se.a=D},BjJ7:function(Fe,Se,W){"use strict";W.d(Se,"d",function(){return V}),W.d(Se,"c",function(){return M}),W.d(Se,"e",function(){return z}),W.d(Se,"b",function(){return U}),W.d(Se,"a",function(){return H});var q=W("m3rI");function V(F){var D=!0;if(F.length>0){for(var I=0;I<F.length;I++)if(F[I].compile_success==0||!F[I].compile_success){D=!1;break}}else D=!1;return D}function M(F){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",I=[],g=0;g<F.length;g++){var f=F[g],u=D?"".concat(D,"/").concat(f.name):"".concat(f.name);I.push({title:f.name,isLeaf:!(f.type==="tree"),key:u})}return I}function z(F,D,I){for(var g=0;g<F.length;g++){var f=F[g];if(f.key===D){f.children=I;break}f.children&&z(f.children,D,I)}return F}function U(F,D,I){var g;return function(){var f=this,u=arguments,d=function(){g=null,I||F.apply(f,u)},s=I&&!g;clearTimeout(g),g=setTimeout(d,D),s&&F.apply(f,u)}}var L=!0,H=q.a.API_SERVER},"C+DQ":function(Fe,Se,W){},CrYA:function(Fe,Se,W){var q=W("MFOe"),V=q.Global;Fe.exports={name:"sessionStorage",read:z,write:U,each:L,remove:H,clearAll:F};function M(){return V.sessionStorage}function z(D){return M().getItem(D)}function U(D,I){return M().setItem(D,I)}function L(D){for(var I=M().length-1;I>=0;I--){var g=M().key(I);D(z(g),g)}}function H(D){return M().removeItem(D)}function F(){return M().clear()}},DlQD:function(Fe,Se,W){(function(q,V){Fe.exports=V()})(this,function(){"use strict";function q(ge,de){for(var ce=0;ce<de.length;ce++){var re=de[ce];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(ge,re.key,re)}}function V(ge,de,ce){return de&&q(ge.prototype,de),ce&&q(ge,ce),ge}function M(ge,de){if(!ge)return;if(typeof ge=="string")return z(ge,de);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return z(ge,de)}function z(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,re=new Array(de);ce<de;ce++)re[ce]=ge[ce];return re}function U(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=M(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var re=0;return function(){return re>=ge.length?{done:!0}:{done:!1,value:ge[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ce=ge[Symbol.iterator](),ce.next.bind(ce)}function L(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var H=L(function(ge){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ce(re){ge.exports.defaults=re}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),F=H.defaults,D=H.getDefaults,I=H.changeDefaults,g=/[&<>"']/,f=/[&<>"']/g,u=/[<>"']|&(?!#?\w+;)/,d=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(de){return s[de]};function r(ge,de){if(de){if(g.test(ge))return ge.replace(f,l)}else if(u.test(ge))return ge.replace(d,l);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function n(ge){return ge.replace(a,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var h=/(^|[^\[])\^/g;function O(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(ae,ue){return ue=ue.source||ue,ue=ue.replace(h,"$1"),ge=ge.replace(ae,ue),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var S=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(ge,de,ce){if(ge){var re;try{re=decodeURIComponent(n(ce)).replace(S,"").toLowerCase()}catch(ae){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}de&&!x.test(ce)&&(ce=c(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(ae){return null}return ce}var C={},b=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,p=/^([^:]+:\/*[^/]*)[\s\S]*$/;function c(ge,de){C[" "+ge]||(b.test(ge)?C[" "+ge]=ge+"/":C[" "+ge]=P(ge,"/",!0)),ge=C[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(v,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(p,"$1")+de:ge+de}var E={exec:function(){}};function y(ge){for(var de=1,ce,re;de<arguments.length;de++){ce=arguments[de];for(re in ce)Object.prototype.hasOwnProperty.call(ce,re)&&(ge[re]=ce[re])}return ge}function _(ge,de){var ce=ge.replace(/\|/g,function(ue,fe,be){for(var Ie=!1,Xe=fe;--Xe>=0&&be[Xe]==="\\";)Ie=!Ie;return Ie?"|":" |"}),re=ce.split(/ \|/),ae=0;if(re.length>de)re.splice(de);else for(;re.length<de;)re.push("");for(;ae<re.length;ae++)re[ae]=re[ae].trim().replace(/\\\|/g,"|");return re}function P(ge,de,ce){var re=ge.length;if(re===0)return"";for(var ae=0;ae<re;){var ue=ge.charAt(re-ae-1);if(ue===de&&!ce)ae++;else if(ue!==de&&ce)ae++;else break}return ge.substr(0,re-ae)}function N(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,re=0,ae=0;ae<ce;ae++)if(ge[ae]==="\\")ae++;else if(ge[ae]===de[0])re++;else if(ge[ae]===de[1]&&(re--,re<0))return ae;return-1}function K(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var $={escape:r,unescape:n,edit:O,cleanUrl:A,resolveUrl:c,noopTest:E,merge:y,splitCells:_,rtrim:P,findClosingBracket:N,checkSanitizeDeprecation:K},B=H.defaults,R=$.rtrim,G=$.splitCells,Q=$.escape,ne=$.findClosingBracket;function le(ge,de,ce){var re=de.href,ae=de.title?Q(de.title):null,ue=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:re,title:ae,text:ue}:{type:"image",raw:ce,href:re,title:ae,text:Q(ue)}}function _e(ge,de){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return de;var re=ce[1];return de.split(`
|
|
`).map(function(ae){var ue=ae.match(/^\s+/);if(ue===null)return ae;var fe=ue[0];return fe.length>=re.length?ae.slice(re.length):ae}).join(`
|
|
`)}var pe=function(){function ge(ce){this.options=ce||B}var de=ge.prototype;return de.space=function(re){var ae=this.rules.block.newline.exec(re);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
|
|
`}},de.code=function(re,ae){var ue=this.rules.block.code.exec(re);if(ue){var fe=ae[ae.length-1];if(fe&&fe.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var be=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?be:R(be,`
|
|
`)}}},de.fences=function(re){var ae=this.rules.block.fences.exec(re);if(ae){var ue=ae[0],fe=_e(ue,ae[3]||"");return{type:"code",raw:ue,lang:ae[2]?ae[2].trim():ae[2],text:fe}}},de.heading=function(re){var ae=this.rules.block.heading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},de.nptable=function(re){var ae=this.rules.block.nptable.exec(re);if(ae){var ue={type:"table",header:G(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ae[0]};if(ue.header.length===ue.align.length){var fe=ue.align.length,be;for(be=0;be<fe;be++)/^ *-+: *$/.test(ue.align[be])?ue.align[be]="right":/^ *:-+: *$/.test(ue.align[be])?ue.align[be]="center":/^ *:-+ *$/.test(ue.align[be])?ue.align[be]="left":ue.align[be]=null;for(fe=ue.cells.length,be=0;be<fe;be++)ue.cells[be]=G(ue.cells[be],ue.header.length);return ue}}},de.hr=function(re){var ae=this.rules.block.hr.exec(re);if(ae)return{type:"hr",raw:ae[0]}},de.blockquote=function(re){var ae=this.rules.block.blockquote.exec(re);if(ae){var ue=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:ue}}},de.list=function(re){var ae=this.rules.block.list.exec(re);if(ae){for(var ue=ae[0],fe=ae[2],be=fe.length>1,Ie=fe[fe.length-1]===")",Xe={type:"list",raw:ue,ordered:be,start:be?+fe.slice(0,-1):"",loose:!1,items:[]},ut=ae[0].match(this.rules.block.item),bt=!1,ft,at,Be,We,Me,se,ve,Ke=ut.length,Pe=0;Pe<Ke;Pe++)ft=ut[Pe],ue=ft,at=ft.length,ft=ft.replace(/^ *([*+-]|\d+[.)]) */,""),~ft.indexOf(`
|
|
`)&&(at-=ft.length,ft=this.options.pedantic?ft.replace(/^ {1,4}/gm,""):ft.replace(new RegExp("^ {1,"+at+"}","gm"),"")),Pe!==Ke-1&&(Be=this.rules.block.bullet.exec(ut[Pe+1])[0],(be?Be.length===1||!Ie&&Be[Be.length-1]===")":Be.length>1||this.options.smartLists&&Be!==fe)&&(We=ut.slice(Pe+1).join(`
|
|
`),Xe.raw=Xe.raw.substring(0,Xe.raw.length-We.length),Pe=Ke-1)),Me=bt||/\n\n(?!\s*$)/.test(ft),Pe!==Ke-1&&(bt=ft.charAt(ft.length-1)===`
|
|
`,Me||(Me=bt)),Me&&(Xe.loose=!0),se=/^\[[ xX]\] /.test(ft),ve=void 0,se&&(ve=ft[1]!==" ",ft=ft.replace(/^\[[ xX]\] +/,"")),Xe.items.push({type:"list_item",raw:ue,task:se,checked:ve,loose:Me,text:ft});return Xe}},de.html=function(re){var ae=this.rules.block.html.exec(re);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):Q(ae[0]):ae[0]}},de.def=function(re){var ae=this.rules.block.def.exec(re);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var ue=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:ae[0],href:ae[2],title:ae[3]}}},de.table=function(re){var ae=this.rules.block.table.exec(re);if(ae){var ue={type:"table",header:G(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ue.header.length===ue.align.length){ue.raw=ae[0];var fe=ue.align.length,be;for(be=0;be<fe;be++)/^ *-+: *$/.test(ue.align[be])?ue.align[be]="right":/^ *:-+: *$/.test(ue.align[be])?ue.align[be]="center":/^ *:-+ *$/.test(ue.align[be])?ue.align[be]="left":ue.align[be]=null;for(fe=ue.cells.length,be=0;be<fe;be++)ue.cells[be]=G(ue.cells[be].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},de.lheading=function(re){var ae=this.rules.block.lheading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},de.paragraph=function(re){var ae=this.rules.block.paragraph.exec(re);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
|
|
`?ae[1].slice(0,-1):ae[1]}},de.text=function(re,ae){var ue=this.rules.block.text.exec(re);if(ue){var fe=ae[ae.length-1];return fe&&fe.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},de.escape=function(re){var ae=this.rules.inline.escape.exec(re);if(ae)return{type:"escape",raw:ae[0],text:Q(ae[1])}},de.tag=function(re,ae,ue){var fe=this.rules.inline.tag.exec(re);if(fe)return!ae&&/^<a /i.test(fe[0])?ae=!0:ae&&/^<\/a>/i.test(fe[0])&&(ae=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(fe[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(fe[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:fe[0],inLink:ae,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):Q(fe[0]):fe[0]}},de.link=function(re){var ae=this.rules.inline.link.exec(re);if(ae){var ue=ne(ae[2],"()");if(ue>-1){var fe=ae[0].indexOf("!")===0?5:4,be=fe+ae[1].length+ue;ae[2]=ae[2].substring(0,ue),ae[0]=ae[0].substring(0,be).trim(),ae[3]=""}var Ie=ae[2],Xe="";if(this.options.pedantic){var ut=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ie);ut?(Ie=ut[1],Xe=ut[3]):Xe=""}else Xe=ae[3]?ae[3].slice(1,-1):"";Ie=Ie.trim().replace(/^<([\s\S]*)>$/,"$1");var bt=le(ae,{href:Ie&&Ie.replace(this.rules.inline._escapes,"$1"),title:Xe&&Xe.replace(this.rules.inline._escapes,"$1")},ae[0]);return bt}},de.reflink=function(re,ae){var ue;if((ue=this.rules.inline.reflink.exec(re))||(ue=this.rules.inline.nolink.exec(re))){var fe=(ue[2]||ue[1]).replace(/\s+/g," ");if(fe=ae[fe.toLowerCase()],!fe||!fe.href){var be=ue[0].charAt(0);return{type:"text",raw:be,text:be}}var Ie=le(ue,fe,ue[0]);return Ie}},de.strong=function(re,ae,ue){ue===void 0&&(ue="");var fe=this.rules.inline.strong.start.exec(re);if(fe&&(!fe[1]||fe[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ae=ae.slice(-1*re.length);var be=fe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Ie;(fe=be.exec(ae))!=null;)if(Ie=this.rules.inline.strong.middle.exec(ae.slice(0,fe.index+3)),Ie)return{type:"strong",raw:re.slice(0,Ie[0].length),text:re.slice(2,Ie[0].length-2)}}},de.em=function(re,ae,ue){ue===void 0&&(ue="");var fe=this.rules.inline.em.start.exec(re);if(fe&&(!fe[1]||fe[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ae=ae.slice(-1*re.length);var be=fe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Ie;(fe=be.exec(ae))!=null;)if(Ie=this.rules.inline.em.middle.exec(ae.slice(0,fe.index+2)),Ie)return{type:"em",raw:re.slice(0,Ie[0].length),text:re.slice(1,Ie[0].length-1)}}},de.codespan=function(re){var ae=this.rules.inline.code.exec(re);if(ae){var ue=ae[2].replace(/\n/g," "),fe=/[^ ]/.test(ue),be=ue.startsWith(" ")&&ue.endsWith(" ");return fe&&be&&(ue=ue.substring(1,ue.length-1)),ue=Q(ue,!0),{type:"codespan",raw:ae[0],text:ue}}},de.br=function(re){var ae=this.rules.inline.br.exec(re);if(ae)return{type:"br",raw:ae[0]}},de.del=function(re){var ae=this.rules.inline.del.exec(re);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},de.autolink=function(re,ae){var ue=this.rules.inline.autolink.exec(re);if(ue){var fe,be;return ue[2]==="@"?(fe=Q(this.options.mangle?ae(ue[1]):ue[1]),be="mailto:"+fe):(fe=Q(ue[1]),be=fe),{type:"link",raw:ue[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},de.url=function(re,ae){var ue;if(ue=this.rules.inline.url.exec(re)){var fe,be;if(ue[2]==="@")fe=Q(this.options.mangle?ae(ue[0]):ue[0]),be="mailto:"+fe;else{var Ie;do Ie=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Ie!==ue[0]);fe=Q(ue[0]),ue[1]==="www."?be="http://"+fe:be=fe}return{type:"link",raw:ue[0],text:fe,href:be,tokens:[{type:"text",raw:fe,text:fe}]}}},de.inlineText=function(re,ae,ue){var fe=this.rules.inline.text.exec(re);if(fe){var be;return ae?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(fe[0]):Q(fe[0]):fe[0]:be=Q(this.options.smartypants?ue(fe[0]):fe[0]),{type:"text",raw:fe[0],text:be}}},ge}(),Ee=$.noopTest,Oe=$.edit,we=$.merge,he={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:Ee,table:Ee,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};he._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,he._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,he.def=Oe(he.def).replace("label",he._label).replace("title",he._title).getRegex(),he.bullet=/(?:[*+-]|\d{1,9}[.)])/,he.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,he.item=Oe(he.item,"gm").replace(/bull/g,he.bullet).getRegex(),he.list=Oe(he.list).replace(/bull/g,he.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+he.def.source+")").getRegex(),he._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",he._comment=/<!--(?!-?>)[\s\S]*?-->/,he.html=Oe(he.html,"i").replace("comment",he._comment).replace("tag",he._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he.paragraph=Oe(he._paragraph).replace("hr",he.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",he._tag).getRegex(),he.blockquote=Oe(he.blockquote).replace("paragraph",he.paragraph).getRegex(),he.normal=we({},he),he.gfm=we({},he.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*|$)"}),he.gfm.nptable=Oe(he.gfm.nptable).replace("hr",he.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",he._tag).getRegex(),he.gfm.table=Oe(he.gfm.table).replace("hr",he.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",he._tag).getRegex(),he.pedantic=we({},he.normal,{html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",he._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:Ee,paragraph:Oe(he.normal._paragraph).replace("hr",he.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",he.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ee,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:Ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=Oe(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=Oe(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=Oe(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=Oe(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=Oe(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=Oe(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=Oe(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=Oe(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=Oe(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=Oe(oe._blockSkip,"g").getRegex(),oe.overlapSkip=Oe(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=Oe(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=Oe(oe.tag).replace("comment",he._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=Oe(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=Oe(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=Oe(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=we({},oe),oe.pedantic=we({},oe.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:Oe(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=we({},oe.normal,{escape:Oe(oe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=Oe(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=we({},oe.gfm,{br:Oe(oe.br).replace("{2,}","*").getRegex(),text:Oe(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Le={block:he,inline:oe},Ye=H.defaults,nt=Le.block,qe=Le.inline;function it(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function He(ge){var de="",ce,re,ae=ge.length;for(ce=0;ce<ae;ce++)re=ge.charCodeAt(ce),Math.random()>.5&&(re="x"+re.toString(16)),de+="&#"+re+";";return de}var $e=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||Ye,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:nt.normal,inline:qe.normal};this.options.pedantic?(re.block=nt.pedantic,re.inline=qe.pedantic):this.options.gfm&&(re.block=nt.gfm,this.options.breaks?re.inline=qe.breaks:re.inline=qe.gfm),this.tokenizer.rules=re}ge.lex=function(re,ae){var ue=new ge(ae);return ue.lex(re)};var de=ge.prototype;return de.lex=function(re){return re=re.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(re,ae,ue){ae===void 0&&(ae=[]),ue===void 0&&(ue=!0),re=re.replace(/^ +$/gm,"");for(var fe,be,Ie,Xe;re;){if(fe=this.tokenizer.space(re)){re=re.substring(fe.raw.length),fe.type&&ae.push(fe);continue}if(fe=this.tokenizer.code(re,ae)){re=re.substring(fe.raw.length),fe.type?ae.push(fe):(Xe=ae[ae.length-1],Xe.raw+=`
|
|
`+fe.raw,Xe.text+=`
|
|
`+fe.text);continue}if(fe=this.tokenizer.fences(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.heading(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.nptable(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.hr(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.blockquote(re)){re=re.substring(fe.raw.length),fe.tokens=this.blockTokens(fe.text,[],ue),ae.push(fe);continue}if(fe=this.tokenizer.list(re)){for(re=re.substring(fe.raw.length),Ie=fe.items.length,be=0;be<Ie;be++)fe.items[be].tokens=this.blockTokens(fe.items[be].text,[],!1);ae.push(fe);continue}if(fe=this.tokenizer.html(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(ue&&(fe=this.tokenizer.def(re))){re=re.substring(fe.raw.length),this.tokens.links[fe.tag]||(this.tokens.links[fe.tag]={href:fe.href,title:fe.title});continue}if(fe=this.tokenizer.table(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.lheading(re)){re=re.substring(fe.raw.length),ae.push(fe);continue}if(ue&&(fe=this.tokenizer.paragraph(re))){re=re.substring(fe.raw.length),ae.push(fe);continue}if(fe=this.tokenizer.text(re,ae)){re=re.substring(fe.raw.length),fe.type?ae.push(fe):(Xe=ae[ae.length-1],Xe.raw+=`
|
|
`+fe.raw,Xe.text+=`
|
|
`+fe.text);continue}if(re){var ut="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return ae},de.inline=function(re){var ae,ue,fe,be,Ie,Xe,ut=re.length;for(ae=0;ae<ut;ae++){Xe=re[ae];switch(Xe.type){case"paragraph":case"text":case"heading":{Xe.tokens=[],this.inlineTokens(Xe.text,Xe.tokens);break}case"table":{for(Xe.tokens={header:[],cells:[]},be=Xe.header.length,ue=0;ue<be;ue++)Xe.tokens.header[ue]=[],this.inlineTokens(Xe.header[ue],Xe.tokens.header[ue]);for(be=Xe.cells.length,ue=0;ue<be;ue++)for(Ie=Xe.cells[ue],Xe.tokens.cells[ue]=[],fe=0;fe<Ie.length;fe++)Xe.tokens.cells[ue][fe]=[],this.inlineTokens(Ie[fe],Xe.tokens.cells[ue][fe]);break}case"blockquote":{this.inline(Xe.tokens);break}case"list":{for(be=Xe.items.length,ue=0;ue<be;ue++)this.inline(Xe.items[ue].tokens);break}}}return re},de.inlineTokens=function(re,ae,ue,fe,be){ae===void 0&&(ae=[]),ue===void 0&&(ue=!1),fe===void 0&&(fe=!1),be===void 0&&(be="");var Ie,Xe=re,ut;if(this.tokens.links){var bt=Object.keys(this.tokens.links);if(bt.length>0)for(;(ut=this.tokenizer.rules.inline.reflinkSearch.exec(Xe))!=null;)bt.includes(ut[0].slice(ut[0].lastIndexOf("[")+1,-1))&&(Xe=Xe.slice(0,ut.index)+"["+"a".repeat(ut[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ut=this.tokenizer.rules.inline.blockSkip.exec(Xe))!=null;)Xe=Xe.slice(0,ut.index)+"["+"a".repeat(ut[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Ie=this.tokenizer.escape(re)){re=re.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.tag(re,ue,fe)){re=re.substring(Ie.raw.length),ue=Ie.inLink,fe=Ie.inRawBlock,ae.push(Ie);continue}if(Ie=this.tokenizer.link(re)){re=re.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,fe)),ae.push(Ie);continue}if(Ie=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,fe)),ae.push(Ie);continue}if(Ie=this.tokenizer.strong(re,Xe,be)){re=re.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],ue,fe),ae.push(Ie);continue}if(Ie=this.tokenizer.em(re,Xe,be)){re=re.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],ue,fe),ae.push(Ie);continue}if(Ie=this.tokenizer.codespan(re)){re=re.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.br(re)){re=re.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.del(re)){re=re.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],ue,fe),ae.push(Ie);continue}if(Ie=this.tokenizer.autolink(re,He)){re=re.substring(Ie.raw.length),ae.push(Ie);continue}if(!ue&&(Ie=this.tokenizer.url(re,He))){re=re.substring(Ie.raw.length),ae.push(Ie);continue}if(Ie=this.tokenizer.inlineText(re,fe,it)){re=re.substring(Ie.raw.length),be=Ie.raw.slice(-1),ae.push(Ie);continue}if(re){var ft="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ft);break}else throw new Error(ft)}}return ae},V(ge,null,[{key:"rules",get:function(){return{block:nt,inline:qe}}}]),ge}(),Qe=H.defaults,gt=$.cleanUrl,et=$.escape,tt=function(){function ge(ce){this.options=ce||Qe}var de=ge.prototype;return de.code=function(re,ae,ue){var fe=(ae||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(re,fe);be!=null&&be!==re&&(ue=!0,re=be)}return fe?'<pre><code class="'+this.options.langPrefix+et(fe,!0)+'">'+(ue?re:et(re,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?re:et(re,!0))+`</code></pre>
|
|
`},de.blockquote=function(re){return`<blockquote>
|
|
`+re+`</blockquote>
|
|
`},de.html=function(re){return re},de.heading=function(re,ae,ue,fe){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+fe.slug(ue)+'">'+re+"</h"+ae+`>
|
|
`:"<h"+ae+">"+re+"</h"+ae+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(re,ae,ue){var fe=ae?"ol":"ul",be=ae&&ue!==1?' start="'+ue+'"':"";return"<"+fe+be+`>
|
|
`+re+"</"+fe+`>
|
|
`},de.listitem=function(re){return"<li>"+re+`</li>
|
|
`},de.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(re){return"<p>"+re+`</p>
|
|
`},de.table=function(re,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
|
|
<thead>
|
|
`+re+`</thead>
|
|
`+ae+`</table>
|
|
`},de.tablerow=function(re){return`<tr>
|
|
`+re+`</tr>
|
|
`},de.tablecell=function(re,ae){var ue=ae.header?"th":"td",fe=ae.align?"<"+ue+' align="'+ae.align+'">':"<"+ue+">";return fe+re+"</"+ue+`>
|
|
`},de.strong=function(re){return"<strong>"+re+"</strong>"},de.em=function(re){return"<em>"+re+"</em>"},de.codespan=function(re){return"<code>"+re+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(re){return"<del>"+re+"</del>"},de.link=function(re,ae,ue){if(re=gt(this.options.sanitize,this.options.baseUrl,re),re===null)return ue;var fe='<a href="'+et(re)+'"';return ae&&(fe+=' title="'+ae+'"'),fe+=">"+ue+"</a>",fe},de.image=function(re,ae,ue){if(re=gt(this.options.sanitize,this.options.baseUrl,re),re===null)return ue;var fe='<img src="'+re+'" alt="'+ue+'"';return ae&&(fe+=' title="'+ae+'"'),fe+=this.options.xhtml?"/>":">",fe},de.text=function(re){return re},ge}(),Je=function(){function ge(){}var de=ge.prototype;return de.strong=function(re){return re},de.em=function(re){return re},de.codespan=function(re){return re},de.del=function(re){return re},de.html=function(re){return re},de.text=function(re){return re},de.link=function(re,ae,ue){return""+ue},de.image=function(re,ae,ue){return""+ue},de.br=function(){return""},ge}(),vt=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(re){var ae=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var ue=ae;do this.seen[ue]++,ae=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},ge}(),wt=H.defaults,Et=$.unescape,xt=function(){function ge(ce){this.options=ce||wt,this.options.renderer=this.options.renderer||new tt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Je,this.slugger=new vt}ge.parse=function(re,ae){var ue=new ge(ae);return ue.parse(re)};var de=ge.prototype;return de.parse=function(re,ae){ae===void 0&&(ae=!0);var ue="",fe,be,Ie,Xe,ut,bt,ft,at,Be,We,Me,se,ve,Ke,Pe,st,dt,Te,ke=re.length;for(fe=0;fe<ke;fe++){We=re[fe];switch(We.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(We.tokens),We.depth,Et(this.parseInline(We.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(We.text,We.lang,We.escaped);continue}case"table":{for(at="",ft="",Xe=We.header.length,be=0;be<Xe;be++)ft+=this.renderer.tablecell(this.parseInline(We.tokens.header[be]),{header:!0,align:We.align[be]});for(at+=this.renderer.tablerow(ft),Be="",Xe=We.cells.length,be=0;be<Xe;be++){for(bt=We.tokens.cells[be],ft="",ut=bt.length,Ie=0;Ie<ut;Ie++)ft+=this.renderer.tablecell(this.parseInline(bt[Ie]),{header:!1,align:We.align[Ie]});Be+=this.renderer.tablerow(ft)}ue+=this.renderer.table(at,Be);continue}case"blockquote":{Be=this.parse(We.tokens),ue+=this.renderer.blockquote(Be);continue}case"list":{for(Me=We.ordered,se=We.start,ve=We.loose,Xe=We.items.length,Be="",be=0;be<Xe;be++)Pe=We.items[be],st=Pe.checked,dt=Pe.task,Ke="",Pe.task&&(Te=this.renderer.checkbox(st),ve?Pe.tokens.length>0&&Pe.tokens[0].type==="text"?(Pe.tokens[0].text=Te+" "+Pe.tokens[0].text,Pe.tokens[0].tokens&&Pe.tokens[0].tokens.length>0&&Pe.tokens[0].tokens[0].type==="text"&&(Pe.tokens[0].tokens[0].text=Te+" "+Pe.tokens[0].tokens[0].text)):Pe.tokens.unshift({type:"text",text:Te}):Ke+=Te),Ke+=this.parse(Pe.tokens,ve),Be+=this.renderer.listitem(Ke,dt,st);ue+=this.renderer.list(Be,Me,se);continue}case"html":{ue+=this.renderer.html(We.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(We.tokens));continue}case"text":{for(Be=We.tokens?this.parseInline(We.tokens):We.text;fe+1<ke&&re[fe+1].type==="text";)We=re[++fe],Be+=`
|
|
`+(We.tokens?this.parseInline(We.tokens):We.text);ue+=ae?this.renderer.paragraph(Be):Be;continue}default:{var rt='Token with "'+We.type+'" type was not found.';if(this.options.silent){console.error(rt);return}else throw new Error(rt)}}}return ue},de.parseInline=function(re,ae){ae=ae||this.renderer;var ue="",fe,be,Ie=re.length;for(fe=0;fe<Ie;fe++){be=re[fe];switch(be.type){case"escape":{ue+=ae.text(be.text);break}case"html":{ue+=ae.html(be.text);break}case"link":{ue+=ae.link(be.href,be.title,this.parseInline(be.tokens,ae));break}case"image":{ue+=ae.image(be.href,be.title,be.text);break}case"strong":{ue+=ae.strong(this.parseInline(be.tokens,ae));break}case"em":{ue+=ae.em(this.parseInline(be.tokens,ae));break}case"codespan":{ue+=ae.codespan(be.text);break}case"br":{ue+=ae.br();break}case"del":{ue+=ae.del(this.parseInline(be.tokens,ae));break}case"text":{ue+=ae.text(be.text);break}default:{var Xe='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Xe);return}else throw new Error(Xe)}}}return ue},ge}(),kt=$.merge,Ot=$.checkSanitizeDeprecation,Ae=$.escape,Ce=H.getDefaults,Ge=H.changeDefaults,ze=H.defaults;function Re(ge,de,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=kt({},Re.defaults,de||{}),Ot(de),ce){var re=de.highlight,ae;try{ae=$e.lex(ge,de)}catch(Ie){return ce(Ie)}var ue=function(Xe){var ut;if(!Xe)try{ut=xt.parse(ae,de)}catch(bt){Xe=bt}return de.highlight=re,Xe?ce(Xe):ce(null,ut)};if(!re||re.length<3)return ue();if(delete de.highlight,!ae.length)return ue();var fe=0;Re.walkTokens(ae,function(Ie){Ie.type==="code"&&(fe++,setTimeout(function(){re(Ie.text,Ie.lang,function(Xe,ut){if(Xe)return ue(Xe);ut!=null&&ut!==Ie.text&&(Ie.text=ut,Ie.escaped=!0),fe--,fe===0&&ue()})},0))}),fe===0&&ue();return}try{var be=$e.lex(ge,de);return de.walkTokens&&Re.walkTokens(be,de.walkTokens),xt.parse(be,de)}catch(Ie){if(Ie.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Ae(Ie.message+"",!0)+"</pre>";throw Ie}}Re.options=Re.setOptions=function(ge){return kt(Re.defaults,ge),Ge(Re.defaults),Re},Re.getDefaults=Ce,Re.defaults=ze,Re.use=function(ge){var de=kt({},ge);if(ge.renderer&&function(){var re=Re.defaults.renderer||new tt,ae=function(be){var Ie=re[be];re[be]=function(){for(var Xe=arguments.length,ut=new Array(Xe),bt=0;bt<Xe;bt++)ut[bt]=arguments[bt];var ft=ge.renderer[be].apply(re,ut);return ft===!1&&(ft=Ie.apply(re,ut)),ft}};for(var ue in ge.renderer)ae(ue);de.renderer=re}(),ge.tokenizer&&function(){var re=Re.defaults.tokenizer||new pe,ae=function(be){var Ie=re[be];re[be]=function(){for(var Xe=arguments.length,ut=new Array(Xe),bt=0;bt<Xe;bt++)ut[bt]=arguments[bt];var ft=ge.tokenizer[be].apply(re,ut);return ft===!1&&(ft=Ie.apply(re,ut)),ft}};for(var ue in ge.tokenizer)ae(ue);de.tokenizer=re}(),ge.walkTokens){var ce=Re.defaults.walkTokens;de.walkTokens=function(re){ge.walkTokens(re),ce&&ce(re)}}Re.setOptions(de)},Re.walkTokens=function(ge,de){for(var ce=U(ge),re;!(re=ce()).done;){var ae=re.value;de(ae);switch(ae.type){case"table":{for(var ue=U(ae.tokens.header),fe;!(fe=ue()).done;){var be=fe.value;Re.walkTokens(be,de)}for(var Ie=U(ae.tokens.cells),Xe;!(Xe=Ie()).done;)for(var ut=Xe.value,bt=U(ut),ft;!(ft=bt()).done;){var at=ft.value;Re.walkTokens(at,de)}break}case"list":{Re.walkTokens(ae.items,de);break}default:ae.tokens&&Re.walkTokens(ae.tokens,de)}}},Re.Parser=xt,Re.parser=xt.parse,Re.Renderer=tt,Re.TextRenderer=Je,Re.Lexer=$e,Re.lexer=$e.lex,Re.Tokenizer=pe,Re.Slugger=vt,Re.parse=Re;var je=Re;return je})},"DlR+":function(Fe,Se,W){var q=W("MFOe"),V=q.Global,M=q.trim;Fe.exports={name:"cookieStorage",read:U,write:H,each:L,remove:F,clearAll:D};var z=V.document;function U(g){if(!g||!I(g))return null;var f="(?:^|.*;\\s*)"+escape(g).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(z.cookie.replace(new RegExp(f),"$1"))}function L(g){for(var f=z.cookie.split(/; ?/g),u=f.length-1;u>=0;u--){if(!M(f[u]))continue;var d=f[u].split("="),s=unescape(d[0]),l=unescape(d[1]);g(l,s)}}function H(g,f){if(!g)return;z.cookie=escape(g)+"="+escape(f)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function F(g){if(!g||!I(g))return;z.cookie=escape(g)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function D(){L(function(g,f){F(f)})}function I(g){return new RegExp("(?:^|;\\s*)"+escape(g).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(z.cookie)}},EHPI:function(Fe,Se,W){"use strict";var q=W("bbsP"),V=W("/wGt"),M=W("tJVT"),z=W("k1fw"),U=W("q1tI"),L=W.n(U),H=W("ZW9T"),F=W("ZD9Y"),D=W("M8RZ"),I=W("bCnd"),g=W("fcyK"),f=W.n(g),u={theme:Object(I.a)("cmCodeMode","vs-dark"),fontSize:Object(I.a)("cmFontSize",14),showEditorSetting:!1,tabToSpace:Object(I.a)("cmTabToSpace",!0)},d;(function(r){r[r.set_font_size=0]="set_font_size",r[r.set_theme=1]="set_theme",r[r.on_tab_to_space=2]="on_tab_to_space",r[r.set_show_editor_setting=3]="set_show_editor_setting"})(d||(d={}));function s(r,a){switch(a.type){case d.set_show_editor_setting:return Object(z.a)(Object(z.a)({},r),{},{showEditorSetting:a.payload});case d.set_theme:return Object(z.a)(Object(z.a)({},r),{},{theme:a.payload});case d.set_font_size:return Object(z.a)(Object(z.a)({},r),{},{fontSize:a.payload});case d.on_tab_to_space:return Object(z.a)(Object(z.a)({},r),{},{tabToSpace:a.payload});default:throw new Error}}Se.a=function(r){var a=r.isLoading,n=r.value,h=r.onChange,O=r.language,S=r.ActionBarRender,x=S===void 0?function($){return L.a.createElement(l,{onShowCodeSetting:$})}:S,A=Object(U.useReducer)(s,u),C=Object(M.a)(A,2),b=C[0],v=C[1],p=b.theme,c=b.fontSize,E=b.showEditorSetting,y=b.tabToSpace,_={onFontSizeChange:function(B){v({type:d.set_font_size,payload:B}),Object(I.b)("cmFontSize",B)},tabToSpace:y,cmFontSize:c,className:"oj",cmCodeMode:p,onTabToSpace:function(B){v({type:d.on_tab_to_space,payload:B}),Object(I.b)("cmTabToSpace",B)},onCodeModeChange:function(B){v({type:d.set_theme,payload:B}),Object(I.b)("cmCodeMode",B)}};function P(){v({type:d.set_show_editor_setting,payload:!1})}function N(){v({type:d.set_show_editor_setting,payload:!0})}var K={value:n,language:O,onChange:h,theme:p,height:"calc(100% - 56px)",options:{fontSize:c,insertSpaces:y}};return L.a.createElement(U.Fragment,null,L.a.createElement("div",{className:"code-panel-container"},x(N),!a&&L.a.createElement(H.b,K)),L.a.createElement(D.a,null,L.a.createElement(V.a,{className:"oj",title:null,placement:"right",closable:!1,visible:E,onClose:P},L.a.createElement(F.a,_))))};function l(r){var a=r.onShowCodeSetting;return L.a.createElement("div",{className:"action-bar"},L.a.createElement("span",null,"\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"),L.a.createElement("a",{onClick:a},L.a.createElement("i",{className:"iconfont icon-shezhi"})))}},ELLl:function(Fe,Se,W){(function(q){q(W("VrN/"))})(function(q){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},M=q.Pos;q.defineOption("autoCloseBrackets",!1,function(s,l,r){r&&r!=q.Init&&(s.removeKeyMap(U),s.state.closeBrackets=null),l&&(L(z(l,"pairs")),s.state.closeBrackets=l,s.addKeyMap(U))});function z(s,l){return l=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[l]!=null?s[l]:V[l]}var U={Backspace:D,Enter:I};function L(s){for(var l=0;l<s.length;l++){var r=s.charAt(l),a="'"+r+"'";U[a]||(U[a]=H(r))}}L(V.pairs+"`");function H(s){return function(l){return f(l,s)}}function F(s){var l=s.state.closeBrackets;if(!l||l.override)return l;var r=s.getModeAt(s.getCursor());return r.closeBrackets||l}function D(s){var l=F(s);if(!l||s.getOption("disableInput"))return q.Pass;for(var r=z(l,"pairs"),a=s.listSelections(),n=0;n<a.length;n++){if(!a[n].empty())return q.Pass;var h=u(s,a[n].head);if(!h||r.indexOf(h)%2!=0)return q.Pass}for(var n=a.length-1;n>=0;n--){var O=a[n].head;s.replaceRange("",M(O.line,O.ch-1),M(O.line,O.ch+1),"+delete")}}function I(s){var l=F(s),r=l&&z(l,"explode");if(!r||s.getOption("disableInput"))return q.Pass;for(var a=s.listSelections(),n=0;n<a.length;n++){if(!a[n].empty())return q.Pass;var h=u(s,a[n].head);if(!h||r.indexOf(h)%2!=0)return q.Pass}s.operation(function(){var O=s.lineSeparator()||`
|
|
`;s.replaceSelection(O+O,null),s.execCommand("goCharLeft"),a=s.listSelections();for(var S=0;S<a.length;S++){var x=a[S].head.line;s.indentLine(x,null,!0),s.indentLine(x+1,null,!0)}})}function g(s){var l=q.cmpPos(s.anchor,s.head)>0;return{anchor:new M(s.anchor.line,s.anchor.ch+(l?-1:1)),head:new M(s.head.line,s.head.ch+(l?1:-1))}}function f(s,l){var r=F(s);if(!r||s.getOption("disableInput"))return q.Pass;var a=z(r,"pairs"),n=a.indexOf(l);if(n==-1)return q.Pass;for(var h=z(r,"closeBefore"),O=z(r,"triples"),S=a.charAt(n+1)==l,x=s.listSelections(),A=n%2==0,C,b=0;b<x.length;b++){var v=x[b],p=v.head,c,E=s.getRange(p,M(p.line,p.ch+1));if(A&&!v.empty())c="surround";else if((S||!A)&&E==l)S&&d(s,p)?c="both":O.indexOf(l)>=0&&s.getRange(p,M(p.line,p.ch+3))==l+l+l?c="skipThree":c="skip";else if(S&&p.ch>1&&O.indexOf(l)>=0&&s.getRange(M(p.line,p.ch-2),p)==l+l){if(p.ch>2&&/\bstring/.test(s.getTokenTypeAt(M(p.line,p.ch-2))))return q.Pass;c="addFour"}else if(S){var y=p.ch==0?" ":s.getRange(M(p.line,p.ch-1),p);if(!q.isWordChar(E)&&y!=l&&!q.isWordChar(y))c="both";else return q.Pass}else if(A&&(E.length===0||/\s/.test(E)||h.indexOf(E)>-1))c="both";else return q.Pass;if(!C)C=c;else if(C!=c)return q.Pass}var _=n%2?a.charAt(n-1):l,P=n%2?l:a.charAt(n+1);s.operation(function(){if(C=="skip")s.execCommand("goCharRight");else if(C=="skipThree")for(var N=0;N<3;N++)s.execCommand("goCharRight");else if(C=="surround"){for(var K=s.getSelections(),N=0;N<K.length;N++)K[N]=_+K[N]+P;s.replaceSelections(K,"around"),K=s.listSelections().slice();for(var N=0;N<K.length;N++)K[N]=g(K[N]);s.setSelections(K)}else C=="both"?(s.replaceSelection(_+P,null),s.triggerElectric(_+P),s.execCommand("goCharLeft")):C=="addFour"&&(s.replaceSelection(_+_+_+_,"before"),s.execCommand("goCharRight"))})}function u(s,l){var r=s.getRange(M(l.line,l.ch-1),M(l.line,l.ch+1));return r.length==2?r:null}function d(s,l){var r=s.getTokenAt(M(l.line,l.ch+1));return/\bstring/.test(r.type)&&r.start==l.ch&&(l.ch==0||!/\bstring/.test(s.getTokenTypeAt(l)))}})},FOrL:function(Fe,Se,W){Fe.exports=W.p+"static/nodata.a6b3f948.png"},Gytx:function(Fe,Se){Fe.exports=function(q,V,M,z){var U=M?M.call(z,q,V):void 0;if(U!==void 0)return!!U;if(q===V)return!0;if(typeof q!="object"||!q||typeof V!="object"||!V)return!1;var L=Object.keys(q),H=Object.keys(V);if(L.length!==H.length)return!1;for(var F=Object.prototype.hasOwnProperty.bind(V),D=0;D<L.length;D++){var I=L[D];if(!F(I))return!1;var g=q[I],f=V[I];if(U=M?M.call(z,g,f,I):void 0,U===!1||U===void 0&&g!==f)return!1}return!0}},H2Ag:function(Fe,Se,W){Fe.exports={flex_box_center:"flex_box_center___2pJkw",flex_space_between:"flex_space_between___2XyGR",flex_box_vertical_center:"flex_box_vertical_center___3RcdW",flex_box_center_end:"flex_box_center_end___ELbjB",flex_box_column:"flex_box_column___1nxOL","left-panel":"left-panel___19pOi","tab-panel-body":"tab-panel-body___1Wa4B",b1:"b1___rOGbM","oj-width-input":"oj-width-input___1L1MS","oj-mr":"oj-mr___2FJRu","s-navs":"s-navs___Rtxdn","bg-white":"bg-white___3Or1a",active:"active___x-fRG",list:"list___2RvQV",btns:"btns___FcbS4",drawer:"drawer___2L-f8"}},HmJG:function(Fe,Se,W){},I8Z2:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return z}),W.d(Se,"b",function(){return u}),W.d(Se,"c",function(){return s});var q=W("q1tI"),V=function(){var l=function(r,a){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,h){n.__proto__=h}||function(n,h){for(var O in h)h.hasOwnProperty(O)&&(n[O]=h[O])},l(r,a)};return function(r,a){l(r,a);function n(){this.constructor=r}r.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}}(),M=q.createContext(null),z=function(l){V(r,l);function r(){return l!==null&&l.apply(this,arguments)||this}return r.prototype.render=function(){return q.createElement(M.Provider,{value:this.props.store},this.props.children)},r}(q.Component),U=W("Gytx"),L=W.n(U),H=W("2mql"),F=W.n(H),D=function(){var l=function(r,a){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,h){n.__proto__=h}||function(n,h){for(var O in h)h.hasOwnProperty(O)&&(n[O]=h[O])},l(r,a)};return function(r,a){l(r,a);function n(){this.constructor=r}r.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}}(),I=function(){return I=Object.assign||function(l){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var h in r)Object.prototype.hasOwnProperty.call(r,h)&&(l[h]=r[h])}return l},I.apply(this,arguments)};function g(l){return l.displayName||l.name||"Component"}var f=function(){return{}};function u(l,r){r===void 0&&(r={});var a=!!l,n=l||f;return function(O){var S=function(A){D(C,A);function C(b,v){var p=A.call(this,b,v)||this;return p.unsubscribe=null,p.handleChange=function(){if(!p.unsubscribe)return;var c=n(p.store.getState(),p.props);p.setState({subscribed:c})},p.store=p.context,p.state={subscribed:n(p.store.getState(),b),store:p.store,props:b},p}return C.getDerivedStateFromProps=function(b,v){return l&&l.length===2&&b!==v.props?{subscribed:n(v.store.getState(),b),props:b}:{props:b}},C.prototype.componentDidMount=function(){this.trySubscribe()},C.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},C.prototype.shouldComponentUpdate=function(b,v){return!L()(this.props,b)||!L()(this.state.subscribed,v.subscribed)},C.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},C.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},C.prototype.render=function(){var b=I(I(I({},this.props),this.state.subscribed),{store:this.store});return q.createElement(O,I({},b,{ref:this.props.miniStoreForwardedRef}))},C.displayName="Connect("+g(O)+")",C.contextType=M,C}(q.Component);if(r.forwardRef){var x=q.forwardRef(function(A,C){return q.createElement(S,I({},A,{miniStoreForwardedRef:C}))});return F()(x,O)}return F()(S,O)}}var d=function(){return d=Object.assign||function(l){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var h in r)Object.prototype.hasOwnProperty.call(r,h)&&(l[h]=r[h])}return l},d.apply(this,arguments)};function s(l){var r=l,a=[];function n(S){r=d(d({},r),S);for(var x=0;x<a.length;x++)a[x]()}function h(){return r}function O(S){return a.push(S),function(){var A=a.indexOf(S);a.splice(A,1)}}return{setState:n,getState:h,subscribe:O}}},IBYe:function(Fe,Se,W){"use strict";function q(V){return null}Se.a=q},IxHN:function(Fe,Se,W){"use strict";var q=W("q1tI"),V=W.n(q),M=W("07cG"),z=W.n(M);Se.a=function(U){var L=U.message,H=U.className,F=U.children,D=U.style,I=D===void 0?{}:D;return V.a.createElement("div",{className:"".concat(z.a.idsRingWrapper," ").concat(H)},V.a.createElement("div",{className:z.a.ldsRing},V.a.createElement("div",null),V.a.createElement("div",null),V.a.createElement("div",null),V.a.createElement("div",null)),L?V.a.createElement("p",{style:I},L):null,F)}},J66h:function(Fe,Se,W){(function(q){var V,M;(function(z,U){Fe.exports=U(z)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof q!="undefined"?q:this,function(z){"use strict";z=z||{};var U=z.Base64,L="2.6.4",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",F=function(_){for(var P={},N=0,K=_.length;N<K;N++)P[_.charAt(N)]=N;return P}(H),D=String.fromCharCode,I=function(_){if(_.length<2){var P=_.charCodeAt(0);return P<128?_:P<2048?D(192|P>>>6)+D(128|P&63):D(224|P>>>12&15)+D(128|P>>>6&63)+D(128|P&63)}else{var P=65536+(_.charCodeAt(0)-55296)*1024+(_.charCodeAt(1)-56320);return D(240|P>>>18&7)+D(128|P>>>12&63)+D(128|P>>>6&63)+D(128|P&63)}},g=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(_){return _.replace(g,I)},u=function(_){var P=[0,2,1][_.length%3],N=_.charCodeAt(0)<<16|(_.length>1?_.charCodeAt(1):0)<<8|(_.length>2?_.charCodeAt(2):0),K=[H.charAt(N>>>18),H.charAt(N>>>12&63),P>=2?"=":H.charAt(N>>>6&63),P>=1?"=":H.charAt(N&63)];return K.join("")},d=z.btoa&&typeof z.btoa=="function"?function(_){return z.btoa(_)}:function(_){if(_.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return _.replace(/[\s\S]{1,3}/g,u)},s=function(_){return d(f(String(_)))},l=function(_){return _.replace(/[+\/]/g,function(P){return P=="+"?"-":"_"}).replace(/=/g,"")},r=function(_,P){return P?l(s(_)):s(_)},a=function(_){return r(_,!0)},n;z.Uint8Array&&(n=function(_,P){for(var N="",K=0,$=_.length;K<$;K+=3){var B=_[K],R=_[K+1],G=_[K+2],Q=B<<16|R<<8|G;N+=H.charAt(Q>>>18)+H.charAt(Q>>>12&63)+(typeof R!="undefined"?H.charAt(Q>>>6&63):"=")+(typeof G!="undefined"?H.charAt(Q&63):"=")}return P?l(N):N});var h=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,O=function(_){switch(_.length){case 4:var P=(7&_.charCodeAt(0))<<18|(63&_.charCodeAt(1))<<12|(63&_.charCodeAt(2))<<6|63&_.charCodeAt(3),N=P-65536;return D((N>>>10)+55296)+D((N&1023)+56320);case 3:return D((15&_.charCodeAt(0))<<12|(63&_.charCodeAt(1))<<6|63&_.charCodeAt(2));default:return D((31&_.charCodeAt(0))<<6|63&_.charCodeAt(1))}},S=function(_){return _.replace(h,O)},x=function(_){var P=_.length,N=P%4,K=(P>0?F[_.charAt(0)]<<18:0)|(P>1?F[_.charAt(1)]<<12:0)|(P>2?F[_.charAt(2)]<<6:0)|(P>3?F[_.charAt(3)]:0),$=[D(K>>>16),D(K>>>8&255),D(K&255)];return $.length-=[0,0,2,1][N],$.join("")},A=z.atob&&typeof z.atob=="function"?function(_){return z.atob(_)}:function(_){return _.replace(/\S{1,4}/g,x)},C=function(_){return A(String(_).replace(/[^A-Za-z0-9\+\/]/g,""))},b=function(_){return S(A(_))},v=function(_){return String(_).replace(/[-_]/g,function(P){return P=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},p=function(_){return b(v(_))},c;z.Uint8Array&&(c=function(_){return Uint8Array.from(C(v(_)),function(P){return P.charCodeAt(0)})});var E=function(){var _=z.Base64;return z.Base64=U,_};if(z.Base64={VERSION:L,atob:C,btoa:d,fromBase64:p,toBase64:r,utob:f,encode:r,encodeURI:a,btou:S,decode:p,noConflict:E,fromUint8Array:n,toUint8Array:c},typeof Object.defineProperty=="function"){var y=function(_){return{value:_,enumerable:!1,writable:!0,configurable:!0}};z.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",y(function(){return p(this)})),Object.defineProperty(String.prototype,"toBase64",y(function(_){return r(this,_)})),Object.defineProperty(String.prototype,"toBase64URI",y(function(){return r(this,!0)}))}}return z.Meteor&&(Base64=z.Base64),Fe.exports?Fe.exports.Base64=z.Base64:!(V=[],M=function(){return z.Base64}.apply(Se,V),M!==void 0&&(Fe.exports=M)),{Base64:z.Base64}})}).call(this,W("IyRk"))},JB8y:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return q});var q;(function(V){V[V.NOMATCH=-1]="NOMATCH",V[V.OK=0]="OK",V[V.TIMEOUT=2]="TIMEOUT",V[V.PODFAILURE=3]="PODFAILURE",V[V.COMPILEFAILURE=4]="COMPILEFAILURE",V[V.EXECUTEFAILURE=5]="EXECUTEFAILURE"})(q||(q={}))},JPnl:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return v}),W.d(Se,"c",function(){return E});var q=W("+L6B"),V=W("2/Rp"),M=W("tJVT"),z=W("9og8"),U=W("k1fw"),L=W("jrin"),H=W("5NDa"),F=W("5rEg"),D=W("WmNS"),I=W.n(D),g=W("q1tI"),f=W.n(g),u=W("8Skl"),d=W("y3Kf"),s=W("JB8y"),l=W("J66h"),r=W.n(l),a=W("a4uL"),n=W.n(a),h=W("IxHN"),O=W("9Bee"),S=W("1vsH"),x=W("ErOA"),A,C=F.a.TextArea,b={visible:!1,tabIndex:"0"},v=(A={},Object(L.a)(A,s.a.NOMATCH,"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D"),Object(L.a)(A,s.a.OK,"\u8C03\u8BD5\u901A\u8FC7"),Object(L.a)(A,2,"\u8C03\u8BD5\u8D85\u65F6"),Object(L.a)(A,3,"\u8C03\u8BD5pod\u5931\u8D25"),Object(L.a)(A,4,"\u7F16\u8BD1\u5931\u8D25"),Object(L.a)(A,5,"\u6267\u884C\u5931\u8D25"),A),p;(function(_){_[_.SET_VISIBLE=0]="SET_VISIBLE",_[_.SET_TABINDEX=1]="SET_TABINDEX"})(p||(p={}));function c(_,P){switch(P.type){case p.SET_VISIBLE:return Object(U.a)(Object(U.a)({},_),{},{visible:P.payload});case p.SET_TABINDEX:return Object(U.a)(Object(U.a)({},_),{},{tabIndex:P.payload});default:throw new Error}}function E(_){var P=_.status,N=_.error_msg,K=_.output,$=_.input,B=_.expected_output,R=_.is_file,G=_.input_file_url,Q=_.output_file_url,ne=_.expected_output_file_url,le=_.setMonacoValue,_e=_.setData,pe=null,Ee={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(P){case s.a.NOMATCH:pe=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!R&&f.a.createElement(O.a,{value:$,style:Ee}),R&&f.a.createElement("div",{style:Ee},f.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(z.a)(I.a.mark(function Oe(){var we;return I.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,fetch(G,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return we=oe.sent,oe.t0=le,oe.next=6,we.text();case 6:oe.t1=oe.sent,(0,oe.t0)(oe.t1),setTimeout(function(){_e(G)},200);case 9:case"end":return oe.stop()}},Oe)}))},$)),f.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!R&&f.a.createElement(O.a,{value:K&&l.Base64.decode(K)||"",style:Ee}),R&&f.a.createElement("div",{style:Ee},f.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(z.a)(I.a.mark(function Oe(){var we;return I.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,Object(x.a)(Q,{method:"Get",headers:{"Content-Type":"application/xml",Accept:"*/*"}});case 2:we=oe.sent,le(we),setTimeout(function(){_e(Q)},200);case 5:case"end":return oe.stop()}},Oe)}))},K)),f.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!R&&f.a.createElement(O.a,{value:B&&l.Base64.decode(B)||"",style:Ee}),R&&f.a.createElement("div",{style:Ee},f.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(z.a)(I.a.mark(function Oe(){var we;return I.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,fetch(ne,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return we=oe.sent,oe.t0=le,oe.next=6,we.text();case 6:oe.t1=oe.sent,(0,oe.t0)(oe.t1),setTimeout(function(){_e(ne)},200);case 9:case"end":return oe.stop()}},Oe)}))},B)));break;case s.a.EXECUTEFAILURE:pe=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!R&&f.a.createElement(O.a,{value:$,style:Ee}),R&&f.a.createElement("div",{style:Ee},f.a.createElement("a",{onClick:function(){return Object(S.y)(G,$)}},$)),f.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),f.a.createElement("pre",{className:"error"},l.Base64.decode(N)));break;case s.a.COMPILEFAILURE:pe=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!R&&f.a.createElement(O.a,{value:$,style:Ee}),R&&f.a.createElement("div",{style:Ee},f.a.createElement("a",{onClick:function(){return Object(S.y)(G,$)}},$)),f.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),f.a.createElement("pre",{className:"error"},l.Base64.decode(N)));break;case s.a.PODFAILURE:pe=f.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case s.a.TIMEOUT:pe=f.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return f.a.createElement(f.a.Fragment,null," ",pe," ")}function y(_){var P=_.status,N=_.error_msg,K=_.execute_time,$=_.output,B=_.input,R=_.expected_output,G=_.is_file,Q=_.input_file_url,ne=_.output_file_url,le=_.expected_output_file_url,_e=null;switch(P){case s.a.OK:_e=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",K),f.a.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),f.a.createElement("pre",null,l.Base64.decode($)));break;case s.a.NOMATCH:_e=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u8F93\u5165\uFF1A",f.a.createElement("pre",null,B)),f.a.createElement("p",null,"\u8F93\u51FA\uFF1A",$&&l.Base64.decode($)),f.a.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",R&&l.Base64.decode(R)));break;case s.a.EXECUTEFAILURE:_e=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",f.a.createElement("pre",null,B)),f.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),f.a.createElement("pre",{className:"error"},l.Base64.decode(N)));break;case s.a.COMPILEFAILURE:_e=f.a.createElement(f.a.Fragment,null,f.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",f.a.createElement("pre",null,B)),f.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),f.a.createElement("pre",{className:"error"},l.Base64.decode(N)));break;case s.a.PODFAILURE:_e=f.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case s.a.TIMEOUT:_e=f.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return f.a.createElement(f.a.Fragment,null," ",_e," ")}Se.b=function(_){var P=_.input,N=_.debuging,K=_.submitting,$=_.executingMessage,B=_.debugResult,R=_.onChangeInput,G=_.onDebugCode,Q=_.onSubmitCode,ne=_.hack,le=_.user,_e=Object(g.useReducer)(c,b),pe=Object(M.a)(_e,2),Ee=pe[0],Oe=pe[1],we=Ee.visible,he=Ee.tabIndex;function oe(it){var He=it.target.id;Oe({type:p.SET_TABINDEX,payload:He})}function Le(){Oe({type:p.SET_VISIBLE,payload:!we})}var Ye=Object(g.useMemo)(function(){if(B){var it=B.status;return f.a.createElement(f.a.Fragment,null,y(B))}return null},[B]);function nt(){Oe({type:p.SET_VISIBLE,payload:!0}),Oe({type:p.SET_TABINDEX,payload:"1"}),G()}var qe=function(){var it=Object(z.a)(I.a.mark(function He($e){var Qe;return I.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return et.next=2,Object(x.a)("/api/problems/".concat($e,"/start.json"),{method:"get",params:{hack_user_id:le==null?void 0:le.user_id}});case 2:Qe=et.sent,Qe&&(window.location.href="/myproblems/".concat(Qe==null?void 0:Qe.identifier,"?type=1"));case 4:case"end":return et.stop()}},He)}));return function($e){return it.apply(this,arguments)}}();return f.a.createElement("div",{className:"test-case-panel"},f.a.createElement("div",{className:"test-case-panel-body ".concat(we?"active":"")},f.a.createElement("ul",{className:"s-navs"},f.a.createElement("li",null,f.a.createElement("a",{className:he==="0"?"active":"",id:"0",onClick:oe},"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B")),f.a.createElement("li",null,f.a.createElement("a",{className:he==="1"?"active":"",id:"1",onClick:oe},"\u4EE3\u7801\u6267\u884C\u7ED3\u679C"))),f.a.createElement("div",{className:"tab-panel-body ".concat(he==="0"?"":"hide")},f.a.createElement(C,{placeholder:"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",value:P,onChange:R})),f.a.createElement("div",{className:"tab-panel-body ".concat(he==="1"?"":"hide")},N?f.a.createElement(h.a,{message:$}):B?f.a.createElement("section",{style:{height:200}}," ",Ye," "):f.a.createElement("p",{className:"tip"},"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"))),f.a.createElement("a",{className:"btn-collapse ".concat(we?"up":""),onClick:Le},we?f.a.createElement(u.a,null):f.a.createElement(d.a,null)),f.a.createElement("footer",{className:"footer"},f.a.createElement("span",null,"\u63A7\u5236\u53F0"),f.a.createElement("div",{className:"flex-container"},(ne==null?void 0:ne.is_program)&&(ne==null?void 0:ne.above_question)&&f.a.createElement(V.a,{onClick:function(){return qe(ne==null?void 0:ne.above_question)},id:"oj-prev",className:"btn-blue",type:"ghost"},"\u4E0A\u4E00\u9898"),(ne==null?void 0:ne.is_program)&&(ne==null?void 0:ne.under_question)&&f.a.createElement(V.a,{onClick:function(){return qe(ne==null?void 0:ne.under_question)},id:"oj-next",className:"btn-blue",type:"ghost"},"\u4E0B\u4E00\u9898"),f.a.createElement(V.a,{className:"btn-green",type:"ghost",loading:N,onClick:nt},"\u8C03\u8BD5\u4EE3\u7801"),f.a.createElement(V.a,{type:"primary",loading:K,disabled:K,onClick:function(){Oe({type:p.SET_VISIBLE,payload:!1}),Q()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},LdHM:function(Fe,Se,W){"use strict";W.d(Se,"b",function(){return h}),W.d(Se,"a",function(){return S});var q=W("1OyB"),V=W("vuIU"),M=W("Ji7U"),z=W("LK+K"),U=W("q1tI"),L=W("rePB"),H=W("Ff2n"),F=W("ODXe"),D=W("4IlW"),I=W("bX4T"),g=W("YrtM"),f=W("TSYQ"),u=W.n(f),d=W("+nKL"),s=W("8OUc"),l=function(G,Q){var ne=G.prefixCls,le=G.id,_e=G.flattenOptions,pe=G.childrenAsData,Ee=G.values,Oe=G.searchValue,we=G.multiple,he=G.defaultActiveFirstOption,oe=G.height,Le=G.itemHeight,Ye=G.notFoundContent,nt=G.open,qe=G.menuItemSelectedIcon,it=G.virtual,He=G.onSelect,$e=G.onToggleOpen,Qe=G.onActiveValue,gt=G.onScroll,et=G.onMouseEnter,tt="".concat(ne,"-item"),Je=Object(g.a)(function(){return _e},[nt,_e],function(je,ge){return ge[0]&&je[1]!==ge[1]}),vt=U.useRef(null),wt=function(ge){ge.preventDefault()},Et=function(ge){vt.current&&vt.current.scrollTo({index:ge})},xt=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Je.length,re=0;re<ce;re+=1){var ae=(ge+re*de+ce)%ce,ue=Je[ae],fe=ue.group,be=ue.data;if(!fe&&!be.disabled)return ae}return-1},kt=U.useState(function(){return xt(0)}),Ot=Object(F.a)(kt,2),Ae=Ot[0],Ce=Ot[1],Ge=function(ge){Ce(ge);var de=Je[ge];if(!de){Qe(null,-1);return}Qe(de.data.value,ge)};U.useEffect(function(){Ge(he!==!1?xt(0):-1)},[Je.length,Oe]),U.useEffect(function(){var je=setTimeout(function(){if(!we&&nt&&Ee.size===1){var ge=Array.from(Ee)[0],de=Je.findIndex(function(ce){var re=ce.data;return re.value===ge});Ge(de),Et(de)}});return function(){return clearTimeout(je)}},[nt]);var ze=function(ge){ge!==void 0&&He(ge,{selected:!Ee.has(ge)}),we||$e(!1)};if(U.useImperativeHandle(Q,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case D.a.UP:case D.a.DOWN:{var ce=0;if(de===D.a.UP?ce=-1:de===D.a.DOWN&&(ce=1),ce!==0){var re=xt(Ae+ce,ce);Et(re),Ge(re)}break}case D.a.ENTER:{var ae=Je[Ae];ae&&!ae.data.disabled?ze(ae.data.value):ze(void 0),nt&&ge.preventDefault();break}case D.a.ESC:$e(!1)}},onKeyUp:function(){},scrollTo:function(ge){Et(ge)}}}),Je.length===0)return U.createElement("div",{role:"listbox",id:"".concat(le,"_list"),className:"".concat(tt,"-empty"),onMouseDown:wt},Ye);function Re(je){var ge=Je[je];if(!ge)return null;var de=ge.data||{},ce=de.value,re=de.label,ae=de.children,ue=Object(I.a)(de,!0),fe=pe?ae:re;return ge?U.createElement("div",Object.assign({"aria-label":typeof fe=="string"?fe:null},ue,{key:je,role:"option",id:"".concat(le,"_list_").concat(je),"aria-selected":Ee.has(ce)}),ce):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(le,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(Ae-1),Re(Ae),Re(Ae+1)),U.createElement(d.a,{itemKey:"key",ref:vt,data:Je,height:oe,itemHeight:Le,fullHeight:!1,onMouseDown:wt,onScroll:gt,virtual:it,onMouseEnter:et},function(je,ge){var de,ce=je.group,re=je.groupOption,ae=je.data,ue=ae.label,fe=ae.key;if(ce)return U.createElement("div",{className:u()(tt,"".concat(tt,"-group"))},ue!==void 0?ue:fe);var be=ae.disabled,Ie=ae.value,Xe=ae.title,ut=ae.children,bt=ae.style,ft=ae.className,at=Object(H.a)(ae,["disabled","value","title","children","style","className"]),Be=Ee.has(Ie),We="".concat(tt,"-option"),Me=u()(tt,We,ft,(de={},Object(L.a)(de,"".concat(We,"-grouped"),re),Object(L.a)(de,"".concat(We,"-active"),Ae===ge&&!be),Object(L.a)(de,"".concat(We,"-disabled"),be),Object(L.a)(de,"".concat(We,"-selected"),Be),de)),se=pe?ut:ue,ve=!qe||typeof qe=="function"||Be;return U.createElement("div",Object.assign({},at,{"aria-selected":Be,className:Me,title:Xe,onMouseMove:function(){if(Ae===ge||be)return;Ge(ge)},onClick:function(){be||ze(Ie)},style:bt}),U.createElement("div",{className:"".concat(We,"-content")},se||Ie),U.isValidElement(qe)||Be,ve&&U.createElement(s.a,{className:"".concat(tt,"-option-state"),customizeIcon:qe,customizeIconProps:{isSelected:Be}},Be?"\u2713":null))}))},r=U.forwardRef(l);r.displayName="OptionList";var a=r,n=function(){return null};n.isSelectOption=!0;var h=n,O=function(){return null};O.isSelectOptGroup=!0;var S=O,x=W("VTBJ"),A=W("Zm9Q");function C(R){var G=R.key,Q=R.props,ne=Q.children,le=Q.value,_e=Object(H.a)(Q,["children","value"]);return Object(x.a)({key:G,value:le!==void 0?le:G,children:ne},_e)}function b(R){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(R).map(function(Q,ne){if(!U.isValidElement(Q)||!Q.type)return null;var le=Q.type.isSelectOptGroup,_e=Q.key,pe=Q.props,Ee=pe.children,Oe=Object(H.a)(pe,["children"]);return G||!le?C(Q):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ne:_e,"__"),label:_e},Oe),{},{options:b(Ee)})}).filter(function(Q){return Q})}var v=W("2Qr1"),p=W("qNPg"),c=W("U8pU"),E=W("Kwbf"),y=W("WKfj");function _(R){var G=R.mode,Q=R.options,ne=R.children,le=R.backfill,_e=R.allowClear,pe=R.placeholder,Ee=R.getInputElement,Oe=R.showSearch,we=R.onSearch,he=R.defaultOpen,oe=R.autoFocus,Le=R.labelInValue,Ye=R.value,nt=R.inputValue,qe=R.optionLabelProp,it=G==="multiple"||G==="tags",He=Oe!==void 0?Oe:it||G==="combobox",$e=Q||b(ne);if(Object(E.a)(G!=="tags"||$e.every(function(tt){return!tt.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var Qe=$e.some(function(tt){return tt.options?tt.options.some(function(Je){return typeof("value"in Je?Je.value:Je.key)=="number"}):typeof("value"in tt?tt.value:tt.key)=="number"});Object(E.a)(!Qe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(G!=="combobox"||!qe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(G==="combobox"||!le,"`backfill` only works with `combobox` mode."),Object(E.a)(G==="combobox"||!Ee,"`getInputElement` only work with `combobox` mode."),Object(E.b)(G!=="combobox"||!Ee||!_e||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),we&&!He&&G!=="combobox"&&G!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!he||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ye!=null){var gt=Object(y.d)(Ye);Object(E.a)(!Le||gt.every(function(tt){return Object(c.a)(tt)==="object"&&("key"in tt||"value"in tt)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!it||Array.isArray(Ye),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var et=null;Object(A.a)(ne).some(function(tt){if(!U.isValidElement(tt)||!tt.type)return!1;var Je=tt.type;if(Je.isSelectOption)return!1;if(Je.isSelectOptGroup){var vt=Object(A.a)(tt.props.children).every(function(wt){return!U.isValidElement(wt)||!tt.type||wt.type.isSelectOption?!0:(et=wt.type,!1)});return!vt}return et=Je,!0}),et&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(et.displayName||et.name||et,"`.")),Object(E.a)(nt===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=_,N=Object(p.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:b,flattenOptions:v.d,getLabeledValue:v.e,filterOptions:v.b,isValueDisabled:v.g,findValueOption:v.c,warningProps:P,fillOptionsWithMissingValue:v.a}),K=function(R){Object(M.a)(Q,R);var G=Object(z.a)(Q);function Q(){var ne;return Object(q.a)(this,Q),ne=G.apply(this,arguments),ne.selectRef=U.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(V.a)(Q,[{key:"render",value:function(){return U.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),Q}(U.Component);K.Option=h,K.OptGroup=S;var $=K,B=Se.c=$},M8RZ:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return D});var q=W("fWQN"),V=W("mtLc"),M=W("yKVA"),z=W("879j"),U=W("q1tI"),L=W.n(U),H=W("i8i4"),F=W.n(H),D=function(I){Object(M.a)(f,I);var g=Object(z.a)(f);function f(u){var d;Object(q.a)(this,f),d=g.call(this,u);var s=window.document;return d.node=s.createElement("div"),s.body.appendChild(d.node),d}return Object(V.a)(f,[{key:"render",value:function(){var d=this.props.children;return Object(H.createPortal)(d,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),f}(L.a.Component)},MFOe:function(Fe,Se,W){(function(q){var V=L(),M=H(),z=F(),U=typeof window!="undefined"?window:q;Fe.exports={assign:V,create:M,trim:z,bind:D,slice:I,each:g,map:f,pluck:u,isList:d,isFunction:s,isObject:l,Global:U};function L(){return Object.assign?Object.assign:function(a,n,h,O){for(var S=1;S<arguments.length;S++)g(Object(arguments[S]),function(x,A){a[A]=x});return a}}function H(){if(Object.create)return function(n,h,O,S){var x=I(arguments,1);return V.apply(this,[Object.create(n)].concat(x))};{function r(){}return function(n,h,O,S){var x=I(arguments,1);return r.prototype=n,V.apply(this,[new r].concat(x))}}}function F(){return String.prototype.trim?function(a){return String.prototype.trim.call(a)}:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function D(r,a){return function(){return a.apply(r,Array.prototype.slice.call(arguments,0))}}function I(r,a){return Array.prototype.slice.call(r,a||0)}function g(r,a){u(r,function(n,h){return a(n,h),!1})}function f(r,a){var n=d(r)?[]:{};return u(r,function(h,O){return n[O]=a(h,O),!1}),n}function u(r,a){if(d(r)){for(var n=0;n<r.length;n++)if(a(r[n],n))return r[n]}else for(var h in r)if(r.hasOwnProperty(h)&&a(r[h],h))return r[h]}function d(r){return r!=null&&typeof r!="function"&&typeof r.length=="number"}function s(r){return r&&{}.toString.call(r)==="[object Function]"}function l(r){return r&&{}.toString.call(r)==="[object Object]"}}).call(this,W("IyRk"))},NvD2:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return L});var q=W("Kwbf");function V(H,F){var D=new Set;return H.forEach(function(I){F.has(I)||D.add(I)}),D}function M(H){var F=H||{},D=F.disabled,I=F.disableCheckbox,g=F.checkable;return!!(D||I)||g===!1}function z(H,F,D,I){for(var g=new Set(H),f=new Set,u=0;u<=D;u+=1){var d=F.get(u)||new Set;d.forEach(function(a){var n=a.key,h=a.node,O=a.children,S=O===void 0?[]:O;g.has(n)&&!I(h)&&S.filter(function(x){return!I(x.node)}).forEach(function(x){g.add(x.key)})})}for(var s=new Set,l=D;l>=0;l-=1){var r=F.get(l)||new Set;r.forEach(function(a){var n=a.parent,h=a.node;if(I(h)||!a.parent||s.has(a.parent.key))return;if(I(a.parent.node)){s.add(n.key);return}var O=!0,S=!1;(n.children||[]).filter(function(x){return!I(x.node)}).forEach(function(x){var A=x.key,C=g.has(A);O&&!C&&(O=!1),!S&&(C||f.has(A))&&(S=!0)}),O&&g.add(n.key),S&&f.add(n.key),s.add(n.key)})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(V(f,g))}}function U(H,F,D,I,g){for(var f=new Set(H),u=new Set(F),d=0;d<=I;d+=1){var s=D.get(d)||new Set;s.forEach(function(n){var h=n.key,O=n.node,S=n.children,x=S===void 0?[]:S;!f.has(h)&&!u.has(h)&&!g(O)&&x.filter(function(A){return!g(A.node)}).forEach(function(A){f.delete(A.key)})})}u=new Set;for(var l=new Set,r=I;r>=0;r-=1){var a=D.get(r)||new Set;a.forEach(function(n){var h=n.parent,O=n.node;if(g(O)||!n.parent||l.has(n.parent.key))return;if(g(n.parent.node)){l.add(h.key);return}var S=!0,x=!1;(h.children||[]).filter(function(A){return!g(A.node)}).forEach(function(A){var C=A.key,b=f.has(C);S&&!b&&(S=!1),!x&&(b||u.has(C))&&(x=!0)}),S||f.delete(h.key),x&&u.add(h.key),l.add(h.key)})}return{checkedKeys:Array.from(f),halfCheckedKeys:Array.from(V(u,f))}}function L(H,F,D,I){var g=[],f;I?f=I:f=M;var u=new Set(H.filter(function(r){var a=!!D[r];return a||g.push(r),a})),d=new Map,s=0;Object.keys(D).forEach(function(r){var a=D[r],n=a.level,h=d.get(n);h||(h=new Set,d.set(n,h)),h.add(a),s=Math.max(s,n)}),Object(q.a)(!g.length,"Tree missing follow keys: ".concat(g.slice(0,100).map(function(r){return"'".concat(r,"'")}).join(", ")));var l;return F===!0?l=z(u,d,s,f):l=U(u,F.halfCheckedKeys,d,s,f),l}},OJz4:function(Fe,Se,W){"use strict";W.d(Se,"d",function(){return V}),W.d(Se,"h",function(){return M}),W.d(Se,"b",function(){return z}),W.d(Se,"f",function(){return U}),W.d(Se,"e",function(){return L}),W.d(Se,"c",function(){return H}),W.d(Se,"a",function(){return F}),W.d(Se,"g",function(){return D}),W.d(Se,"i",function(){return I}),W.d(Se,"k",function(){return g}),W.d(Se,"j",function(){return f});var q=W("ErOA");function V(u){return Object(q.c)("myproblems/".concat(u,".json"),{hidePopLogin:!0})}function M(u,d){return Object(q.f)("myproblems/".concat(u,"/code_submit.json"),d)}function z(u,d){return Object(q.c)("myproblems/".concat(u,"/code_debug.json"),d)}function U(u,d){return Object(q.c)("myproblems/".concat(u,"/submit_records.json"),d)}function L(u){return Object(q.c)("myproblems/record_detail.json",{id:u})}function H(u,d){return Object(q.c)("myproblems/".concat(u,"/result.json"),{mode:d})}function F(u,d){return Object(q.f)("myproblems/".concat(u,"/add_notes.json"),d)}function D(u){return Object(q.f)("myproblems/".concat(u,"/restore_initial_code.json"))}function I(u){return Object(q.f)("myproblems/".concat(u,"/sync_code.json"))}function g(u,d){return Object(q.f)("myproblems/".concat(u,"/update_code.json"),d)}function f(u,d){return Object(q.f)("discusses/".concat(u,"/plus.json"),d)}},OLES:function(Fe,Se,W){"use strict";var q=W("U8pU"),V=W("VTBJ"),M=W("Ff2n"),z=W("q1tI"),U=W("uciX"),L=W("7ixt"),H=function(u){var d=u.overlay,s=u.prefixCls,l=u.id,r=u.overlayInnerStyle;return z.createElement("div",{className:"".concat(s,"-inner"),id:l,role:"tooltip",style:r},typeof d=="function"?d():d)},F=H,D=function(u,d){var s=u.overlayClassName,l=u.trigger,r=l===void 0?["hover"]:l,a=u.mouseEnterDelay,n=a===void 0?0:a,h=u.mouseLeaveDelay,O=h===void 0?.1:h,S=u.overlayStyle,x=u.prefixCls,A=x===void 0?"rc-tooltip":x,C=u.children,b=u.onVisibleChange,v=u.afterVisibleChange,p=u.transitionName,c=u.animation,E=u.placement,y=E===void 0?"right":E,_=u.align,P=_===void 0?{}:_,N=u.destroyTooltipOnHide,K=N===void 0?!1:N,$=u.defaultVisible,B=u.getTooltipContainer,R=u.overlayInnerStyle,G=Object(M.a)(u,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Q=Object(z.useRef)(null);Object(z.useImperativeHandle)(d,function(){return Q.current});var ne=Object(V.a)({},G);"visible"in u&&(ne.popupVisible=u.visible);var le=function(){var we=u.arrowContent,he=we===void 0?null:we,oe=u.overlay,Le=u.id;return[z.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},he),z.createElement(F,{key:"content",prefixCls:A,id:Le,overlay:oe,overlayInnerStyle:R})]},_e=!1,pe=!1;if(typeof K=="boolean")_e=K;else if(K&&Object(q.a)(K)==="object"){var Ee=K.keepParent;_e=Ee===!0,pe=Ee===!1}return z.createElement(U.a,Object.assign({popupClassName:s,prefixCls:A,popup:le,action:r,builtinPlacements:L.a,popupPlacement:y,ref:Q,popupAlign:P,getPopupContainer:B,onPopupVisibleChange:b,afterPopupVisibleChange:v,popupTransitionName:p,popupAnimation:c,defaultPopupVisible:$,destroyPopupOnHide:_e,autoDestroy:pe,mouseLeaveDelay:O,popupStyle:S,mouseEnterDelay:n},ne),C)},I=Object(z.forwardRef)(D),g=Se.a=I},OZM5:function(Fe,Se,W){"use strict";W.d(Se,"b",function(){return I}),W.d(Se,"a",function(){return g}),W.d(Se,"k",function(){return f}),W.d(Se,"h",function(){return u}),W.d(Se,"i",function(){return d}),W.d(Se,"g",function(){return s}),W.d(Se,"c",function(){return l}),W.d(Se,"d",function(){return r}),W.d(Se,"j",function(){return h}),W.d(Se,"e",function(){return O}),W.d(Se,"f",function(){return S});var q=W("KQm4"),V=W("U8pU"),M=W("Ff2n"),z=W("q1tI"),U=W.n(z),L=W("Kwbf"),H=W("WaYH"),F=.25,D=2;function I(x,A){var C=x.slice(),b=C.indexOf(A);return b>=0&&C.splice(b,1),C}function g(x,A){var C=x.slice();return C.indexOf(A)===-1&&C.push(A),C}function f(x){return x.split("-")}function u(x,A){return"".concat(x,"-").concat(A)}function d(x){return x&&x.type&&x.type.isTreeNode}function s(x,A){var C=[x],b=A[x];function v(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];p.forEach(function(c){var E=c.key,y=c.children;C.push(E),v(y)})}return v(b.children),C}function l(x,A){var C=x.clientY,b=A.selectHandle.getBoundingClientRect(),v=b.top,p=b.bottom,c=b.height,E=Math.max(c*F,D);return C<=v+E?-1:C>=p-E?1:0}function r(x,A){if(!x)return;var C=A.multiple;return C?x.slice():x.length?[x[0]]:x}var a=function(A){return A};function n(x,A){if(!x)return[];var C=A||{},b=C.processProps,v=b===void 0?a:b,p=Array.isArray(x)?x:[x];return p.map(function(c){var E=c.children,y=Object(M.a)(c,["children"]),_=n(E,A);return U.a.createElement(H.a,Object.assign({},v(y)),_)})}function h(x){if(!x)return null;var A;if(Array.isArray(x))A={checkedKeys:x,halfCheckedKeys:void 0};else if(Object(V.a)(x)==="object")A={checkedKeys:x.checked||void 0,halfCheckedKeys:x.halfChecked||void 0};else return Object(L.a)(!1,"`checkedKeys` is not an array or an object"),null;return A}function O(x,A){var C=new Set;function b(v){if(C.has(v))return;var p=A[v];if(!p)return;C.add(v);var c=p.parent,E=p.node;if(E.disabled)return;c&&b(c.key)}return(x||[]).forEach(function(v){b(v)}),Object(q.a)(C)}function S(x){var A={};return Object.keys(x).forEach(function(C){(C.startsWith("data-")||C.startsWith("aria-"))&&(A[C]=x[C])}),A}},Ot1p:function(Fe,Se,W){"use strict";var q=W("2qtc"),V=W("kLXV"),M=W("rAM+"),z=W("miYZ"),U=W("tsqr"),L=W("9og8"),H=W("tJVT"),F=W("jrin"),D=W("WmNS"),I=W.n(D),g=W("q1tI"),f=W.n(g),u=W("VrN/"),d=W.n(u),s=W("bdgK"),l=W("p77/"),r=W("Bd2K"),a=W("ELLl"),n=W("19Vz"),h=W("lZu9"),O=W("+NIl"),S=W("kSUc"),x=W("9Bee"),A=function(be){var Ie=be.value,Xe=Ie===void 0?"":Ie,ut=be.className,bt=be.showTextOnly,ft=be.showLines,at=be.style,Be=at===void 0?{}:at,We=Object(g.useMemo)(function(){return""},[Xe]);return f.a.createElement(f.a.Fragment,null,f.a.createElement("div",{dangerouslySetInnerHTML:{__html:We}}))},C=W("0Owb"),b=W("dejd"),v=W("C+DQ"),p=W("1vsH"),c=W("m3rI"),E=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function y(be){var Ie=be.onActionCallback,Xe=be.title,ut=be.icon,bt=be.actionName,ft=be.className,at=ft===void 0?"":ft,Be=be.children;function We(){Ie(bt)}return f.a.createElement("a",{title:Xe,className:at,onClick:We},f.a.createElement("i",{className:"md-iconfont ".concat(ut)}),Be)}var _=function(be){var Ie=be.watch,Xe=be.showNullButton,ut=be.onActionCallback,bt=be.fullScreen,ft=be.insertTemp,at=be.hidetoolBar,Be=be.uuid,We=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.F)("_educoder_session"),"&key=").concat(Be,"&api=").concat(encodeURIComponent(c.a.PROXY_SERVER)));var Me=[].concat(E,[{title:"".concat(Ie?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ie?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return f.a.createElement("ul",{className:"markdown-toolbar-container"},!at&&Me.map(function(se,ve){return f.a.createElement("li",{key:ve},se.actionName?f.a.createElement(y,Object(C.a)({},se,{onActionCallback:ut})):f.a.createElement("span",{className:"v-line"}))}),Xe?f.a.createElement("li",null,f.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ut},f.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ft&&f.a.createElement("li",null,f.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ft),onActionCallback:ut},f.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),f.a.createElement("li",{className:"btn-full-screen"},f.a.createElement(y,{icon:"".concat(bt?"icon-shrink":"icon-enlarge"),title:bt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ut})))},P=W("M8RZ"),N=W("+L6B"),K=W("2/Rp"),$=W("y8nQ"),B=W("Vl3Y"),R=W("5NDa"),G=W("5rEg"),Q={labelCol:{span:4},wrapperCol:{span:20}},ne=function(be){var Ie=be.callback,Xe=be.onCancel;function ut(bt){Ie(bt)}return f.a.createElement(B.a,Object(C.a)({},Q,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ut}),f.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},f.a.createElement(G.a,null)),f.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},f.a.createElement(G.a,null)),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(K.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))},le=W("7ahc"),_e=W("HmJG"),pe=W("BjJ7"),Ee=B.a.useForm,Oe={width:280,marginRight:10},we={labelCol:{span:5},wrapperCol:{span:19}},he=function(be){var Ie=be.callback,Xe=be.onCancel,ut=Ee(),bt=Object(H.a)(ut,1),ft=bt[0];function at(Me){Ie(Me)}function Be(Me,se){if(Me.status===-1){U.b.error(Me.message);return}ft.setFieldsValue({src:"/api/attachments/".concat(Me.id),type:se.type})}function We(Me){var se=Me.target.files[0];Le(se,Be)}return f.a.createElement(B.a,Object(C.a)({form:ft},we,{className:"upload-image-panel",onFinish:at}),f.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},f.a.createElement("div",{className:"flex-container"},f.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},f.a.createElement(G.a,{style:Oe})),f.a.createElement(oe,{onFileChange:We}))),f.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},f.a.createElement(G.a,{style:{width:264}})),f.a.createElement(B.a.Item,{style:{textAlign:"right"}},f.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(K.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))};function oe(be){var Ie=be.onFileChange;return f.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",f.a.createElement("input",{type:"file",onChange:Ie}))}function Le(be,Ie){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Xe=new FormData;Xe.append("editormd-image-file",be),Xe.append("file_param_name","editormd-image-file"),Xe.append("byxhr","true");var ut=new window.XMLHttpRequest;ut.withCredentials=!0,ut.addEventListener("load",function(bt){Ie(JSON.parse(bt.target.responseText),be)},!1),ut.addEventListener("error",function(bt){console.error(bt)},!1),ut.open("POST","".concat(pe.a,"/api/attachments.json")),ut.send(Xe)}var Ye=W("giR+"),nt=W("fyUT"),qe=W("7Kak"),it=W("9yH6"),He=it.a.Group,$e={margin:"0 8px"},Qe=function(be){var Ie=be.callback,Xe=be.onCancel;function ut(bt){Ie(bt)}return f.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ut},f.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},f.a.createElement("span",{style:$e},"\u5355\u5143\u683C\u6570\uFF1A"),f.a.createElement("span",{style:$e},"\u884C\u6570"),f.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},f.a.createElement(nt.a,null)),f.a.createElement("span",{style:$e},"\u5217\u6570"),f.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},f.a.createElement(nt.a,null))),f.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},f.a.createElement("span",{style:$e},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),f.a.createElement(B.a.Item,{name:"align"},f.a.createElement(He,null,f.a.createElement(it.a,{value:"default"},f.a.createElement("i",{className:"fa fa-align-justify"})),f.a.createElement(it.a,{value:"left"},f.a.createElement("i",{className:"fa fa-align-left"})),f.a.createElement(it.a,{value:"center"},f.a.createElement("i",{className:"fa fa-align-center"})),f.a.createElement(it.a,{value:"right"},f.a.createElement("i",{className:"fa fa-align-right"}))))),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(K.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))},gt=W("ErOA"),et=W("7Cbv"),tt="link",Je="upload-image",vt="code-block",wt="add-table",Et="------------",xt={default:Et,left:":".concat(Et),center:":".concat(Et,":"),right:"".concat(Et,":")},kt=W("9VGf"),Ot,Ae;function Ce(){}var Ge=0,ze=1e4,Re="\u2581",je=`
|
|
**\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 ge(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,ce=de?"Cmd":"Ctrl",re=["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"],ae=(Ot={},Object(F.a)(Ot,ce+"-B","bold"),Object(F.a)(Ot,ce+"-I","italic"),Ot),ue=(Ae={},Object(F.a)(Ae,tt,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ae,vt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ae,Je,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Ae,wt,"\u6DFB\u52A0\u8868\u683C"),Ae),fe=Se.a=function(be){var Ie=be.defaultValue,Xe=Ie===void 0?"":Ie,ut=be.onChange,bt=be.width,ft=bt===void 0?"100%":bt,at=be.height,Be=at===void 0?400:at,We=be.miniToolbar,Me=We===void 0?!1:We,se=be.isFocus,ve=se===void 0?!1:se,Ke=be.watch,Pe=be.insertTemp,st=be.mode,dt=st===void 0?"markdown":st,Te=be.id,ke=Te===void 0?"markdown-editor-id":Te,rt=be.showResizeBar,Ct=rt===void 0?!1:rt,At=be.noStorage,cn=At===void 0?!1:At,yn=be.showNullButton,en=yn===void 0?!1:yn,Dt=be.hidetoolBar,Rn=Dt===void 0?!1:Dt,Fn=be.fullScreen,Cn=Fn===void 0?!1:Fn,Qt=be.onBlur,Sn=be.onCMBeforeChange,Bn=be.onFullScreen,li=be.className,ct=li===void 0?"":li,St=be.disablePaste,zn=St===void 0?!1:St,pi=be.placeholder,ui=pi===void 0?"":pi,ki=be.values,J=ki===void 0?"":ki,w=Object(g.useState)(null),T=Object(H.a)(w,2),j=T[0],ee=T[1],X=Object(g.useState)(Xe),ye=Object(H.a)(X,2),Ve=ye[0],ot=ye[1],ht=Object(g.useState)(Ke),Ue=Object(H.a)(ht,2),mt=Ue[0],Rt=Ue[1],Mt=Object(g.useState)(Cn),Jt=Object(H.a)(Mt,2),Tt=Jt[0],qt=Jt[1],Zt=Object(g.useState)(""),Mn=Object(H.a)(Zt,2),Gt=Mn[0],wn=Mn[1],On=Object(g.useState)(0),Ln=Object(H.a)(On,2),xn=Ln[0],In=Ln[1],Hn=Object(g.useState)(Be),ri=Object(H.a)(Hn,2),Vn=ri[0],_n=ri[1],jn=Object(g.useState)(!1),dn=Object(H.a)(jn,2),pn=dn[0],mn=dn[1],zt=Object(g.useRef)(Object(et.a)()),yt=Object(g.useRef)(!1),Wt=Object(g.useRef)(),pt=Object(g.useRef)(),$t=Object(g.useRef)(),Nt=Object(g.useRef)(),Xn=Object(g.useRef)(),sn=function(){var Ft=Object(L.a)(I.a.mark(function Xt(){var Kt,tn;return I.a.wrap(function(Tn){for(;;)switch(Tn.prev=Tn.next){case 0:return Tn.next=2,Object(gt.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:zt.current}});case 2:tn=Tn.sent,tn!=null&&(Kt=tn.attachments)!==null&&Kt!==void 0&&Kt.length&&(console.log("cm:",j,pt),tn.attachments.map(function(ln){ln.content_type.indexOf("image")>-1?j.replaceSelection(".concat(ln.content_type,")")):ln.content_type.indexOf("video")>-1?j.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):ln.content_type.indexOf("pdf")>-1?j.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(ln.id,"?type=").concat(ln.content_type,'&disposition=inline" target="_blank">').concat(ln.name,"</a>")):j.replaceSelection("[".concat(ln.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(ln.id,"?type=").concat(ln.content_type,")"))}));case 4:case"end":return Tn.stop()}},Xt)}));return function(){return Ft.apply(this,arguments)}}();Object(g.useEffect)(function(){ot(J),j==null||j.setValue(J)},[J]),Object(g.useEffect)(function(){Bn==null||Bn(Tt)},[Tt]),Object(g.useEffect)(function(){if(pt.current){var Ft=d.a.fromTextArea(pt.current,{mode:dt,lineNumbers:!Me,lineWrapping:!0,value:Xe,autoCloseTags:!0,autoCloseBrackets:!0});ve&&Ft.focus();function Xt(Kt,tn){if(zn){tn.preventDefault();return}var rn=tn.clipboardData;if(rn){var Tn=rn.types.toString(),ln=rn.items;if(Tn==="Files"||rn.types.indexOf("Files")>-1){if(tn.preventDefault(),dt=="stex")return;try{var Un,ai=ln[1];((Un=ln[0])===null||Un===void 0?void 0:Un.kind)==="file"&&(ai=ln[0]);var nn=ai.getAsFile(),bi=nn.name.split(".").pop();Le(nn,function(bn){if(bn.id){var Qn,qn,mi;(nn==null||((Qn=nn.type)===null||Qn===void 0)?void 0:Qn.indexOf("image"))>-1?Ft.replaceSelection(".concat(bn.content_type,")")):(nn==null||((qn=nn.type)===null||qn===void 0)?void 0:qn.indexOf("video"))>-1?Ft.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,'"></video>')):(nn==null||((mi=nn.type)===null||mi===void 0)?void 0:mi.indexOf("pdf"))>-1?Ft.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,"?type=").concat(nn.type,'&disposition=inline" target="_blank">').concat(nn.name,"</a>")):re.includes(bi)?Ft.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,'?type=office&disposition=inline" target="_blank">').concat(nn.name,"</a>")):Ft.replaceSelection("[".concat(nn.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,"?type=").concat(bn.content_type,")"))}else(bn==null?void 0:bn.status)===401&&(document.location.href="/user/login")})}catch(bn){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Ft.on("paste",Xt),Ft.on("dragleave",function(Kt,tn){$t.current.classList.remove("mouse-hover-md")}),Ft.on("dragover",function(Kt,tn){$t.current.classList.add("mouse-hover-md")}),Ft.on("drop",function(Kt,tn){$t.current.classList.add("mouse-hover-md");var rn;if(rn=tn.dataTransfer.files,rn.length>0){tn.preventDefault(),tn.stopPropagation();for(var Tn=function(ai){var nn=rn[ai],bi=nn.name.split(".").pop();Le(nn,function(bn){if(bn.id){var Qn,qn,mi;(nn==null||((Qn=nn.type)===null||Qn===void 0)?void 0:Qn.indexOf("image"))>-1?Ft.replaceSelection(".concat(bn.content_type,")")):(nn==null||((qn=nn.type)===null||qn===void 0)?void 0:qn.indexOf("video"))>-1?Ft.replaceSelection('<video width="100%" controls src="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,'"></video>')):(nn==null||((mi=nn.type)===null||mi===void 0)?void 0:mi.indexOf("pdf"))>-1?Ft.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,"?type=").concat(nn.type,'&disposition=inline" target="_blank">').concat(nn.name,"</a>")):re.includes(bi)?Ft.replaceSelection('<a href="'.concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,'?type=office&disposition=inline" target="_blank">').concat(nn.name,"</a>")):Ft.replaceSelection("[".concat(nn.name,"](").concat(c.a.API_SERVER,"/api/attachments/").concat(bn.id,"?type=").concat(bn.content_type,")"))}else(bn==null?void 0:bn.status)===401&&(document.location.href="/user/login")})},ln=0;ln<rn.length;ln++)Tn(ln)}}),ee(Ft),function(){Ft.off("paste",Xt)}}},[]);var Zn=Object(g.useCallback)(function(){if($t.current)try{}catch(Ft){console.log(Ft,"---- to set md editor body height")}},[Vn,$t,Tt]);Object(g.useEffect)(function(){function Ft(){var Kt=new s.default(function(tn){var rn=Object(M.a)(tn),Tn;try{for(rn.s();!(Tn=rn.n()).done;){var ln=Tn.value;(ln.target.offsetHeight>0||ln.target.offsetWidth>0)&&(Zn(),j.setSize("100%","100%"),j.refresh())}}catch(Un){rn.e(Un)}finally{rn.f()}});return Kt.observe(pt.current.parentElement),Kt}if(j){var Xt=Ft();return function(){Xt.unobserve(pt.current.parentElement)}}},[j,Zn]),Object(g.useEffect)(function(){if(j){for(var Ft=[],Xt=function(){var ln=tn[Kt];rn=Object(H.a)(ln,2);var Un=rn[0],ai=rn[1],nn=Object(F.a)({},Un,function(){Ki(ai)});Ft.push(nn),j.addKeyMap(nn)},Kt=0,tn=Object.entries(ae);Kt<tn.length;Kt++){var rn;Xt()}return Wt.current=setInterval(function(){yt.current&&sn()},4e3),function(){clearInterval(Wt.current);var Tn=Object(M.a)(Ft),ln;try{for(Tn.s();!(ln=Tn.n()).done;){var Un=ln.value;j.removeKeyMap(Un)}}catch(ai){Tn.e(ai)}finally{Tn.f()}}}},[j]),Object(g.useEffect)(function(){Cn!==Tt&&qt(Cn)},[Cn]),Object(kt.a)(function(){if(!cn&&xn>0){var Ft=new Date().getTime(),Xt=window.sessionStorage.getItem(ke);Ft>=xn+ze&&(!Xt||Xt!==Ve)&&(window.sessionStorage.setItem(ke,Ve),mn(!0))}},ze),Object(g.useEffect)(function(){Rt(Ke)},[j,Ke]),Object(g.useEffect)(function(){j&&(ve&&j.focus())},[j,ve]),Object(g.useEffect)(function(){if(mt&&j){var Ft=j.getScrollerElement();function Xt(Kt){var tn=Kt.target;if(Xn.current){var rn=tn.scrollTop/tn.scrollHeight;Xn.current.scrollTop=Xn.current.scrollHeight*rn}}return Ft.addEventListener("scroll",Xt),function(){Ft.removeEventListener("scroll",Xt)}}},[j,mt]),Object(g.useEffect)(function(){if(j&&Sn){function Ft(Xt,Kt){Sn(Xt,Kt)}return j.on("beforeChange",Ft),function(){j.off("beforeChange",Ft)}}},[j,Sn]),Object(g.useEffect)(function(){if(j&&Qt){function Ft(){Qt(j.getValue())}return j.on("blur",Ft),function(){j.off("blur",Ft)}}},[j,Qt]),Object(g.useEffect)(function(){if(j){function Ft(Xt){var Kt=Xt.getValue();ot(Kt),In(new Date().getTime()),Xt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ut&&ut(Kt)}return j.on("change",Ft),function(){j.off("change",Ft)}}},[j,ut]),Object(g.useEffect)(function(){j&&(Xe==null?(j.setValue(""),ot("")):Xe!==j.getValue()&&(j.setValue(Xe),ot(Xe),j.setCursor(j.lineCount(),0)))},[j,Xe]);var Ki=Object(g.useCallback)(function(Ft){var Xt=j.getCursor(),Kt=j.getSelection(),tn=Kt.split(`
|
|
`);switch(Ft){case"bold":return j.replaceSelection("**"+Kt+"**"),Kt===""&&j.setCursor(Xt.line,Xt.ch+2),j.focus();case"italic":return j.replaceSelection("*"+Kt+"*"),Kt===""&&j.setCursor(Xt.line,Xt.ch+1),j.focus();case"code":return j.replaceSelection("`"+Kt+"`"),Kt===""&&j.setCursor(Xt.line,Xt.ch+1),j.focus();case"inline-latex":return j.replaceSelection("`$$"+Kt+"$$`"),Kt===""&&j.setCursor(Xt.line,Xt.ch+3),j.focus();case"latex":return j.replaceSelection("```latex\n"+Kt+"\n```"),j.setCursor(Xt.line+1,Kt.length+1),j.focus();case"line-break":return j.replaceSelection(`<br/>
|
|
`),j.focus();case"list-ul":return Kt===""?j.replaceSelection("- "+Kt):j.replaceSelection(tn.map(function(rn){return rn===""?"":"- ".concat(rn)}).join(`
|
|
`)),j.focus();case"list-ol":return Kt===""?j.replaceSelection("1. "+Kt):j.replaceSelection(tn.map(function(rn,Tn){return rn===""?"":"".concat(Tn+1,". ").concat(rn)}).join(`
|
|
`)),j.focus();case"add-null-ch":return Kt===""&&j.setCursor(Xt.line,Xt.ch+1),j.replaceSelection(Re),j.focus();case"inster-template-1":return Kt===""&&j.setCursor(Xt.line,Xt.ch),j.replaceSelection(je),j.focus();case"eraser":return j.setValue(""),j.focus();case"trigger-watch":return Rt(!mt),j.focus();case"trigger-full-screen":return qt(!Tt),j.focus();case tt:wn(tt);return;case vt:wn(vt);return;case Je:wn(Je);return;case wt:wn(wt);return;default:throw new Error}},[j,mt,Tt]),Ci=Object(g.useCallback)(function(Ft){wn("");switch(Gt){case tt:var Xt=Ft.title,Kt=Ft.link;return j.replaceSelection("[".concat(Xt,"](").concat(Kt,")")),j.focus();case vt:var tn=Ft.language,rn=Ft.content;return j.replaceSelection(["```"+tn,rn,"```"].join(`
|
|
`)),j.focus();case Je:var Tn=Ft.src,ln=Ft.alt;return ln?j.replaceSelection(".concat(Tn,' "').concat(ln,'" )')):j.replaceSelection("")),j.focus();case wt:for(var Un=Ft.row,ai=Ft.col,nn=Ft.align,bi=`
|
|
`,bn=0;bn<Un;bn++){for(var Qn=[],qn=[],mi=0;mi<ai;mi++)bn===1&&qn.push(xt[nn]),Qn.push(" ");bn===1&&(bi+="| ".concat(qn.join(" | "),` |
|
|
`)),bi+="| ".concat(Qn.join(ai===1?"":" | "),` |
|
|
`)}return j.replaceSelection(bi+`
|
|
`),j.focus();default:throw new Error}},[j,Gt]),Vi=Object(g.useMemo)(function(){switch(Gt){case tt:return f.a.createElement(ne,{callback:Ci,onCancel:Ni});case vt:return f.a.createElement(le.b,{callback:Ci,onCancel:Ni});case Je:return f.a.createElement(he,{callback:Ci,onCancel:Ni});case wt:return f.a.createElement(Qe,{callback:Ci,onCancel:Ni});default:return null}},[Gt]);function Ni(){wn("")}Object(g.useEffect)(function(){if(Nt.current){var Ft=Nt.current,Xt=!1,Kt=0;function tn(ln){Xt=!0,Kt=ln.pageY}function rn(){Xt=!1}function Tn(ln){if(Xt){var Un=ln.pageY-Kt;Un<0&&(Un=0),Un>300&&(Un=300);var ai=Be+Un+"px";_n(ai)}}return Ft.addEventListener("mousedown",tn),document.addEventListener("mousemove",Tn),document.addEventListener("mouseup",rn),function(){Ft.removeEventListener("mousedown",tn),document.removeEventListener("mousemove",Tn),document.removeEventListener("mouseup",rn)}}},[j,Nt]),Object(g.useEffect)(function(){_n(Be)},[Be]);var Ri=ge(ft),Gi=ge(Vn),Kn={width:Ri,height:Gi},Ht=Object(g.useMemo)(function(){if(xn){var Ft=new Date(xn),Xt=Ft.getHours(),Kt=Ft.getMinutes(),tn=Ft.getSeconds();return Xt=Xt<10?"0"+Xt:Xt,Kt=Kt<10?"0"+Kt:Kt,tn=tn<10?"0"+tn:tn,"".concat(Xt,":").concat(Kt,":").concat(tn)}return 0},[xn]);function Xi(){window.sessionStorage.removeItem(ke),mn(!1),In(0)}function _i(){mn(!1),In(0),j.setValue(window.sessionStorage.getItem(ke))}function nr(Ft,Xt){var Kt=j.getValue();Kt=Kt.replace(Ft,Xt),ot(Kt),j==null||j.setValue(Kt)}return f.a.createElement(g.Fragment,null,f.a.createElement("div",{className:"markdown-editor-wrapper",ref:$t},f.a.createElement("div",{className:"markdown-editor-container ".concat(ct," ").concat(mt?"on-preview":""," ").concat(Me?"mini":""," ").concat(Tt?"full-screen":""),style:Kn},f.a.createElement(_,{insertTemp:Pe,watch:mt,fullScreen:Tt,showNullButton:en,onActionCallback:Ki,hidetoolBar:Rn,uuid:zt.current,setOpenPhones:function(){yt.current=!0}}),f.a.createElement("div",{className:"markdown-editor-body"},f.a.createElement("div",{className:"codemirror-container"},f.a.createElement("textarea",{ref:pt,placeholder:ui})),mt?f.a.createElement("div",{ref:Xn,className:"preview-container"},dt==="stex"&&f.a.createElement(A,{value:Ve}),dt!=="stex"&&f.a.createElement(x.a,{edit:!0,value:Ve,replaces:nr})):null))),Ct?f.a.createElement("a",{ref:Nt,className:"editor-resize"}):null,f.a.createElement(P.a,null,ue[Gt]?f.a.createElement(V.a,{centered:!0,title:ue[Gt],visible:!0,onCancel:Ni,footer:null,className:"markdown-popup-form"},Vi):null))}},PD8m:function(Fe,Se){Fe.exports={name:"memoryStorage",read:q,write:V,each:M,remove:z,clearAll:U};var W={};function q(L){return W[L]}function V(L,H){W[L]=H}function M(L){for(var H in W)W.hasOwnProperty(H)&&L(W[H],H)}function z(L){delete W[L]}function U(L){W={}}},QUZ3:function(Fe,Se,W){"use strict";W.r(Se);var q=W("0Owb"),V=W("PpiC"),M=W("OaEy"),z=W("2fM7"),U=W("T2oS"),L=W("W9HT"),H=W("+L6B"),F=W("2/Rp"),D=W("9og8"),I=W("2qtc"),g=W("kLXV"),f=W("tJVT"),u=W("k1fw"),d=W("aHsQ"),s=W("sGsY"),l=W("WmNS"),r=W.n(l),a=W("q1tI"),n=W.n(a),h=W("Icgb"),O=W("Fvcw"),S=W("GIiI"),x=W("Ty5D"),A=W("55Ip"),C=W("OJz4"),b=W("V0Rq"),v=W("bntm"),p=W("cDPC"),c=W("m3rI"),E=W("RCxd"),y=W("EHPI"),_=W("S+dL"),P=W.n(_),N=W("J66h"),K=W("uMZB"),$=W.n(K),B=W("p/48"),R=W("JPnl"),G=W("y8nQ"),Q=W("Vl3Y"),ne=W("5NDa"),le=W("5rEg"),_e=le.a.TextArea,pe=5e3,Ee=function(T){var j=T.callback,ee=T.onCancel,X=T.notes;function ye(Ve){j(Ve)}return n.a.createElement(Q.a,{className:"note-form-panel",onFinish:ye,initialValues:{notes:X}},n.a.createElement(Q.a.Item,{name:"notes",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9"},{max:pe,message:"\u7B14\u8BB0\u6700\u5927\u5B57\u6570\u4E3A".concat(pe)}]},n.a.createElement(_e,{placeholder:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9",rows:5})),n.a.createElement(Q.a.Item,{style:{textAlign:"right"}},n.a.createElement(F.a,{type:"ghost",onClick:ee,style:{marginRight:10}}," \u53D6\u6D88 "),n.a.createElement(F.a,{type:"primary",htmlType:"submit"}," \u63D0\u4EA4 ")))},Oe=W("bbsP"),we=W("/wGt"),he=W("DjyN"),oe=W("NUBc"),Le=W("H2Ag"),Ye=W.n(Le),nt=W("miYZ"),qe=W("tsqr"),it=W("g9YV"),He=W("wCAj"),$e=W("+k/U"),Qe=W.n($e),gt=W("ye1Q"),et=W("lfch"),tt=W("JB8y"),Je=W("p5ED"),vt=W("ErOA"),wt=W("wd/R"),Et=W.n(wt),xt=He.a.Column,kt=function(T){var j,ee=T.submitResult,X=T.submitting,ye=T.submitRecords,Ve=T.page,ot=T.onPageChange,ht=T.topicId,Ue=ee||{},mt=Ue.status,Rt=Ue.id,Mt=Ue.input,Jt=Ue.output,Tt=Ue.expected_output,qt=Ue.is_file,Zt=Ue.input_file_url,Mn=Ue.output_file_url,Gt=Ue.expected_output_file_url,wn=Ue.error_msg,On=ye||{},Ln=On.records,xn=On.records_count,In=Object(a.useState)(""),Hn=Object(f.a)(In,2),ri=Hn[0],Vn=Hn[1],_n=Object(a.useState)(""),jn=Object(f.a)(_n,2),dn=jn[0],pn=jn[1],mn=Object(x.h)(),zt=(mn==null||((j=mn.query)===null||j===void 0)?void 0:j.type)==="1";function yt(){qt?navigator.clipboard.writeText(N.Base64.decode(wn)).then(function(){qe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")}):navigator.clipboard.writeText(N.Base64.decode(Jt)).then(function(){qe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")})}return n.a.createElement(L.a,{spinning:X,tip:"\u8BC4\u6D4B\u4E2D...",indicator:n.a.createElement(gt.a,{style:{fontSize:24},spin:!0})},Rt?n.a.createElement(n.a.Fragment,null,n.a.createElement("ul",{className:Qe.a.info},n.a.createElement("li",null,"\u6267\u884C\u7ED3\u679C\uFF1A",n.a.createElement("span",{className:mt===tt.a.OK?"c-green":"c-red"},R.a[mt])),n.a.createElement("li",{className:Qe.a.error},n.a.createElement("a",{onClick:yt},"\u590D\u5236\u9519\u8BEF\u4FE1\u606F ",n.a.createElement(et.a,null)," ")),n.a.createElement("li",null,n.a.createElement(A.a,{to:"/myproblems/".concat(ht,"/record-detail/").concat(Rt)},"\u663E\u793A\u8BE6\u60C5 >"," "))),mt!==tt.a.OK?n.a.createElement(n.a.Fragment,null,n.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),n.a.createElement("pre",null,!qt&&Mt,qt&&n.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(D.a)(r.a.mark(function Wt(){var pt;return r.a.wrap(function(Nt){for(;;)switch(Nt.prev=Nt.next){case 0:return Nt.next=2,fetch(Zt,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return pt=Nt.sent,Nt.t0=pn,Nt.next=6,pt.text();case 6:Nt.t1=Nt.sent,(0,Nt.t0)(Nt.t1),setTimeout(function(){Vn(Zt)},200);case 9:case"end":return Nt.stop()}},Wt)}))},Mt)),n.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),n.a.createElement("pre",null,(mt===4||mt===5)&&N.Base64.decode(wn),mt!=4&&mt!=5&&(qt?n.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(D.a)(r.a.mark(function Wt(){var pt;return r.a.wrap(function(Nt){for(;;)switch(Nt.prev=Nt.next){case 0:return Nt.next=2,Object(vt.a)(Mn,{method:"Get",headers:{"Content-Type":"application/xml",Accept:"*/*"}});case 2:pt=Nt.sent;try{pn(pt)}catch(Xn){pn("")}setTimeout(function(){Vn(Mn)},200);case 5:case"end":return Nt.stop()}},Wt)}))},Jt):N.Base64.decode(Jt))),n.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),n.a.createElement("pre",null,!qt&&N.Base64.decode(Tt),qt&&n.a.createElement("a",{style:{fontSize:"16px"},onClick:Object(D.a)(r.a.mark(function Wt(){var pt;return r.a.wrap(function(Nt){for(;;)switch(Nt.prev=Nt.next){case 0:return Nt.next=2,fetch(Gt,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return pt=Nt.sent,Nt.t0=pn,Nt.next=6,pt.text();case 6:Nt.t1=Nt.sent,(0,Nt.t0)(Nt.t1),setTimeout(function(){Vn(Gt)},200);case 9:case"end":return Nt.stop()}},Wt)}))},Tt))):null):null,(Ln==null?void 0:Ln.length)>0?n.a.createElement(He.a,{dataSource:Ln,rowKey:"id",pagination:!1},n.a.createElement(xt,{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"created_at",key:"created_at",render:function(pt,$t){return n.a.createElement("span",null," ",Et()(pt).format("YYYY-MM-DD HH:mm:ss"))}}),n.a.createElement(xt,{title:"\u63D0\u4EA4\u7ED3\u679C",dataIndex:"status",key:"status",render:function(pt,$t){var Nt;return n.a.createElement(A.a,{className:pt===0?"c-green":"c-red",to:"/myproblems/".concat(ht,"/record-detail/").concat($t.id)},(Nt=R.a[pt])===null||Nt===void 0?void 0:Nt.replace("\u8C03\u8BD5","\u8BC4\u6D4B"))}}),n.a.createElement(xt,{title:"\u6267\u884C\u7528\u65F6 (".concat(zt?"MS":"S",")"),dataIndex:"execute_time",key:"execute_time",render:function(pt){return pt?zt?pt:pt/1e3:""}}),n.a.createElement(xt,{title:"\u5185\u5B58\u6D88\u8017\uFF08".concat(zt?"KB":"MB","\uFF09"),dataIndex:"execute_memory",key:"execute_memory",render:function(pt){return pt?zt?pt:parseFloat((pt/1024).toFixed(2)):""}}),n.a.createElement(xt,{title:"\u8BED\u8A00",dataIndex:"language",key:"language"}),n.a.createElement(xt,{title:"\u64CD\u4F5C",dataIndex:"status",key:"status",render:function(pt,$t){return n.a.createElement(A.a,{className:"c-light-primary",to:"/myproblems/".concat(ht,"/record-detail/").concat($t.id)},"\u67E5\u770B")}})):n.a.createElement("div",{style:{height:300,width:"100%"}}),xn>15?n.a.createElement(oe.a,{className:Qe.a.pagination,current:Ve,pageSize:15,total:xn,onChange:ot}):null,n.a.createElement(Je.a,{close:!0,data:ri,type:ri.length?"txt":"",onClose:function(){return Vn("")},monacoEditor:{value:dn,language:"txt",onChange:function(){},options:{fontSize:14,readOnly:!0,minimap:{enabled:!1}}}}))},Ot=W("BdwD"),Ae=W("DYRE"),Ce=W("zeV3"),Ge=W("+BJd"),ze=W("mr32"),Re=W("pPuO"),je=W.n(Re),ge=W("9Bee"),de={1:{name:"\u7B80\u5355",color:"#52c41a"},2:{name:"\u4E2D\u7B49",color:"#faad14"},3:{name:"\u56F0\u96BE",color:"#f5222d"}},ce=function(T){var j=T.hack,ee=T.onTriggerPraise,X=T.toDiscuss,ye=j.language,Ve=j.difficult,ot=j.time_limit,ht=j.username,Ue=j.user_path,mt=j.user_praise,Rt=j.comments_count,Mt=j.praises_count,Jt=j.description,Tt=j.pass_count,qt=j.submit_count,Zt=Object(x.h)(),Mn=de[Ve];return n.a.createElement(n.a.Fragment,null,n.a.createElement("ul",{className:je.a.info},n.a.createElement("li",null,"\u7F16\u7A0B\u8BED\uFF1A",n.a.createElement("b",null,ye)),n.a.createElement("li",null,"\u96BE\u5EA6\uFF1A",n.a.createElement(ze.a,{color:Mn.color},Mn.name)),n.a.createElement("li",null,"\u8BC4\u6D4B\u65F6\u957F\u9650\u5236\uFF1A",n.a.createElement("b",null,ot,"\u79D2"))),n.a.createElement(ge.a,{value:Jt,className:je.a.desc}),n.a.createElement("ul",{className:je.a["commit-info"]},n.a.createElement("li",null,n.a.createElement(Ce.a,{size:4},n.a.createElement("span",null,"\u901A\u8FC7\u6B21\u6570")," ",n.a.createElement("b",null,Tt))),n.a.createElement("li",null,n.a.createElement(Ce.a,{size:4},n.a.createElement("span",null,"\u63D0\u4EA4\u6B21\u6570")," ",n.a.createElement("b",null,qt))," "),n.a.createElement("li",{style:{flex:"1 0 0"}}),Zt.query.type!=="exercises"&&n.a.createElement("li",null,n.a.createElement(Ce.a,{size:4},n.a.createElement("i",{className:"iconfont icon-huifu1",onClick:X})," ",n.a.createElement("b",null,Rt))," ")))},re=W("dhSg"),ae=W("oBTY"),ue=W("M8RZ"),fe=W("qJ4+");function be(T,j){return Object(vt.c)("/problems/".concat(T,"/comments.json?page=").concat(j,"&limit=10"))}function Ie(T){return Object(vt.f)("/discusses/".concat(T,"/plus.json"),{container_type:"Discuss",type:1})}function Xe(T,j,ee){return Object(vt.f)("/problems/".concat(T,"/comments/reply.json"),{comments:{content:ee,parent_id:j}})}function ut(T,j){return Object(vt.f)("/problems/".concat(T,"/comments.json"),{comments:{content:j}})}function bt(T,j,ee){return Object(vt.f)("/problems/".concat(T,"/comments/").concat(j,"/hidden.json"),ee)}function ft(T,j){return Object(vt.b)("/problems/".concat(T,"/comments/").concat(j))}var at=W("U7T7"),Be=W("AMnG");function We(T){var j=T.author;return n.a.createElement("a",{href:"/users/".concat(j.login),target:"_blank"},n.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"50",style:{borderRadius:"50%"},src:"".concat(c.a.IMG_SERVER,"/images/").concat(j.image_url),width:"50"}))}function Me(T){var j=T.data,ee=T.index,X=T.parentDiscussIndex,ye=T.user,Ve=T.onSetActionType,ot=j.author,ht=j.can_delete,Ue=j.content,mt=j.id,Rt=j.time;function Mt(){Ve({id:mt,index:ee,type:"delete-discuss",parentDiscussIndex:X,message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}var Jt=ye.admin||ht||ot.user_id===ye.user_id;return n.a.createElement("div",{className:"discuss-item-container second-discuss "},n.a.createElement(We,{author:ot}),n.a.createElement("section",null,n.a.createElement("div",{className:"discuss-info"},n.a.createElement("a",{href:"/users/".concat(ot.login),target:"_blank"},ot.name),n.a.createElement("span",{className:"grey"},Rt),n.a.createElement("div",{className:"btn-group",style:{marginBottom:0}},Jt?n.a.createElement("a",{onClick:Mt,title:"\u5220\u9664"},n.a.createElement("i",{className:"iconfont icon-shanchu"})):null)),n.a.createElement(ge.a,{className:"discuss-content",value:Ue})))}var se=function(T){var j=T.user,ee=T.data,X=T.index,ye=T.onPlusDiscuss,Ve=T.onSetActionType,ot=T.activeDiscussIndex,ht=T.onReplyDiscuss,Ue=T.onSetActiveDiscussIndex,mt=ee.content,Rt=ee.children,Mt=ee.hidden,Jt=ee.id,Tt=ee.praise_count,qt=ee.time,Zt=ee.user_praise,Mn=ee.can_delete,Gt=ee.author;function wn(){Ue(Jt)}function On(){ye(Jt,!Zt,X)}function Ln(){Ve({id:Jt,index:X,type:"delete-discuss",message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}function xn(){Ve({id:Jt,index:X,params:{hidden:Mt?"0":"1"},type:"hidden-discuss",message:Mt?"\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417":"\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"})}var In=j.admin||j.user_id===Gt.user_id;return n.a.createElement("div",{className:"discuss-item-container",key:Jt},n.a.createElement(We,{author:Gt}),n.a.createElement("section",null,n.a.createElement("div",{className:"discuss-info"},n.a.createElement("a",{href:"/users/".concat(Gt.login),target:"_blank"}," ",Gt.name," "),n.a.createElement("span",{className:"grey"},qt)),n.a.createElement(ge.a,{className:"discuss-content",value:mt}),Rt&&Rt.length>0?n.a.createElement("div",{className:"reply-discuss-container"},Rt.map(function(Hn,ri){return n.a.createElement(Me,{key:Hn.id,data:Hn,index:ri,user:j,onSetActionType:Ve,parentDiscussIndex:X})})):null,n.a.createElement("div",{className:"btn-group"},In?n.a.createElement("a",{onClick:xn,title:Mt?"\u53D6\u6D88\u9690\u85CF":"\u9690\u85CF\u8BC4\u8BBA"},n.a.createElement("i",{className:Mt?"iconfont icon-yincangbiyan":"fa fa-eye"})):null,Mn&&(!Rt||Rt.length==0)?n.a.createElement("a",{onClick:Ln,title:"\u5220\u9664"},n.a.createElement("i",{className:"iconfont icon-shanchu"})):null,n.a.createElement("a",{onClick:wn,title:"\u56DE\u590D"}," ",n.a.createElement("i",{className:"iconfont icon-huifu1"})," "),n.a.createElement("a",{onClick:On,className:Zt?"c-orange":""},n.a.createElement("i",{className:Zt?"iconfont icon-dianzan mr3":"iconfont icon-dianzan-xian mr3 "}),n.a.createElement("span",null,Tt||""))),n.a.createElement(Be.a,{id:Jt,activeDiscussIndex:ot,onReplyDiscuss:ht})))},ve=W("kaH+"),Ke=W("uD2n"),Pe=W.n(Ke),st=W("Ot1p"),dt=function(T){var j=T.user_praise,ee=T.praise_count,X=T.praisePlus,ye=T.onCreateDiscuss,Ve=T.discuss_count,ot=Object(a.useState)(!1),ht=Object(f.a)(ot,2),Ue=ht[0],mt=ht[1],Rt=Object(a.useState)(""),Mt=Object(f.a)(Rt,2),Jt=Mt[0],Tt=Mt[1];function qt(On){Tt(On)}function Zt(){mt(!0)}function Mn(){mt(!1)}function Gt(){return wn.apply(this,arguments)}function wn(){return wn=Object(D.a)(r.a.mark(function On(){return r.a.wrap(function(xn){for(;;)switch(xn.prev=xn.next){case 0:ye(Jt),Tt(""),mt(!1);case 3:case"end":return xn.stop()}},On)})),wn.apply(this,arguments)}return n.a.createElement("div",{className:"".concat(Pe.a["dis-input-editor-container"]," ").concat(Ue?Pe.a.active:""," ")},n.a.createElement("div",{className:Ue?"hide ".concat(Pe.a["text-area"]):Pe.a["text-area"]},n.a.createElement("input",{placeholder:"\u8BF4\u70B9\u4EC0\u4E48",onClick:Zt}),n.a.createElement("a",null," ",n.a.createElement("i",{className:"iconfont icon-huifu1"})," \xA0 \xA0",Ve," "),n.a.createElement("a",{className:"c-light-black",onClick:X,title:j?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},n.a.createElement("i",{className:"mr3 ".concat(j?"iconfont icon-dianzan c-orange":"iconfont icon-dianzan-xian"," ")}),ee?n.a.createElement("span",null,ee):"")),Ue?n.a.createElement("div",{className:Pe.a["input-mask"],onClick:Mn}):null,n.a.createElement("div",{className:Ue?Pe.a["md-container"]:"".concat(Pe.a["md-container"]," hide")},n.a.createElement(st.a,{id:"discuss-input-editor",miniToolbar:!0,watch:!1,noStorage:!0,defaultValue:Jt,height:240,onChange:qt}),n.a.createElement("div",{className:Pe.a["tip-container"],onClick:Mn},n.a.createElement("a",{className:Pe.a["btn-send"],onClick:Gt}," \u53D1\u9001 "))))},Te={loading:!1,page:1,data:[],count:0,actionType:null,activeDiscussIndex:null},ke;(function(T){T[T.GET_DISCUSSES=0]="GET_DISCUSSES",T[T.TOP_OR_DOWN_DISCUSS=1]="TOP_OR_DOWN_DISCUSS",T[T.ACTIVE_DISCUSS_INDEX=2]="ACTIVE_DISCUSS_INDEX",T[T.PLUS_DISCUSS=3]="PLUS_DISCUSS",T[T.SET_ACTION_TYPE=4]="SET_ACTION_TYPE",T[T.SET_PAGE=5]="SET_PAGE",T[T.SHOW_DISCUSSES_LOADING=6]="SHOW_DISCUSSES_LOADING"})(ke||(ke={}));function rt(T,j){switch(j.type){case ke.SHOW_DISCUSSES_LOADING:return Object(u.a)(Object(u.a)({},T),{},{loading:!0});case ke.GET_DISCUSSES:return Object(u.a)(Object(u.a)({},T),j.payload);case ke.TOP_OR_DOWN_DISCUSS:return Object(u.a)(Object(u.a)({},T),j.payload);case ke.SET_ACTION_TYPE:return Object(u.a)(Object(u.a)({},T),j.payload);case ke.PLUS_DISCUSS:return Object(u.a)(Object(u.a)({},T),j.payload);case ke.SET_PAGE:return Object(u.a)(Object(u.a)({},T),{},{page:j.payload});case ke.ACTIVE_DISCUSS_INDEX:return Object(u.a)(Object(u.a)({},T),j.payload);default:throw new Error}}var Ct=function(T){var j=T.user,ee=T.identifier,X=T.hack,ye=T.onTriggerPraise,Ve=Object(a.useReducer)(rt,Te),ot=Object(f.a)(Ve,2),ht=ot[0],Ue=ot[1],mt=ht.loading,Rt=ht.page,Mt=ht.data,Jt=ht.count,Tt=ht.actionType,qt=ht.activeDiscussIndex,Zt=Object(a.useCallback)(Object(D.a)(r.a.mark(function dn(){var pn,mn,zt;return r.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:return Ue({type:ke.SHOW_DISCUSSES_LOADING}),Wt.next=3,be(ee,Rt);case 3:pn=Wt.sent,mn=pn.comments,zt=pn.disscuss_count,Ue({type:ke.GET_DISCUSSES,payload:{data:mn,count:zt,loading:!1}});case 6:case"end":return Wt.stop()}},dn)})),[Rt,ee]);Object(a.useEffect)(function(){Zt()},[ee,Rt]);function Mn(dn){Ue({type:ke.SET_PAGE,page:dn})}function Gt(dn){Ue({type:ke.SET_ACTION_TYPE,payload:{actionType:dn}})}function wn(dn){qt===dn?Ue({type:ke.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:null}}):Ue({type:ke.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:dn}})}function On(dn,pn,mn){return Ln.apply(this,arguments)}function Ln(){return Ln=Object(D.a)(r.a.mark(function dn(pn,mn,zt){var yt;return r.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.prev=0,pt.next=3,Ie(pn);case 3:yt=pt.sent,Mt[zt].user_praise=mn,Mt[zt].praise_count=yt.praise_count,Ue({type:ke.PLUS_DISCUSS,payload:{data:Object(ae.a)(Mt)}}),pt.next=12;break;case 9:pt.prev=9,pt.t0=pt.catch(0),console.log(pt.t0);case 12:case"end":return pt.stop()}},dn,null,[[0,9]])})),Ln.apply(this,arguments)}function xn(){return In.apply(this,arguments)}function In(){return In=Object(D.a)(r.a.mark(function dn(){var pn,mn,zt,yt,Wt,pt,$t,Nt;return r.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:if(pn=Tt.id,mn=Tt.params,zt=Tt.type,yt=Tt.index,Wt=Tt.parentDiscussIndex,!(zt==="hidden-discuss")){sn.next=6;break}return sn.next=4,bt(ee,pn,mn);case 4:Wt?Mt[Wt].children[yt].hidden=mn.hidden==1:Mt[yt].hidden=mn.hidden==1,Ue({type:ke.SET_ACTION_TYPE,payload:{actionType:null,data:Object(ae.a)(Mt)}});case 6:if(!(zt==="delete-discuss")){sn.next=31;break}return sn.next=9,ft(ee,pn);case 9:if(!(Wt||Wt===0)){sn.next=22;break}pt=Mt[Wt].children,$t=pt.length-1;case 12:if(!($t>=0)){sn.next=19;break}if(!(pt[$t].id===pn)){sn.next=16;break}return pt.splice($t,1),sn.abrupt("break",19);case 16:$t--,sn.next=12;break;case 19:Mt[Wt].children=pt,sn.next=30;break;case 22:Nt=Mt.length-1;case 23:if(!(Nt>=0)){sn.next=30;break}if(!(Mt[Nt].id===pn)){sn.next=27;break}return Mt.splice(Nt,1),sn.abrupt("break",30);case 27:Nt--,sn.next=23;break;case 30:Ue({type:ke.SET_ACTION_TYPE,payload:{actionType:null,data:Object(ae.a)(Mt)}});case 31:case"end":return sn.stop()}},dn)})),In.apply(this,arguments)}function Hn(){Ue({type:ke.SET_ACTION_TYPE,payload:{actionType:null}})}function ri(dn,pn){return Vn.apply(this,arguments)}function Vn(){return Vn=Object(D.a)(r.a.mark(function dn(pn,mn){return r.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return yt.prev=0,yt.next=3,Xe(ee,pn,mn);case 3:Zt(),yt.next=9;break;case 6:yt.prev=6,yt.t0=yt.catch(0),console.log(yt.t0);case 9:case"end":return yt.stop()}},dn,null,[[0,6]])})),Vn.apply(this,arguments)}function _n(dn){return jn.apply(this,arguments)}function jn(){return jn=Object(D.a)(r.a.mark(function dn(pn){return r.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return Ue({type:ke.SHOW_DISCUSSES_LOADING}),zt.next=3,ut(ee,pn);case 3:Zt();case 4:case"end":return zt.stop()}},dn)})),jn.apply(this,arguments)}return n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"discuss-panel"},Mt.length===0?n.a.createElement(Ot.a,null):Mt.map(function(dn,pn){return n.a.createElement(se,{onReplyDiscuss:ri,onPlusDiscuss:On,onSetActiveDiscussIndex:wn,onSetActionType:Gt,data:dn,index:pn,user:j,activeDiscussIndex:qt})}),Jt>10?n.a.createElement("div",{className:"pagination-container"},n.a.createElement(oe.a,{showQuickJumper:!0,onChange:Mn,current:Rt,total:Jt})):null),n.a.createElement(dt,{user_praise:X.user_praise,praise_count:X.praises_count,praisePlus:ye,discuss_count:X.comments_count,onCreateDiscuss:_n}),n.a.createElement(ue.a,null,n.a.createElement(g.a,{centered:!0,title:"\u63D0\u793A",visible:!!Tt,onOk:xn,onCancel:Hn},n.a.createElement("p",null,Tt?Tt.message:"")),n.a.createElement(ve.a,null)))},At=W("9kvl"),cn={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},yn={1:"#2fa34f",2:"#0152d9",3:"#fa6400"},en=function(T){var j,ee=T.hack,X=T.onTriggerPraise,ye=T.topicId,Ve=T.page,ot=T.onPageChange,ht=T.user,Ue=T.submitRecords,mt=T.submitting,Rt=T.submitResult,Mt=Object(a.useState)("0"),Jt=Object(f.a)(Mt,2),Tt=Jt[0],qt=Jt[1],Zt=Object(x.h)(),Mn=Object(a.useState)(!1),Gt=Object(f.a)(Mn,2),wn=Gt[0],On=Gt[1],Ln=Object(a.useState)([]),xn=Object(f.a)(Ln,2),In=xn[0],Hn=xn[1],ri=Object(a.useState)(Object(u.a)(Object(u.a)({},Object(x.i)()),{},{page:1,per_page:20,name:""})),Vn=Object(f.a)(ri,2),_n=Vn[0],jn=Vn[1];function dn(yt){var Wt=yt.target.id;qt(Wt)}Object(a.useEffect)(function(){var yt=re.a.subscribe("to-commit-info",function(){qt("1")});return yt},[]);function pn(){qt("2")}function mn(){return zt.apply(this,arguments)}function zt(){return zt=Object(D.a)(r.a.mark(function yt(){var Wt;return r.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(vt.a)("/api/problems/my_hack_list.json",{method:"get",params:Object(u.a)({identifier:_n==null?void 0:_n.id},_n)});case 2:Wt=$t.sent,Hn(Wt);case 4:case"end":return $t.stop()}},yt)})),zt.apply(this,arguments)}return console.log(Ue,"submitRecords"),n.a.createElement("div",{className:Ye.a["left-panel"]},n.a.createElement("ul",{className:"".concat(Ye.a["s-navs"]," ").concat(Ye.a["bg-white"]," ").concat(Ye.a.b1)},n.a.createElement("li",null,n.a.createElement("a",{className:Tt==="0"?Ye.a.active:"",id:"0",onClick:dn},"\u4EFB\u52A1\u63CF\u8FF0")),n.a.createElement("li",null,n.a.createElement("a",{className:Tt==="1"?Ye.a.active:"",id:"1",onClick:dn},"\u63D0\u4EA4\u8BB0\u5F55")),Zt.query.type!=="exercises"&&n.a.createElement("li",null,n.a.createElement("a",{className:Tt==="2"?Ye.a.active:"",id:"2",onClick:dn},"\u8BC4\u8BBA"))),n.a.createElement("div",{className:"".concat(Ye.a["tab-panel-body"]," ").concat(Tt==="0"?"":"hide")},n.a.createElement(ce,{hack:ee,onTriggerPraise:X,toDiscuss:pn})),n.a.createElement("div",{style:{padding:"0 12px"},className:"".concat(Ye.a["tab-panel-body"]," ").concat(Tt==="1"?"":"hide")},!!(Ue!=null&&Ue.records_count)||mt?n.a.createElement(kt,{page:Ve,onPageChange:ot,topicId:ye,submitting:mt,submitRecords:Ue,submitResult:Rt}):n.a.createElement(Ot.a,null)),n.a.createElement("div",{className:"".concat(Ye.a["tab-panel-body"]," ").concat(Tt==="2"?"":"hide"),style:{padding:0}},n.a.createElement(Ct,{user:ht,identifier:ee.identifier,hack:ee,onTriggerPraise:X})),n.a.createElement(we.a,{className:Ye.a.drawer,headerStyle:{background:"#000",border:0},closable:!1,title:n.a.createElement("div",{style:{display:"flex",alignItems:"center"}},n.a.createElement("span",{style:{color:"#fff"}},"\u9898\u76EE\u5217\u8868"),n.a.createElement(le.a.Search,{onSearch:function(Wt){_n.name=Wt,_n.page=1,jn(Object(u.a)({},_n)),mn()},style:{width:180,margin:"0px 20px",marginLeft:"auto"},placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u641C\u7D22"}),n.a.createElement(z.a,{style:{width:100},placeholder:"\u8BF7\u9009\u62E9\u96BE\u5EA6",onChange:function(Wt){_n.page=1,_n.difficult=Wt||null,jn(Object(u.a)({},_n)),mn()}},n.a.createElement(z.a.Option,{value:0},"\u5168\u90E8"),n.a.createElement(z.a.Option,{value:1},"\u7B80\u5355"),n.a.createElement(z.a.Option,{value:2},"\u9002\u4E2D"),n.a.createElement(z.a.Option,{value:3},"\u56F0\u96BE"))),bodyStyle:{background:"#0f1e31",padding:"20px 0px"},footerStyle:{background:"#0f1e31",border:0,textAlign:"center"},footer:n.a.createElement("div",null,n.a.createElement(oe.a,{current:_n.page,className:"mt10 mb10",hideOnSinglePage:!0,total:In==null?void 0:In.count,pageSize:_n.per_page,onChange:function(Wt,pt){_n.page=Wt,_n.per_page=pt,mn()}})),width:530,placement:"left",onClose:function(){return On(!1)},visible:wn},In==null||((j=In.data)===null||j===void 0)?void 0:j.map(function(yt,Wt){return n.a.createElement("div",{onClick:Object(D.a)(r.a.mark(function pt(){var $t;return r.a.wrap(function(Xn){for(;;)switch(Xn.prev=Xn.next){case 0:return Xn.next=2,Object(vt.a)("/api/problems/".concat(yt==null?void 0:yt.identifier,"/start.json"),{method:"get",params:{hack_user_id:ht==null?void 0:ht.user_id}});case 2:$t=Xn.sent,$t&&(At.d.replace("/myproblems/".concat($t==null?void 0:$t.identifier,"?type=1")),window.location.reload());case 4:case"end":return Xn.stop()}},pt)})),className:"".concat(Ye.a.list," ").concat(yt!=null&&yt.checked?Ye.a.active:"")},n.a.createElement("div",null,(yt==null?void 0:yt.opened)&&(yt==null?void 0:yt.passed)&&n.a.createElement("i",{className:"iconfont icon-wancheng1 c-green-29b"}),(yt==null?void 0:yt.opened)&&!(yt!=null&&yt.passed)&&n.a.createElement("i",{className:"iconfont icon-cuowu c-red"}),n.a.createElement("span",{style:{color:"rgb(186, 196, 205)",fontWeight:400,fontSize:14,marginLeft:10}},yt.name)),n.a.createElement("span",{style:{color:yn[yt.difficult]}},cn[yt.difficult]))})),(ee==null?void 0:ee.is_program)&&n.a.createElement("div",{onClick:function(){mn(),On(!0)},className:Ye.a.btns},n.a.createElement("i",{className:"iconfont icon-timuliebiao"}),n.a.createElement("span",null,"\u9898\u76EE\u5217\u8868")))},Dt=W("oFv4"),Rn=W.n(Dt),Fn=W("+aKw"),Cn=W("S/kP"),Qt=W.n(Cn),Sn=W("t/PP"),Bn=W.n(Sn),li=s.a.Countdown,ct={Java:"java",C:"c",Python:"py","C++":"c"},St;(function(T){T[T.SET_LOADING=0]="SET_LOADING",T[T.GET_DATA=1]="GET_DATA",T[T.GET_SUBMIT_RECORDS=2]="GET_SUBMIT_RECORDS",T[T.SET_DATA=3]="SET_DATA",T[T.SET_DEBUGING=4]="SET_DEBUGING",T[T.SET_SUBMITING=5]="SET_SUBMITING",T[T.SET_EXECUTE_MESSAGE=6]="SET_EXECUTE_MESSAGE",T[T.SET_EXECUTE_RESULT=7]="SET_EXECUTE_RESULT",T[T.SET_SUBMIT_RESULT=8]="SET_SUBMIT_RESULT",T[T.SET_SHOW_NOTE=9]="SET_SHOW_NOTE",T[T.SET_PAGE=10]="SET_PAGE"})(St||(St={}));function zn(){return new Date().getTime()}var pi={loading:!0,data:void 0,showNote:!1,debugResult:void 0,submitResult:void 0,debuging:!1,submitting:!1,submitRecords:void 0,submitRecordPage:1,executingMessage:""};function ui(T,j){switch(j.type){case St.GET_DATA:return Object(u.a)(Object(u.a)({},T),j.payload);case St.SET_DATA:return Object(u.a)(Object(u.a)({},T),{},{data:j.payload});case St.SET_LOADING:return Object(u.a)(Object(u.a)({},T),{},{loading:j.payload});case St.SET_SHOW_NOTE:return Object(u.a)(Object(u.a)({},T),{},{showNote:j.payload});case St.SET_DEBUGING:return Object(u.a)(Object(u.a)({},T),{},{debuging:j.payload});case St.SET_SUBMITING:return Object(u.a)(Object(u.a)({},T),{},{submitting:j.payload});case St.GET_SUBMIT_RECORDS:return Object(u.a)(Object(u.a)({},T),{},{submitRecords:j.payload});case St.SET_PAGE:return Object(u.a)(Object(u.a)({},T),{},{submitRecordPage:j.payload});case St.SET_EXECUTE_MESSAGE:return Object(u.a)(Object(u.a)({},T),{},{executingMessage:j.payload});case St.SET_EXECUTE_RESULT:return Object(u.a)(Object(u.a)({},T),j.payload);case St.SET_SUBMIT_RESULT:return Object(u.a)(Object(u.a)({},T),j.payload);default:throw new Error}}var ki=Se.default=function(T){var j,ee,X,ye,Ve=T.children,ot=Object(a.useReducer)(ui,pi),ht=Object(f.a)(ot,2),Ue=ht[0],mt=ht[1],Rt=Object(x.i)(),Mt=Rt.id,Jt=Object(x.g)(),Tt=Object(x.h)(),qt=Ue.loading,Zt=Ue.data,Mn=Ue.debugResult,Gt=Ue.submitResult,wn=Ue.submitRecords,On=Ue.submitRecordPage,Ln=Ue.showNote,xn=Ue.debuging,In=Ue.submitting,Hn=Ue.executingMessage,ri=Object(a.useState)("#FFF"),Vn=Object(f.a)(ri,2),_n=Vn[0],jn=Vn[1],dn=Object(a.useState)(null),pn=Object(f.a)(dn,2),mn=pn[0],zt=pn[1],yt=Object(a.useState)({}),Wt=Object(f.a)(yt,2),pt=Wt[0],$t=Wt[1],Nt=Object(a.useState)(!0),Xn=Object(f.a)(Nt,2),sn=Xn[0],Zn=Xn[1],Ki=Object(a.useState)(!1),Ci=Object(f.a)(Ki,2),Vi=Ci[0],Ni=Ci[1],Ri=Object(a.useRef)(null),Gi=Object(a.useRef)(0),Kn=Zt==null?void 0:Zt.user,Ht=Zt==null?void 0:Zt.hack,Xi=Object(a.useRef)(),_i=Object(a.useRef)();Object(a.useEffect)(function(){var on;if(clearTimeout(Xi.current),clearTimeout(_i.current),pt!=null&&(on=pt.exercise)!==null&&on!==void 0&&on.left_time){var Bt,an;if((pt==null||((Bt=pt.exercise)===null||Bt===void 0)?void 0:Bt.left_time)>1800){var Pt;_i.current=setTimeout(function(){g.a.info({content:"\u5F53\u524D\u8DDD\u79BB\u8003\u8BD5\u7ED3\u675F\u8FD8\u670930\u5206\u949F",icon:n.a.createElement(h.a,null),okText:"\u77E5\u9053\u4E86"})},((pt==null||((Pt=pt.exercise)===null||Pt===void 0)?void 0:Pt.left_time)-1800)*1e3)}if((pt==null||((an=pt.exercise)===null||an===void 0)?void 0:an.left_time)>900){var fn;Xi.current=setTimeout(function(){g.a.info({content:"\u5F53\u524D\u8DDD\u79BB\u8003\u8BD5\u7ED3\u675F\u8FD8\u670915\u5206\u949F",icon:n.a.createElement(h.a,null),okText:"\u77E5\u9053\u4E86"})},((pt==null||((fn=pt.exercise)===null||fn===void 0)?void 0:fn.left_time)-900)*1e3)}}},[pt]),Object(a.useEffect)(function(){function on(){return Bt.apply(this,arguments)}function Bt(){return Bt=Object(D.a)(r.a.mark(function an(){var Pt,fn,Pn,ei,Si,ti,vn,kn,Yi,Fi,$n,vi;return r.a.wrap(function(oi){for(;;)switch(oi.prev=oi.next){case 0:return Zn(!0),oi.next=3,Object(C.d)(Mt);case 3:if(Pt=oi.sent,setTimeout(function(){Zn(!1)},800),Pt.status===401)document.location.href="/user/login";else{try{Pt.hack.code=N.Base64.decode(Pt.hack.code)}catch(zi){console.log(zi)}Pt.hack=Object(u.a)(Object(u.a)({},Pt.hack),{},{is_program:(Tt==null||((fn=Tt.query)===null||fn===void 0)?void 0:fn.type)==="1"}),mt({type:St.GET_DATA,payload:{loading:!1,data:Pt}})}if(!(Tt.query.type==="exercises")){oi.next=18;break}if(!(Tt.query.coursesId=="coursesId")){oi.next=13;break}return oi.next=10,Object(b.Y)({categoryId:Tt.query.exercisesId,login:Tt.query.login});case 10:ti=oi.sent,oi.next=16;break;case 13:return oi.next=15,Object(b.z)({categoryId:Tt.query.exercisesId,login:Tt.query.login});case 15:ti=oi.sent;case 16:$t(Object(u.a)({},ti)),(Pn=ti)!==null&&Pn!==void 0&&Pn.left_banner_id&&(ei=ti)!==null&&ei!==void 0&&(Si=ei.exercise)!==null&&Si!==void 0&&Si.left_time&&(zt(Date.now()+((vn=ti)===null||vn===void 0||((kn=vn.exercise)===null||kn===void 0)?void 0:kn.left_time)*1e3),setTimeout(function(){jn("red")},(((Yi=ti)===null||Yi===void 0||((Fi=Yi.exercise)===null||Fi===void 0)?void 0:Fi.left_time)-300>0?(($n=ti)===null||$n===void 0||((vi=$n.exercise)===null||vi===void 0)?void 0:vi.left_time)-300:0)*1e3));case 18:case"end":return oi.stop()}},an)})),Bt.apply(this,arguments)}Mt&&on()},[Mt]),Object(a.useEffect)(function(){return Tt.query.type==="exercises"&&(window.addEventListener(Object(v.c)(),Ft),window.focus(),window.onblur=function(){Object(v.a)()&&Object(v.b)()}),function(){document.removeEventListener(Object(v.c)(),Ft)}},[Mt]),Object(a.useEffect)(function(){Mt&&Ht!==null&&Ht!==void 0&&Ht.language&&Xt()},[Mt,On,Ht==null?void 0:Ht.language]),Object(a.useEffect)(function(){return Ht!=null&&Ht.is_program&&(Gi.current=0,Ri.current=setInterval(function(){nr()},15e3)),function(){clearInterval(Ri.current)}},[Ht==null?void 0:Ht.is_program]);var nr=function(){var on=Object(D.a)(r.a.mark(function Bt(){var an;return r.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(vt.a)("/api/myproblems/".concat(Mt,"/save_long_time.json"),{method:"get",params:{answer_long_time:Gi.current}});case 2:an=fn.sent;case 3:case"end":return fn.stop()}},Bt)}));return function(){return on.apply(this,arguments)}}(),Ft=function(){window.parent.postMessage("backExercise","*")};function Xt(){return Kt.apply(this,arguments)}function Kt(){return Kt=Object(D.a)(r.a.mark(function on(){var Bt;return r.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.prev=0,Pt.next=3,Object(C.f)(Mt,{limit:15,page:On,language:Ht==null?void 0:Ht.language});case 3:Bt=Pt.sent,mt({type:St.GET_SUBMIT_RECORDS,payload:Bt}),Pt.next=10;break;case 7:Pt.prev=7,Pt.t0=Pt.catch(0),console.log(Pt.t0);case 10:case"end":return Pt.stop()}},on,null,[[0,7]])})),Kt.apply(this,arguments)}function tn(on){mt({type:St.SET_PAGE,payload:on})}function rn(){return Tn.apply(this,arguments)}function Tn(){return Tn=Object(D.a)(r.a.mark(function on(){var Bt;return r.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.next=2,Object(C.k)(Mt,{code:N.Base64.encode(Ht.code),language:Ht==null?void 0:Ht.language});case 2:return Bt=Pt.sent,Pt.abrupt("return",Bt);case 4:case"end":return Pt.stop()}},on)})),Tn.apply(this,arguments)}function ln(){return Un.apply(this,arguments)}function Un(){return Un=Object(D.a)(r.a.mark(function on(){var Bt,an,Pt,fn,Pn,ei,Si,ti;return r.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:if(!In){kn.next=2;break}return kn.abrupt("return");case 2:return mt({type:St.SET_SUBMITING,payload:!0}),kn.prev=3,re.a.publish("to-commit-info"),kn.next=7,rn();case 7:if(Bt=kn.sent,console.log(Bt,1),!(Bt.status===0)){kn.next=23;break}return ti=function(){return ti=Object(D.a)(r.a.mark(function Fi(){var $n,vi,wi,oi,zi,Cr,Bi;return r.a.wrap(function(Ei){for(;;)switch(Ei.prev=Ei.next){case 0:return Ei.next=2,Object(C.c)(Mt,"submit");case 2:if($n=Ei.sent,vi=$n.status,wi=$n.data,oi=zn(),zi=oi-ei>(Pn+3)*1e3,vi!==0&&!zi&&setTimeout(Si,1e3),!zi){Ei.next=12;break}return g.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),mt({type:St.SET_SUBMITING,payload:!1}),Ei.abrupt("return");case 12:if(!(vi===0)){Ei.next=19;break}return wi.status===2&&g.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),(wi==null?void 0:wi.status)===0&&(Tt==null||((Cr=Tt.query)===null||Cr===void 0)?void 0:Cr.type)==="1"&&Ni(!0),Ei.next=17,Object(C.f)(Mt,{limit:15,page:On,language:Ht==null?void 0:Ht.language});case 17:Bi=Ei.sent,mt({type:St.SET_SUBMIT_RESULT,payload:Object(u.a)(Object(u.a)({},Ue),{},{submitResult:wi,submitting:!1,submitRecords:Bi})});case 19:case"end":return Ei.stop()}},Fi)})),ti.apply(this,arguments)},Si=function(){return ti.apply(this,arguments)},Pt={},Tt.query.type==="exercises"&&(Pt.extras={exercise_id:Tt.query.exercisesId,question_id:Tt.query.questionId}),kn.next=16,Object(C.h)(Mt,Pt);case 16:if(fn=kn.sent,!(fn.status===-1&&Tt!==null&&Tt!==void 0&&(an=Tt.query)!==null&&an!==void 0&&an.coursesId)){kn.next=20;break}return window.parent.location.href="/classrooms/".concat(Tt.query.coursesId,"/exercise/").concat(Tt.query.exercisesId,"/detail"),kn.abrupt("return");case 20:Pn=Ht.time_limit,ei=zn(),Si();case 23:kn.next=29;break;case 25:kn.prev=25,kn.t0=kn.catch(3),console.log(kn.t0),mt({type:St.SET_SUBMITING,payload:!1});case 29:case"end":return kn.stop()}},on,null,[[3,25]])})),Un.apply(this,arguments)}function ai(){return nn.apply(this,arguments)}function nn(){return nn=Object(D.a)(r.a.mark(function on(){var Bt,an,Pt,fn,Pn,ei,Si;return r.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:return Ue.debuging=!0,mt({type:St.SET_DEBUGING,payload:!0}),vn.prev=2,vn.next=5,rn();case 5:if(Bt=vn.sent,!(Bt.status===0)){vn.next=22;break}return Si=function(){return Si=Object(D.a)(r.a.mark(function Yi(){var Fi,$n,vi,wi,oi,zi;return r.a.wrap(function(Bi){for(;;)switch(Bi.prev=Bi.next){case 0:return Bi.next=2,Object(C.c)(Mt,"debug");case 2:if(Fi=Bi.sent,$n=Fi.status,vi=Fi.message,wi=Fi.data,oi=zn(),zi=oi-Pn>(an+3)*1e3,$n!==0&&!zi&&(mt({type:St.SET_EXECUTE_MESSAGE,payload:vi}),setTimeout(ei,1e3)),!zi){Bi.next=13;break}return g.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),mt({type:St.SET_DEBUGING,payload:!1}),Bi.abrupt("return");case 13:$n===0&&(mt({type:St.SET_DEBUGING,payload:!1}),wi.status===2&&g.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),wi.status===2&&g.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),mt({type:St.SET_EXECUTE_RESULT,payload:Object(u.a)(Object(u.a)({},Ue),{},{debugResult:wi,debuging:!1})}));case 14:case"end":return Bi.stop()}},Yi)})),Si.apply(this,arguments)},ei=function(){return Si.apply(this,arguments)},an=Ht.time_limit,Pt={input:encodeURIComponent(Zt.test_case.input)},Tt.query.type==="exercises"&&(Pt.exercise_id=Tt.query.exercisesId),vn.next=14,Object(C.b)(Mt,Pt);case 14:if(fn=vn.sent,!(fn.status===-1&&Tt.query.coursesId)){vn.next=18;break}return window.parent.location.href="/classrooms/".concat(Tt.query.coursesId,"/exercise/").concat(Tt.query.exercisesId,"/detail"),vn.abrupt("return");case 18:Pn=zn(),ei(),vn.next=23;break;case 22:mt({type:St.SET_DEBUGING,payload:!1});case 23:vn.next=28;break;case 25:vn.prev=25,vn.t0=vn.catch(2),console.log(vn.t0);case 28:return vn.prev=28,vn.finish(28);case 30:case"end":return vn.stop()}},on,null,[[2,25,28,30]])})),nn.apply(this,arguments)}function bi(on){mt({type:St.SET_DATA,payload:Object(u.a)(Object(u.a)({},Zt),{},{hack:Object(u.a)(Object(u.a)({},Ht),{},{code:on})})})}var bn=function(){var on=Object(D.a)(r.a.mark(function Bt(an){var Pt,fn;return r.a.wrap(function(ei){for(;;)switch(ei.prev=ei.next){case 0:return ei.next=2,Object(vt.a)("/api/problems/".concat(Ht==null?void 0:Ht.identifier,"/start.json"),{method:"get",params:{language:an==="C++"||an==="c++"?encodeURIComponent(an):an,hack_user_id:Kn==null?void 0:Kn.user_id}});case 2:Pt=ei.sent,Pt.status!==-1&&Jt.replace("/myproblems/".concat(Pt==null?void 0:Pt.identifier,"?type=").concat(Tt==null||((fn=Tt.query)===null||fn===void 0)?void 0:fn.type));case 4:case"end":return ei.stop()}},Bt)}));return function(an){return on.apply(this,arguments)}}();function Qn(on){var Bt=on.target.value;mt({type:St.SET_DATA,payload:Object(u.a)(Object(u.a)({},Zt),{},{test_case:{input:Bt}})})}function qn(){return mi.apply(this,arguments)}function mi(){return mi=Object(D.a)(r.a.mark(function on(){var Bt;return r.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.prev=0,Pt.next=3,Object(C.g)(Mt);case 3:Bt=Pt.sent,Bt.status===401?Jt.replace("/login",{from:Tt.pathname}):bi(N.Base64.decode(Bt.code)),Pt.next=10;break;case 7:Pt.prev=7,Pt.t0=Pt.catch(0),console.log(Pt.t0);case 10:case"end":return Pt.stop()}},on,null,[[0,7]])})),mi.apply(this,arguments)}function Wr(){g.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:n.a.createElement("p",null,"\u521D\u59CB\u4EE3\u7801\u6709\u4FEE\u6539\uFF0C\u66F4\u65B0\u540E\u5C06\u8986\u76D6\u73B0\u6709\u4EE3\u7801\u54E6~ ",n.a.createElement("br",null),"\u8BF7\u5C06\u60A8\u7F16\u8F91\u7684\u4EE3\u7801\u4FDD\u5B58\u81F3\u672C\u5730\uFF0C\u4EE5\u9632\u4E22\u5931"),onOk:function(){return Object(D.a)(r.a.mark(function Bt(){var an;return r.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(C.i)(Mt);case 2:an=fn.sent,an.status===401?Jt.replace("/login",{from:Tt.pathname}):bi(N.Base64.decode(an.code));case 4:case"end":return fn.stop()}},Bt)}))()}})}function En(){mt({type:St.SET_SHOW_NOTE,payload:!0})}function hn(){mt({type:St.SET_SHOW_NOTE,payload:!1})}function gn(on){return gi.apply(this,arguments)}function gi(){return gi=Object(D.a)(r.a.mark(function on(Bt){return r.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.next=2,Object(C.a)(Mt,Bt);case 2:mt({type:St.GET_DATA,payload:{showNote:!1,data:Object(u.a)(Object(u.a)({},Zt),{},{hack:Object(u.a)(Object(u.a)({},Ht),{},{notes:Bt.notes})})}});case 3:case"end":return Pt.stop()}},on)})),gi.apply(this,arguments)}var Qi={hack:Ht,isLoading:sn,input:Zt==null||((j=Zt.test_case)===null||j===void 0)?void 0:j.input,language:Ht==null?void 0:Ht.language,code:Ht==null?void 0:Ht.code,title:"main."+ct[Ht==null?void 0:Ht.language],modify_code:Ht==null?void 0:Ht.modify_code,notes:Ht==null?void 0:Ht.notes,debugResult:Mn,debuging:xn,submitting:In,executingMessage:Hn,onCancelNote:hn,onAddNote:gn,showNote:Ln,user:Kn,onShowNote:En,onSubmitCode:ln,onChangeCode:bi,onChangeInput:Qn,onDebugCode:ai,onResetCode:qn,onSyncCode:Wr,onUpdateCode:rn,onChangeLanguage:bn};function qi(){return ir.apply(this,arguments)}function ir(){return ir=Object(D.a)(r.a.mark(function on(){var Bt,an,Pt;return r.a.wrap(function(Pn){for(;;)switch(Pn.prev=Pn.next){case 0:return Pn.next=2,Object(C.j)(Ht.id,{container_type:"Hack",type:1});case 2:Bt=Pn.sent,an=Bt.praise_count,Pt=Object(u.a)(Object(u.a)({},Zt),{},{hack:Object(u.a)(Object(u.a)({},Ht),{},{praises_count:an,user_praise:!Ht.user_praise})}),mt({type:St.SET_DATA,payload:Pt});case 6:case"end":return Pn.stop()}},on)})),ir.apply(this,arguments)}var Tr={topicId:Mt,submitResult:Gt,submitRecords:wn,submitting:In,page:On,onPageChange:tn,hack:Ht,user:Zt==null?void 0:Zt.user,onTriggerPraise:qi};return n.a.createElement(n.a.Fragment,null,n.a.createElement(L.a,{spinning:qt,delay:500},Zt?n.a.createElement(n.a.Fragment,null,n.a.createElement("header",{className:$.a.header},Tt.query.type!=="exercises"&&n.a.createElement("div",null,n.a.createElement("img",{src:"".concat(c.a.IMG_SERVER,"/images/").concat(Kn.image_url),alt:"user",width:30}),n.a.createElement("span",null,Kn.name)),n.a.createElement("h2",{className:"flex-wrp flex_box_column flex_box_center"},n.a.createElement("div",null,Ht.name),(Ht==null?void 0:Ht.is_program)&&n.a.createElement(Fn.a,{defaultValue:Ht==null?void 0:Ht.answer_long_time,onChange:function(Bt){console.log(Bt),Gi.current=Bt},className:"font12 c-grey-999"})),Kn.hack_manager?n.a.createElement(A.a,{className:$.a.btn_back,to:(Tt==null||((ee=Tt.query)===null||ee===void 0)?void 0:ee.type)==="1"?"/problems/".concat(Ht.identifier,"/edit?type=1"):"/problems/".concat(Ht.identifier,"/edit"),style:{marginRight:10}}," ",n.a.createElement(O.a,null)," \u7F16\u8F91"):null,(pt==null||((X=pt.exercise)===null||X===void 0)?void 0:X.left_time)&&n.a.createElement(n.a.Fragment,null,n.a.createElement("span",{style:{color:_n},className:"iconfont icon-kaoshishichang mr5"}),n.a.createElement("span",{className:"c-white mr20"},n.a.createElement(li,{valueStyle:{color:_n,fontSize:16,fontWeight:"normal"},title:n.a.createElement("span",{style:{color:_n,fontSize:16}},"\u5269\u4F59\u65F6\u95F4\uFF1A"),value:mn,onFinish:Object(D.a)(r.a.mark(function on(){var Bt,an;return r.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(b.Z)({categoryId:Tt.query.exercisesId,commit_method:2});case 2:Bt=fn.sent,(Bt==null?void 0:Bt.status)===0&&(rn(),g.a.info({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",content:n.a.createElement("div",{className:"tc font16"},"\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377",n.a.createElement("br",null),"\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"),onOk:function(){var Pn=Object(D.a)(r.a.mark(function Si(){return r.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:window.parent.location.href="/classrooms/".concat(Tt.query.coursesId,"/exercise/").concat(Tt.query.exercisesId,"/detail");case 1:case"end":return vn.stop()}},Si)}));function ei(){return Pn.apply(this,arguments)}return ei}()})),(Bt==null?void 0:Bt.status)===-3&&(an=parseInt(Bt==null?void 0:Bt.message),zt(Date.now()+an*1e3));case 5:case"end":return fn.stop()}},on)}))}))),(Tt==null||((ye=Tt.query)===null||ye===void 0)?void 0:ye.type)==="exercises"?n.a.createElement(F.a,{type:"primary",onClick:function(){rn(),g.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:n.a.createElement("div",{className:"tc"},"\u8BF7\u786E\u8BA4\u4F60\u7684\u7B54\u9898\u5185\u5BB9\u5DF2\u7ECF\u63D0\u4EA4\uFF1F"),onOk:function(){Ft()}})}},n.a.createElement("span",{className:"iconfont icon-yiguanbi mr5 font14"})," \u8FD4\u56DE\u8BD5\u5377"):n.a.createElement("span",{className:$.a.btn_back,onClick:function(){var Bt;if((Tt==null||((Bt=Tt.query)===null||Bt===void 0)?void 0:Bt.type)==="1"){var an,Pt=(an=localStorage.getItem("program_homework"))===null||an===void 0?void 0:an.split(",");Jt.push("/classrooms/".concat(Pt==null?void 0:Pt[0],"/program_homework/").concat(Pt==null?void 0:Pt[1],"/detail"))}else Jt.push("/problemset")}}," ",n.a.createElement(S.a,null),"\u9000\u51FA")),n.a.createElement(L.a,{size:"large",spinning:sn},n.a.createElement(p.a,{className:"my-problems",leftChild:n.a.createElement(en,Tr),rightChild:n.a.createElement(w,Qi)}))):null,n.a.createElement(g.a,{centered:!0,closable:!1,width:680,footer:null,visible:Vi,className:"oj-modal"},n.a.createElement("section",{className:"oj-modal-content"},n.a.createElement("div",{className:"oj-modal-head"},n.a.createElement("img",{src:Rn.a,alt:""}),n.a.createElement("i",{onClick:function(){return Ni(!1)},className:"iconfont icon-guanbi1"})),n.a.createElement("aside",null,n.a.createElement("img",{className:"mr30",src:Bn.a}),"\u8FD0\u884C\u65F6\u95F4:\xA0",n.a.createElement("span",{style:{color:"#75d6ba",marginRight:100}},Gt==null?void 0:Gt.execute_time,"ms"),"\u4F18\u4E8E",n.a.createElement("span",{style:{color:"#f3b087",margin:"0 5px"}},(Gt==null?void 0:Gt.time_better_than)||100,"%"),"\u7684\u7528\u6237"),n.a.createElement("aside",{className:"mb50"},n.a.createElement("img",{src:Qt.a,className:"mr30"}),n.a.createElement("span",{className:"oj-modal-tt"},n.a.createElement("span",null,n.a.createElement("span",null,"\u5360\u7528\u5185\u5B58:\xA0"),n.a.createElement("span",{className:"c-light-primary"},Gt==null?void 0:Gt.execute_memory,"kb")),n.a.createElement("span",null,n.a.createElement("span",null))),"\u4F18\u4E8E",n.a.createElement("span",{style:{color:"#f3b087",margin:"0 5px"}},(Gt==null?void 0:Gt.memory_better_than)||100,"%"),"\u7684\u7528\u6237"),n.a.createElement("div",{id:"oj-modal-next",onClick:Object(D.a)(r.a.mark(function on(){var Bt,an,Pt;return r.a.wrap(function(Pn){for(;;)switch(Pn.prev=Pn.next){case 0:if(!(Gt!=null&&Gt.next_identifier)){Pn.next=7;break}return Pn.next=3,Object(vt.a)("/api/problems/".concat(Gt==null?void 0:Gt.next_identifier,"/start.json"),{method:"get",params:{hack_user_id:Kn==null?void 0:Kn.user_id}});case 3:Bt=Pn.sent,Bt&&(Jt.replace("/myproblems/".concat(Bt==null?void 0:Bt.identifier,"?type=1")),window.location.reload()),Pn.next=9;break;case 7:Pt=(an=localStorage.getItem("program_homework"))===null||an===void 0?void 0:an.split(","),Jt.push("/classrooms/".concat(Pt==null?void 0:Pt[0],"/program_homework/").concat(Pt==null?void 0:Pt[1],"/detail"));case 9:case"end":return Pn.stop()}},on)})),className:"oj-modal-btn"},Gt!=null&&Gt.next_identifier?"\u8FDB\u5165\u4E0B\u4E00\u9898":"\u56DE\u5230\u4F5C\u4E1A\u8BE6\u60C5\u9875")))))};function J(T){var j,ee=T.title,X=T.modify_code,ye=T.onSyncCode,Ve=T.onShowCodeSetting,ot=T.onResetCode,ht=T.hack,Ue=T.onChangeLanguage,mt=function(){g.a.confirm({title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",icon:n.a.createElement(E.a,null),content:"\u4F60\u5728\u672C\u6587\u4EF6\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\u5C06\u4E22\u5931\uFF0C\u662F\u5426\u786E\u5B9A\u91CD\u65B0\u52A0\u8F7D\u521D\u59CB\u4EE3\u7801\uFF1F",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:ot})};return console.log(ht,"hack"),n.a.createElement("div",{className:"action-bar",style:{paddingLeft:0}},(ht==null?void 0:ht.is_program)&&n.a.createElement(z.a,{className:"oj-select",value:ht==null?void 0:ht.language,style:{width:100},placeholder:"\u9009\u62E9\u8BED\u8A00",onChange:Ue},ht==null||((j=ht.all_language)===null||j===void 0)?void 0:j.map(function(Rt){return n.a.createElement(z.a.Option,{key:Rt,value:Rt},Rt)})),n.a.createElement("span",null),X?n.a.createElement("a",{title:"\u66F4\u65B0\u901A\u77E5",onClick:ye},n.a.createElement("img",{src:P.a,alt:"notice"})):null,n.a.createElement("a",{title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",onClick:mt},n.a.createElement("i",{className:"iconfont icon-zhongzhi font-20 "})),n.a.createElement("a",{onClick:Ve},n.a.createElement("i",{className:"iconfont icon-shezhi"})))}function w(T){var j=T.input,ee=T.showNote,X=T.onShowNote,ye=T.notes,Ve=T.onCancelNote,ot=T.onAddNote,ht=T.debugResult,Ue=T.language,mt=T.debuging,Rt=T.submitting,Mt=T.executingMessage,Jt=T.code,Tt=T.onSubmitCode,qt=T.onDebugCode,Zt=T.onChangeCode,Mn=T.onChangeInput,Gt=T.onUpdateCode,wn=T.user,On=T.isLoading,Ln=Object(V.a)(T,["input","showNote","onShowNote","notes","onCancelNote","onAddNote","debugResult","language","debuging","submitting","executingMessage","code","onSubmitCode","onDebugCode","onChangeCode","onChangeInput","onUpdateCode","user","isLoading"]);function xn(Hn){return n.a.createElement(J,Object(q.a)({},Ln,{onShowCodeSetting:Hn}))}var In=Object(u.a)({input:j,debugResult:ht,debuging:mt,submitting:Rt,executingMessage:Mt,onDebugCode:qt,onChangeCode:Zt,onSubmitCode:Tt,onChangeInput:Mn,user:wn},Ln);return n.a.createElement("div",{className:"right-panel"},n.a.createElement(y.a,{isLoading:On,language:Ue,value:Jt,onChange:Zt,ActionBarRender:xn}),n.a.createElement("div",{className:"note-form-area ".concat(ee?"active":"")},n.a.createElement(Ee,{onCancel:Ve,notes:ye,callback:ot})),n.a.createElement(R.b,In))}},RELg:function(Fe,Se,W){var q=W("MFOe"),V=q.Global;Fe.exports={name:"oldIE-userDataStorage",write:H,read:F,each:D,remove:I,clearAll:g};var M="storejs",z=V.document,U=d(),L=(V.navigator?V.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function H(s,l){if(L)return;var r=u(s);U(function(a){a.setAttribute(r,l),a.save(M)})}function F(s){if(L)return;var l=u(s),r=null;return U(function(a){r=a.getAttribute(l)}),r}function D(s){U(function(l){for(var r=l.XMLDocument.documentElement.attributes,a=r.length-1;a>=0;a--){var n=r[a];s(l.getAttribute(n.name),n.name)}})}function I(s){var l=u(s);U(function(r){r.removeAttribute(l),r.save(M)})}function g(){U(function(s){var l=s.XMLDocument.documentElement.attributes;s.load(M);for(var r=l.length-1;r>=0;r--)s.removeAttribute(l[r].name);s.save(M)})}var f=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function u(s){return s.replace(/^\d/,"___$&").replace(f,"___")}function d(){if(!z||!z.documentElement||!z.documentElement.addBehavior)return null;var s="script",l,r,a;try{r=new ActiveXObject("htmlfile"),r.open(),r.write("<"+s+">document.w=window</"+s+'><iframe src="/favicon.ico"></iframe>'),r.close(),l=r.w.frames[0].document,a=l.createElement("div")}catch(n){a=z.createElement("div"),l=z.body}return function(n){var h=[].slice.call(arguments,0);h.unshift(a),l.appendChild(a),a.addBehavior("#default#userData"),a.load(M),n.apply(this,h),l.removeChild(a);return}}},"S+dL":function(Fe,Se){Fe.exports="data:image/gif;base64,R0lGODlhFAAQAOZVAD6Q33p6ezZto2VnaW5vcDuCxiYvNysvM1tdXzNij5eXlyg0QTA0OExOUWZnaS8zN19hYzFYf0Oi/Sg1QoeHh2JjZWZoaTdzrTRmljl5tzFZgDBWez6P3Tl4tjl8uzdxqWBiYys/VCUqL39/gHV2dy4yNScyPDJeiEpNTzk8P0CX6jc7PiYuNWlqaywwNDZtojAzNytDWScrLitAVUGb8Xl6eoWFhTp+wDNgjWRmZ4+QkFdZWzo9QIODgyo/Uzh3syg0QCczPmprbTRllW9wcSotMVJUVjZupDuEylBSVUGb8kxPUZGRkTd0rUGc82JkZUKe9j2M1zg7P4iIiEOj/yUpLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0U3Nzk1NkY5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0U3Nzk1NzA5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3RTc3OTU2RDlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3RTc3OTU2RTlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAUyAFUALAAAAAAUABAAAAd5gFWCg4RSLoSIiVUPFlNEhAwDCIoyST1TUwGCBwM6AweJPCSYmJpVCAMMgykgFRUtFKSlilVCsreZtAS4sqaJu7yzisDBvhAKyBDEvL6Iy7jNhA7BwoklKA0NRiO30bRFOzakpqiqtItPsTWbA0wWoOcrOUuEMA6TgQAh+QQFMgBVACwAAAAAFAAQAAAHeIBVgoOEISaEiIlVExlUSIQLAgmKIidOVFQAggYCNAIGiTFRmJiaVQkCC4MzHxcXHhKkpYpVN7K3mbQFuLKmibu8s4rAwb4YpBjEvL6IyrjMhB3BwolBGxEROCq30LQsQ1CkpqiqtItNsRybAkpHoOY+PxqEQC+TgQA7"},"S/kP":function(Fe,Se,W){Fe.exports=W.p+"static/time.a3dc82f3.svg"},"SA+Z":function(Fe,Se,W){var q=W("wTVA"),V=W("EbDI"),M=W("ZhPi"),z=W("wkBT");function U(L){return q(L)||V(L)||M(L)||z()}Fe.exports=U,Fe.exports.__esModule=!0,Fe.exports.default=Fe.exports},SJMd:function(Fe,Se){/**
|
|
* @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 W,q,V,M=!1,z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var L,H;(function(){var F=window,D=["break,continue,do,else,for,if,return,while"],I=[D,"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"],g=[I,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],f=[g,"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"],u=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],d=[g,"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"],s="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",l=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],r="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[D,"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"],n=[D,"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"],h=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[f,d,u,l,r,a,n,h],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,x="str",A="kwd",C="com",b="typ",v="lit",p="pun",c="pln",E="tag",y="dec",_="src",P="atn",N="atv",K="nocode",$="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(He){for(var $e=0,Qe=!1,gt=!1,et=0,tt=He.length;et<tt;++et){var Je=He[et];if(Je.ignoreCase)gt=!0;else if(/[a-z]/i.test(Je.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Qe=!0,gt=!1;break}}var vt={b:8,t:9,n:10,v:11,f:12,r:13};function wt(Ae){var Ce=Ae.charCodeAt(0);if(Ce!==92)return Ce;var Ge=Ae.charAt(1);return Ce=vt[Ge],Ce||("0"<=Ge&&Ge<="7"?parseInt(Ae.substring(1),8):Ge==="u"||Ge==="x"?parseInt(Ae.substring(2),16):Ae.charCodeAt(1))}function Et(Ae){if(Ae<32)return(Ae<16?"\\x0":"\\x")+Ae.toString(16);var Ce=String.fromCharCode(Ae);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function xt(Ae){var Ce=Ae.substring(1,Ae.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")),Ge=[],ze=Ce[0]==="^",Re=["["];ze&&Re.push("^");for(var je=ze?1:0,ge=Ce.length;je<ge;++je){var de=Ce[je];if(/\\[bdsw]/i.test(de))Re.push(de);else{var ce=wt(de),re;je+2<ge&&Ce[je+1]==="-"?(re=wt(Ce[je+2]),je+=2):re=ce,Ge.push([ce,re]),re<65||ce>122||(re<65||ce>90||Ge.push([Math.max(65,ce)|32,Math.min(re,90)|32]),re<97||ce>122||Ge.push([Math.max(97,ce)&~32,Math.min(re,122)&~32]))}}Ge.sort(function(be,Ie){return be[0]-Ie[0]||Ie[1]-be[1]});for(var ae=[],ue=[],je=0;je<Ge.length;++je){var fe=Ge[je];fe[0]<=ue[1]+1?ue[1]=Math.max(ue[1],fe[1]):ae.push(ue=fe)}for(var je=0;je<ae.length;++je){var fe=ae[je];Re.push(Et(fe[0])),fe[1]>fe[0]&&(fe[1]+1>fe[0]&&Re.push("-"),Re.push(Et(fe[1])))}return Re.push("]"),Re.join("")}function kt(Ae){for(var Ce=Ae.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")),Ge=Ce.length,ze=[],Re=0,je=0;Re<Ge;++Re){var ge=Ce[Re];if(ge==="(")++je;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=je?ze[de]=-1:Ce[Re]=Et(de))}}for(var Re=1;Re<ze.length;++Re)ze[Re]===-1&&(ze[Re]=++$e);for(var Re=0,je=0;Re<Ge;++Re){var ge=Ce[Re];if(ge==="(")++je,ze[je]||(Ce[Re]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=je&&(Ce[Re]="\\"+ze[de])}}for(var Re=0;Re<Ge;++Re)Ce[Re]==="^"&&Ce[Re+1]!=="^"&&(Ce[Re]="");if(Ae.ignoreCase&&Qe)for(var Re=0;Re<Ge;++Re){var ge=Ce[Re],ce=ge.charAt(0);ge.length>=2&&ce==="["?Ce[Re]=xt(ge):ce!=="\\"&&(Ce[Re]=ge.replace(/[a-zA-Z]/g,function(ue){var fe=ue.charCodeAt(0);return"["+String.fromCharCode(fe&~32,fe|32)+"]"}))}return Ce.join("")}for(var Ot=[],et=0,tt=He.length;et<tt;++et){var Je=He[et];if(Je.global||Je.multiline)throw new Error(""+Je);Ot.push("(?:"+kt(Je)+")")}return new RegExp(Ot.join("|"),gt?"gi":"g")}function R(He,$e){var Qe=/(?:^|\s)nocode(?:\s|$)/,gt=[],et=0,tt=[],Je=0;function vt(wt){var Et=wt.nodeType;if(Et==1){if(Qe.test(wt.className))return;for(var xt=wt.firstChild;xt;xt=xt.nextSibling)vt(xt);var kt=wt.nodeName.toLowerCase();(kt==="br"||kt==="li")&&(gt[Je]=`
|
|
`,tt[Je<<1]=et++,tt[Je++<<1|1]=wt)}else if(Et==3||Et==4){var Ot=wt.nodeValue;Ot.length&&($e?Ot=Ot.replace(/\r\n?/g,`
|
|
`):Ot=Ot.replace(/[ \t\r\n]+/g," "),gt[Je]=Ot,tt[Je<<1]=et,et+=Ot.length,tt[Je++<<1|1]=wt)}}return vt(He),{sourceCode:gt.join("").replace(/\n$/,""),spans:tt}}function G(He,$e,Qe,gt,et){if(!Qe)return;var tt={sourceNode:He,pre:1,langExtension:null,numberLines:null,sourceCode:Qe,spans:null,basePos:$e,decorations:null};gt(tt),et.push.apply(et,tt.decorations)}var Q=/\S/;function ne(He){for(var $e=void 0,Qe=He.firstChild;Qe;Qe=Qe.nextSibling){var gt=Qe.nodeType;$e=gt===1?$e?He:Qe:gt===3&&Q.test(Qe.nodeValue)?He:$e}return $e===He?void 0:$e}function le(He,$e){var Qe={},gt;(function(){for(var Je=He.concat($e),vt=[],wt={},Et=0,xt=Je.length;Et<xt;++Et){var kt=Je[Et],Ot=kt[3];if(Ot)for(var Ae=Ot.length;--Ae>=0;)Qe[Ot.charAt(Ae)]=kt;var Ce=kt[1],Ge=""+Ce;wt.hasOwnProperty(Ge)||(vt.push(Ce),wt[Ge]=null)}vt.push(/[\0-\uffff]/),gt=B(vt)})();var et=$e.length,tt=function(Je){for(var vt=Je.sourceCode,wt=Je.basePos,Et=Je.sourceNode,xt=[wt,c],kt=0,Ot=vt.match(gt)||[],Ae={},Ce=0,Ge=Ot.length;Ce<Ge;++Ce){var ze=Ot[Ce],Re=Ae[ze],je=void 0,ge;if(typeof Re=="string")ge=!1;else{var de=Qe[ze.charAt(0)];if(de)je=ze.match(de[1]),Re=de[0];else{for(var ce=0;ce<et;++ce)if(de=$e[ce],je=ze.match(de[1]),je){Re=de[0];break}je||(Re=c)}ge=Re.length>=5&&Re.substring(0,5)==="lang-",ge&&!(je&&typeof je[1]=="string")&&(ge=!1,Re=_),ge||(Ae[ze]=Re)}var re=kt;if(kt+=ze.length,!ge)xt.push(wt+re,Re);else{var ae=je[1],ue=ze.indexOf(ae),fe=ue+ae.length;je[2]&&(fe=ze.length-je[2].length,ue=fe-ae.length);var be=Re.substring(5);G(Et,wt+re,ze.substring(0,ue),tt,xt),G(Et,wt+re+ue,ae,oe(be,ae),xt),G(Et,wt+re+fe,ze.substring(fe),tt,xt)}}Je.decorations=xt};return tt}function _e(He){var $e=[],Qe=[];He.tripleQuotedStrings?$e.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):He.multiLineStrings?$e.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):$e.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),He.verbatimStrings&&Qe.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var gt=He.hashComments;gt&&(He.cStyleComments?(gt>1?$e.push([C,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):$e.push([C,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Qe.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):$e.push([C,/^#[^\r\n]*/,null,"#"])),He.cStyleComments&&(Qe.push([C,/^\/\/[^\r\n]*/,null]),Qe.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var et=He.regexLiterals;if(et){var tt=et>1?"":`
|
|
\r`,Je=tt?".":"[\\S\\s]",vt="/(?=[^/*"+tt+"])(?:[^/\\x5B\\x5C"+tt+"]|\\x5C"+Je+"|\\x5B(?:[^\\x5C\\x5D"+tt+"]|\\x5C"+Je+")*(?:\\x5D|$))+/";Qe.push(["lang-regex",RegExp("^"+$+"("+vt+")")])}var wt=He.types;wt&&Qe.push([b,wt]);var Et=(""+He.keywords).replace(/^ | $/g,"");Et.length&&Qe.push([A,new RegExp("^(?:"+Et.replace(/[\s,]+/g,"|")+")\\b"),null]),$e.push([c,/^\s+/,null,` \r
|
|
\xA0`]);var xt="^.[^\\s\\w.$@'\"`/\\\\]*";return He.regexLiterals&&(xt+="(?!s*/)"),Qe.push([v,/^@[a-z_$][a-z_$@0-9]*/i,null],[b,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[c,/^[a-z_$][a-z_$@0-9]*/i,null],[v,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[c,/^\\[\s\S]?/,null],[p,new RegExp(xt),null]),le($e,Qe)}var pe=_e({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(He,$e,Qe){for(var gt=/(?:^|\s)nocode(?:\s|$)/,et=/\r\n?|\n/,tt=He.ownerDocument,Je=tt.createElement("li");He.firstChild;)Je.appendChild(He.firstChild);var vt=[Je];function wt(Ce){var Ge=Ce.nodeType;if(Ge==1&&!gt.test(Ce.className))if(Ce.nodeName==="br")Et(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var ze=Ce.firstChild;ze;ze=ze.nextSibling)wt(ze);else if((Ge==3||Ge==4)&&Qe){var Re=Ce.nodeValue,je=Re.match(et);if(je){var ge=Re.substring(0,je.index);Ce.nodeValue=ge;var de=Re.substring(je.index+je[0].length);if(de){var ce=Ce.parentNode;ce.insertBefore(tt.createTextNode(de),Ce.nextSibling)}Et(Ce),ge||Ce.parentNode.removeChild(Ce)}}}function Et(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function Ge(je,ge){var de=ge?je.cloneNode(!1):je,ce=je.parentNode;if(ce){var re=Ge(ce,1),ae=je.nextSibling;re.appendChild(de);for(var ue=ae;ue;ue=ae)ae=ue.nextSibling,re.appendChild(ue)}return de}for(var ze=Ge(Ce.nextSibling,0),Re;(Re=ze.parentNode)&&Re.nodeType===1;)ze=Re;vt.push(ze)}for(var xt=0;xt<vt.length;++xt)wt(vt[xt]);$e===($e|0)&&vt[0].setAttribute("value",$e);var kt=tt.createElement("ol");kt.className="linenums";for(var Ot=Math.max(0,$e-1|0)||0,xt=0,Ae=vt.length;xt<Ae;++xt)Je=vt[xt],Je.className="L"+(xt+Ot)%10,Je.firstChild||Je.appendChild(tt.createTextNode("\xA0")),kt.appendChild(Je);He.appendChild(kt)}function Oe(He){var $e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);$e=$e&&+$e[1]<=8;var Qe=/\n/g,gt=He.sourceCode,et=gt.length,tt=0,Je=He.spans,vt=Je.length,wt=0,Et=He.decorations,xt=Et.length,kt=0;Et[xt]=et;var Ot,Ae;for(Ae=Ot=0;Ae<xt;)Et[Ae]!==Et[Ae+2]?(Et[Ot++]=Et[Ae++],Et[Ot++]=Et[Ae++]):Ae+=2;for(xt=Ot,Ae=Ot=0;Ae<xt;){for(var Ce=Et[Ae],Ge=Et[Ae+1],ze=Ae+2;ze+2<=xt&&Et[ze+1]===Ge;)ze+=2;Et[Ot++]=Ce,Et[Ot++]=Ge,Ae=ze}xt=Et.length=Ot;var Re=He.sourceNode,je="";Re&&(je=Re.style.display,Re.style.display="none");try{for(var ge=null;wt<vt;){var de=Je[wt],ce=Je[wt+2]||et,re=Et[kt+2]||et,ze=Math.min(ce,re),ae=Je[wt+1],ue;if(ae.nodeType!==1&&(ue=gt.substring(tt,ze))){$e&&(ue=ue.replace(Qe,"\r")),ae.nodeValue=ue;var fe=ae.ownerDocument,be=fe.createElement("span");be.className=Et[kt+1];var Ie=ae.parentNode;Ie.replaceChild(be,ae),be.appendChild(ae),tt<ce&&(Je[wt+1]=ae=fe.createTextNode(gt.substring(ze,ce)),Ie.insertBefore(ae,be.nextSibling))}tt=ze,tt>=ce&&(wt+=2),tt>=re&&(kt+=2)}}finally{Re&&(Re.style.display=je)}}var we={};function he(He,$e){for(var Qe=$e.length;--Qe>=0;){var gt=$e[Qe];we.hasOwnProperty(gt)?F.console&&console.warn("cannot override language handler %s",gt):we[gt]=He}}function oe(He,$e){return He&&we.hasOwnProperty(He)||(He=/^\s*</.test($e)?"default-markup":"default-code"),we[He]}he(pe,["default-code"]),he(le([],[[c,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[p,/^(?:<[%?]|[%?]>)/],["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"]),he(le([[c,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[p,/^[=<>\/]+/],["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"]),he(le([],[[N,/^[\s\S]+/]]),["uq.val"]),he(_e({keywords:f,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),he(_e({keywords:"null,true,false"}),["json"]),he(_e({keywords:d,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),he(_e({keywords:u,cStyleComments:!0}),["java"]),he(_e({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),he(_e({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),he(_e({keywords:r,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),he(_e({keywords:n,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),he(_e({keywords:l,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),he(_e({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),he(le([],[[x,/^[\s\S]+/]]),["regex"]);function Le(He){var $e=He.langExtension;try{var Qe=R(He.sourceNode,He.pre),gt=Qe.sourceCode;He.sourceCode=gt,He.spans=Qe.spans,He.basePos=0,oe($e,gt)(He),Oe(He)}catch(et){F.console&&console.log(et&&et.stack||et)}}function Ye(He,$e,Qe){var gt=Qe||!1,et=$e||null,tt=document.createElement("div");tt.innerHTML="<pre>"+He+"</pre>",tt=tt.firstChild,gt&&Ee(tt,gt,!0);var Je={langExtension:et,numberLines:gt,sourceNode:tt,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Le(Je),tt.innerHTML}function nt(He,$e){var Qe=$e||document.body,gt=Qe.ownerDocument||document;function et(de){return Qe.getElementsByTagName(de)}for(var tt=[et("pre"),et("code"),et("xmp")],Je=[],vt=0;vt<tt.length;++vt)for(var wt=0,Et=tt[vt].length;wt<Et;++wt)Je.push(tt[vt][wt]);tt=null;var xt=Date;xt.now||(xt={now:function(){return+new Date}});var kt=0,Ot=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ae=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,Ge=/pre|xmp/i,ze=/^code$/i,Re=/^(?:pre|code|xmp)$/i,je={};function ge(){for(var de=F.PR_SHOULD_USE_CONTINUATION?xt.now()+250:Infinity;kt<Je.length&&xt.now()<de;kt++){for(var ce=Je[kt],re=je,ae=ce;ae=ae.previousSibling;){var ue=ae.nodeType,fe=(ue===7||ue===8)&&ae.nodeValue;if(fe?!/^\??prettify\b/.test(fe):ue!==3||/\S/.test(ae.nodeValue))break;if(fe){re={},fe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ke,Pe,st){re[Pe]=st});break}}var be=ce.className;if((re!==je||Ae.test(be))&&!Ce.test(be)){for(var Ie=!1,Xe=ce.parentNode;Xe;Xe=Xe.parentNode){var ut=Xe.tagName;if(Re.test(ut)&&Xe.className&&Ae.test(Xe.className)){Ie=!0;break}}if(!Ie){ce.className+=" prettyprinted";var bt=re.lang;if(!bt){bt=be.match(Ot);var ft;!bt&&(ft=ne(ce))&&ze.test(ft.tagName)&&(bt=ft.className.match(Ot)),bt&&(bt=bt[1])}var at;if(Ge.test(ce.tagName))at=1;else{var Be=ce.currentStyle,We=gt.defaultView,Me=Be?Be.whiteSpace:We&&We.getComputedStyle?We.getComputedStyle(ce,null).getPropertyValue("white-space"):0;at=Me&&Me.substring(0,3)==="pre"}var se=re.linenums;(se=se==="true"||+se)||(se=be.match(/\blinenums\b(?::(\d+))?/),se=se?se[1]&&se[1].length?+se[1]:!0:!1),se&&Ee(ce,se,at);var ve={langExtension:bt,sourceNode:ce,numberLines:se,pre:at,sourceCode:null,basePos:null,spans:null,decorations:null};Le(ve)}}}kt<Je.length?F.setTimeout(ge,250):typeof He=="function"&&He()}ge()}var qe=F.PR={createSimpleLexer:le,registerLangHandler:he,sourceDecorator:_e,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:N,PR_COMMENT:C,PR_DECLARATION:y,PR_KEYWORD:A,PR_LITERAL:v,PR_NOCODE:K,PR_PLAIN:c,PR_PUNCTUATION:p,PR_SOURCE:_,PR_STRING:x,PR_TAG:E,PR_TYPE:b,prettyPrintOne:M?F.prettyPrintOne=Ye:L=Ye,prettyPrint:H=M?F.prettyPrint=nt:H=nt},it=F.define;typeof it=="function"&&it.amd&&it("google-code-prettify",[],function(){return qe})})()},TXwP:function(Fe,Se,W){var q,V;(function(){var M;(function(){"use strict";var U=[,,function(D){function I(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}I.prototype.clone_empty=function(){var u=new I(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},I.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},I.prototype.has_match=function(u){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(u))return!0;return!1},I.prototype.set_indent=function(u,d){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},I.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(u){this.__items.push(u);var d=u.lastIndexOf(`
|
|
`);d!==-1?this.__character_count=u.length-d:this.__character_count+=u.length},I.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function g(u,d){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),d=d||"",u.indent_level>0&&(d=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}g.prototype.get_indent_size=function(u,d){var s=this.__base_string_length;return d=d||0,u<0&&(s=0),s+=u*this.__indent_size,s+=d,s},g.prototype.get_indent_string=function(u,d){var s=this.__base_string;return d=d||0,u<0&&(u=0,s=""),d+=u*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},g.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var u=this.__cache.length,d=0,s="";this.__indent_size&&u>=this.__indent_size&&(d=Math.floor(u/this.__indent_size),u-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),u&&(s+=new Array(u+1).join(" ")),this.__cache.push(s)};function f(u,d){this.__indent_cache=new g(u,d),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(u,d){return this.__indent_cache.get_indent_string(u,d)},f.prototype.get_indent_size=function(u,d){return this.__indent_cache.get_indent_size(u,d)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(u){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
|
|
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
|
|
`);return u!==`
|
|
`&&(s=s.replace(/[\n]/g,u)),s},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(u,d){return u=u||0,d=d||0,this.next_line.set_indent(u,d),this.__lines.length>1?(this.current_line.set_indent(u,d),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(u){for(var d=0;d<u.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},f.prototype.remove_indent=function(u){for(var d=this.__lines.length;u<d;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(u,d){for(var s=this.__lines.length-2;s>=0;){var l=this.__lines[s];if(l.is_empty())break;if(l.item(0).indexOf(u)!==0&&l.item(-1)!==d){this.__lines.splice(s+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},D.exports.Output=f},,,,function(D){function I(u,d){this.raw_options=g(u,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}I.prototype._get_array=function(u,d){var s=this.raw_options[u],l=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(l=s.concat()):typeof s=="string"&&(l=s.split(/[^a-zA-Z0-9_\/\-]+/)),l},I.prototype._get_boolean=function(u,d){var s=this.raw_options[u],l=s===void 0?!!d:!!s;return l},I.prototype._get_characters=function(u,d){var s=this.raw_options[u],l=d||"";return typeof s=="string"&&(l=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),l},I.prototype._get_number=function(u,d){var s=this.raw_options[u];d=parseInt(d,10),isNaN(d)&&(d=0);var l=parseInt(s,10);return isNaN(l)&&(l=d),l},I.prototype._get_selection=function(u,d,s){var l=this._get_selection_list(u,d,s);if(l.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l[0]},I.prototype._get_selection_list=function(u,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var l=this._get_array(u,s);if(!this._is_valid_selection(l,d))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
|
|
`+d+`
|
|
You passed in: '`+this.raw_options[u]+"'");return l},I.prototype._is_valid_selection=function(u,d){return u.length&&d.length&&!u.some(function(s){return d.indexOf(s)===-1})};function g(u,d){var s={};u=f(u);var l;for(l in u)l!==d&&(s[l]=u[l]);if(d&&u[d])for(l in u[d])s[l]=u[d][l];return s}function f(u){var d={},s;for(s in u){var l=s.replace(/-/g,"_");d[l]=u[s]}return d}D.exports.Options=I,D.exports.normalizeOpts=f,D.exports.mergeOpts=g},,function(D){var I=RegExp.prototype.hasOwnProperty("sticky");function g(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},g.prototype.peek=function(f){var u=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(u=this.__input.charAt(f)),u},g.prototype.__match=function(f,u){f.lastIndex=u;var d=f.exec(this.__input);return d&&!(I&&f.sticky)&&(d.index!==u&&(d=null)),d},g.prototype.test=function(f,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(f,u):!1},g.prototype.testChar=function(f,u){var d=this.peek(u);return f.lastIndex=0,d!==null&&f.test(d)},g.prototype.match=function(f){var u=this.__match(f,this.__position);return u?this.__position+=u[0].length:u=null,u},g.prototype.read=function(f,u,d){var s="",l;return f&&(l=this.match(f),l&&(s+=l[0])),u&&(l||!f)&&(s+=this.readUntil(u,d)),s},g.prototype.readUntil=function(f,u){var d="",s=this.__position;f.lastIndex=this.__position;var l=f.exec(this.__input);return l?(s=l.index,u&&(s+=l[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},g.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},g.prototype.get_regexp=function(f,u){var d=null,s="g";return u&&I&&(s="y"),typeof f=="string"&&f!==""?d=new RegExp(f,s):f&&(d=new RegExp(f.source,s)),d},g.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(f){var u=this.__position,d=this.readUntilAfter(f);return this.__position=u,d},g.prototype.lookBack=function(f){var u=this.__position-1;return u>=f.length&&this.__input.substring(u-f.length,u).toLowerCase()===f},D.exports.InputScanner=g},,,,,function(D){function I(g,f){g=typeof g=="string"?g:g.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+f,"g")}I.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(g);u;)f[u[1]]=u[2],u=this.__directive_pattern.exec(g);return f},I.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=I},,function(D,I,g){var f=g(16).Beautifier,u=g(17).Options;function d(s,l){var r=new f(s,l);return r.beautify()}D.exports=d,D.exports.defaultOptions=function(){return new u}},function(D,I,g){var f=g(17).Options,u=g(2).Output,d=g(8).InputScanner,s=g(13).Directives,l=new s(/\/\*/,/\*\//),r=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,n=/\s/,h=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(A,C){this._source_text=A||"",this._options=new f(C),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}x.prototype.eatString=function(A){var C="";for(this._ch=this._input.next();this._ch;){if(C+=this._ch,this._ch==="\\")C+=this._input.next();else if(A.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return C},x.prototype.eatWhitespace=function(A){for(var C=n.test(this._input.peek()),b=0;n.test(this._input.peek());)this._ch=this._input.next(),A&&this._ch===`
|
|
`&&((b===0||b<this._options.max_preserve_newlines)&&(b++,this._output.add_new_line(!0)));return C},x.prototype.foundNestedPseudoClass=function(){for(var A=0,C=1,b=this._input.peek(C);b;){if(b==="{")return!0;if(b==="(")A+=1;else if(b===")"){if(A===0)return!1;A-=1}else if(b===";"||b==="}")return!1;C++,b=this._input.peek(C)}return!1},x.prototype.print_string=function(A){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(A)},x.prototype.preserveSingleSpace=function(A){A&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A=this._source_text,C=this._options.eol;C==="auto"&&(C=`
|
|
`,A&&r.test(A||"")&&(C=A.match(r)[0])),A=A.replace(a,`
|
|
`);var b=A.match(/^[\t ]*/)[0];this._output=new u(this._options,b),this._input=new d(A),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var v=0,p=!1,c=!1,E=!1,y=!1,_=!1,P=!1,N=this._ch,K=!1,$,B,R;$=this._input.read(h),B=$!=="",R=N,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),N=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(O),Q=l.get_directives(G);Q&&Q.ignore==="start"&&(G+=l.readIgnored(this._input)),this.print_string(G),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(S)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(B),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ne=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ne.match(/[ :]$/)&&(ne=this.eatString(": ").replace(/\s$/,""),this.print_string(ne),this._output.space_before_token=!0),ne=ne.replace(/\s$/,""),ne==="extend"?y=!0:ne==="import"&&(_=!0),ne in this.NESTED_AT_RULE?(this._nestedLevel+=1,ne in this.CONDITIONAL_GROUP_RULE&&(E=!0)):!p&&v===0&&ne.indexOf(":")!==-1&&(c=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(B),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")c&&(c=!1,this.outdent()),E?(E=!1,p=this._indentLevel>=this._nestedLevel):p=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&p&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(R==="("?this._output.space_before_token=!1:R!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),R==="{"&&this._output.trim(!0),_=!1,y=!1,c&&(this.outdent(),c=!1),this.print_string(this._ch),p=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var le=0;le<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;le++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[le])){K=!0;break}(p||E)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!y&&v===0?(this.print_string(":"),c||(c=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var _e=R==='"'||R==="'";this.preserveSingleSpace(_e||B),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")K=!1,v===0?(c&&(this.outdent(),c=!1),y=!1,_=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),v++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),v&&(v--,this.outdent()));else{var pe=!1;this._input.lookBack("with")&&(pe=!0),this.preserveSingleSpace(B||pe),this.print_string(this._ch),c&&R==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),P=!0):(this.eatWhitespace(),v++,this.indent())}else if(this._ch===")")v&&(v--,this.outdent()),P&&this._input.peek()===";"&&this._options.selector_separator_newline&&(P=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!c||P)&&v===0&&!_&&!y?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!c&&v===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&n.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(B),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),n.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Ee=R==='"'||R==="'";this.preserveSingleSpace(Ee||B),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&K&&this._output.add_new_line()}var Oe=this._output.get_code(C);return Oe},D.exports.Beautifier=x},function(D,I,g){var f=g(6).Options;function u(d){f.call(this,d,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var s=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||s;var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var r=0;r<l.length;r++)l[r]!=="expand"?this.brace_style="collapse":this.brace_style=l[r]}u.prototype=new f,D.exports.Options=u}],L={};function H(D){var I=L[D];if(I!==void 0)return I.exports;var g=L[D]={exports:{}};return U[D](g,g.exports,H),g.exports}var F=H(15);M=F})();var z=M;!(q=[],V=function(){return{css_beautify:z}}.apply(Se,q),V!==void 0&&(Fe.exports=V))})()},U7T7:function(Fe,Se,W){},UZu5:function(Fe,Se,W){},"VrN/":function(Fe,Se,W){(function(q,V){Fe.exports=V()})(this,function(){"use strict";var q=navigator.userAgent,V=navigator.platform,M=/gecko\/\d/i.test(q),z=/MSIE \d/.test(q),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),L=/Edge\/(\d+)/.exec(q),H=z||U||L,F=H&&(z?document.documentMode||6:+(L||U)[1]),D=!L&&/WebKit\//.test(q),I=D&&/Qt\/\d+\.\d+/.test(q),g=!L&&/Chrome\//.test(q),f=/Opera\//.test(q),u=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),s=/PhantomJS/.test(q),l=!L&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),r=/Android/.test(q),a=l||r||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),n=l||/Mac/.test(V),h=/\bCrOS\b/.test(q),O=/win/i.test(V),S=f&&q.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(f=!1,D=!0);var x=n&&(I||f&&(S==null||S<12.11)),A=M||H&&F>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var b=function(e,t){var o=e.className,i=C(t).exec(o);if(i){var m=o.slice(i.index+i[0].length);e.className=o.slice(0,i.index)+(m?i[1]+m:"")}};function v(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function p(e,t){return v(e).appendChild(t)}function c(e,t,o,i){var m=document.createElement(e);if(o&&(m.className=o),i&&(m.style.cssText=i),typeof t=="string")m.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)m.appendChild(t[k]);return m}function E(e,t,o,i){var m=c(e,t,o,i);return m.setAttribute("role","presentation"),m}var y;document.createRange?y=function(e,t,o,i){var m=document.createRange();return m.setEnd(i||e,o),m.setStart(e,t),m}:y=function(e,t,o){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(m){return i}return i.collapse(!0),i.moveEnd("character",o),i.moveStart("character",t),i};function _(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function N(e,t){var o=e.className;C(t).test(o)||(e.className+=(o?" ":"")+t)}function K(e,t){for(var o=e.split(" "),i=0;i<o.length;i++)o[i]&&!C(o[i]).test(t)&&(t+=" "+o[i]);return t}var $=function(e){e.select()};l?$=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&($=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 R(e,t,o){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(o!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function G(e,t,o,i,m){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=i||0,Y=m||0;;){var Z=e.indexOf(" ",k);if(Z<0||Z>=t)return Y+(t-k);Y+=Z-k,Y+=o-Y%o,k=Z+1}}var Q=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};Q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Q.prototype.set=function(e,t){this.f=t;var o=+new Date+e;(!this.id||o<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=o)};function ne(e,t){for(var o=0;o<e.length;++o)if(e[o]==t)return o;return-1}var le=50,_e={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},Ee={origin:"*mouse"},Oe={origin:"+move"};function we(e,t,o){for(var i=0,m=0;;){var k=e.indexOf(" ",i);k==-1&&(k=e.length);var Y=k-i;if(k==e.length||m+Y>=t)return i+Math.min(Y,t-m);if(m+=k-i,m+=o-m%o,i=k+1,m>=t)return i}}var he=[""];function oe(e){for(;he.length<=e;)he.push(Le(he)+" ");return he[e]}function Le(e){return e[e.length-1]}function Ye(e,t){for(var o=[],i=0;i<e.length;i++)o[i]=t(e[i],i);return o}function nt(e,t,o){for(var i=0,m=o(t);i<e.length&&o(e[i])<=m;)i++;e.splice(i,0,t)}function qe(){}function it(e,t){var o;return Object.create?o=Object.create(e):(qe.prototype=e,o=new qe),t&&R(t,o),o}var He=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function $e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||He.test(e))}function Qe(e,t){return t?t.source.indexOf("\\w")>-1&&$e(e)?!0:t.test(e):$e(e)}function gt(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var et=/[\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 tt(e){return e.charCodeAt(0)>=768&&et.test(e)}function Je(e,t,o){for(;(o<0?t>0:t<e.length)&&tt(e.charAt(t));)t+=o;return t}function vt(e,t,o){for(var i=t>o?-1:1;;){if(t==o)return t;var m=(t+o)/2,k=i<0?Math.ceil(m):Math.floor(m);if(k==t)return e(k)?t:o;e(k)?o=k:t=k+i}}function wt(e,t,o,i){if(!e)return i(t,o,"ltr",0);for(var m=!1,k=0;k<e.length;++k){var Y=e[k];(Y.from<o&&Y.to>t||t==o&&Y.to==t)&&(i(Math.max(Y.from,t),Math.min(Y.to,o),Y.level==1?"rtl":"ltr",k),m=!0)}m||i(t,o,"ltr")}var Et=null;function xt(e,t,o){var i;Et=null;for(var m=0;m<e.length;++m){var k=e[m];if(k.from<t&&k.to>t)return m;k.to==t&&(k.from!=k.to&&o=="before"?i=m:Et=m),k.from==t&&(k.from!=k.to&&o!="before"?i=m:Et=m)}return i!=null?i:Et}var kt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function o(ie){return ie<=247?e.charAt(ie):1424<=ie&&ie<=1524?"R":1536<=ie&&ie<=1785?t.charAt(ie-1536):1774<=ie&&ie<=2220?"r":8192<=ie&&ie<=8203?"w":ie==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,m=/[stwN]/,k=/[LRr]/,Y=/[Lb1n]/,Z=/[1n]/;function te(ie,me,xe){this.level=ie,this.from=me,this.to=xe}return function(ie,me){var xe=me=="ltr"?"L":"R";if(ie.length==0||me=="ltr"&&!i.test(ie))return!1;for(var Ne=ie.length,De=[],Ze=0;Ze<Ne;++Ze)De.push(o(ie.charCodeAt(Ze)));for(var lt=0,_t=xe;lt<Ne;++lt){var Lt=De[lt];Lt=="m"?De[lt]=_t:_t=Lt}for(var Ut=0,It=xe;Ut<Ne;++Ut){var jt=De[Ut];jt=="1"&&It=="r"?De[Ut]="n":k.test(jt)&&(It=jt,jt=="r"&&(De[Ut]="R"))}for(var Yt=1,Vt=De[0];Yt<Ne-1;++Yt){var un=De[Yt];un=="+"&&Vt=="1"&&De[Yt+1]=="1"?De[Yt]="1":un==","&&Vt==De[Yt+1]&&(Vt=="1"||Vt=="n")&&(De[Yt]=Vt),Vt=un}for(var Nn=0;Nn<Ne;++Nn){var hi=De[Nn];if(hi==",")De[Nn]="N";else if(hi=="%"){var Gn=void 0;for(Gn=Nn+1;Gn<Ne&&De[Gn]=="%";++Gn);for(var ji=Nn&&De[Nn-1]=="!"||Gn<Ne&&De[Gn]=="1"?"1":"N",Di=Nn;Di<Gn;++Di)De[Di]=ji;Nn=Gn-1}}for(var ni=0,Mi=xe;ni<Ne;++ni){var yi=De[ni];Mi=="L"&&yi=="1"?De[ni]="L":k.test(yi)&&(Mi=yi)}for(var si=0;si<Ne;++si)if(m.test(De[si])){var ii=void 0;for(ii=si+1;ii<Ne&&m.test(De[ii]);++ii);for(var Yn=(si?De[si-1]:xe)=="L",Pi=(ii<Ne?De[ii]:xe)=="L",Fr=Yn==Pi?Yn?"L":"R":xe,fr=si;fr<ii;++fr)De[fr]=Fr;si=ii-1}for(var Ti=[],tr,fi=0;fi<Ne;)if(Y.test(De[fi])){var co=fi;for(++fi;fi<Ne&&Y.test(De[fi]);++fi);Ti.push(new te(0,co,fi))}else{var ar=fi,Er=Ti.length,xr=me=="rtl"?1:0;for(++fi;fi<Ne&&De[fi]!="L";++fi);for(var Ai=ar;Ai<fi;)if(Z.test(De[Ai])){ar<Ai&&(Ti.splice(Er,0,new te(1,ar,Ai)),Er+=xr);var Br=Ai;for(++Ai;Ai<fi&&Z.test(De[Ai]);++Ai);Ti.splice(Er,0,new te(2,Br,Ai)),Er+=xr,ar=Ai}else++Ai;ar<fi&&Ti.splice(Er,0,new te(1,ar,fi))}return me=="ltr"&&(Ti[0].level==1&&(tr=ie.match(/^\s+/))&&(Ti[0].from=tr[0].length,Ti.unshift(new te(0,0,tr[0].length))),Le(Ti).level==1&&(tr=ie.match(/\s+$/))&&(Le(Ti).to-=tr[0].length,Ti.push(new te(0,Ne-tr[0].length,Ne)))),me=="rtl"?Ti.reverse():Ti}}();function Ot(e,t){var o=e.order;return o==null&&(o=e.order=kt(e.text,t)),o}var Ae=[],Ce=function(e,t,o){if(e.addEventListener)e.addEventListener(t,o,!1);else if(e.attachEvent)e.attachEvent("on"+t,o);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Ae).concat(o)}};function Ge(e,t){return e._handlers&&e._handlers[t]||Ae}function ze(e,t,o){if(e.removeEventListener)e.removeEventListener(t,o,!1);else if(e.detachEvent)e.detachEvent("on"+t,o);else{var i=e._handlers,m=i&&i[t];if(m){var k=ne(m,o);k>-1&&(i[t]=m.slice(0,k).concat(m.slice(k+1)))}}}function Re(e,t){var o=Ge(e,t);if(!o.length)return;for(var i=Array.prototype.slice.call(arguments,2),m=0;m<o.length;++m)o[m].apply(null,i)}function je(e,t,o){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,o||t.type,e,t),ue(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var o=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ne(o,t[i])==-1&&o.push(t[i])}function de(e,t){return Ge(e,t).length>0}function ce(e){e.prototype.on=function(t,o){Ce(this,t,o)},e.prototype.off=function(t,o){ze(this,t,o)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function fe(e){re(e),ae(e)}function be(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),n&&e.ctrlKey&&t==1&&(t=3),t}var Xe=function(){if(H&&F<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e}(),ut;function bt(e){if(ut==null){var t=c("span","\u200B");p(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ut=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&F<8))}var o=ut?c("span","\u200B"):c("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return o.setAttribute("cm-text",""),o}var ft;function at(e){if(ft!=null)return ft;var t=p(e,document.createTextNode("A\u062EA")),o=y(t,0,1).getBoundingClientRect(),i=y(t,1,2).getBoundingClientRect();return v(e),!o||o.left==o.right?!1:ft=i.right-o.right<3}var Be=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,o=[],i=e.length;t<=i;){var m=e.indexOf(`
|
|
`,t);m==-1&&(m=e.length);var k=e.slice(t,e.charAt(m-1)=="\r"?m-1:m),Y=k.indexOf("\r");Y!=-1?(o.push(k.slice(0,Y)),t+=Y+1):(o.push(k),t=m+1)}return o}:function(e){return e.split(/\r\n?|\n/)},We=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(o){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Me=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),se=null;function ve(e){if(se!=null)return se;var t=p(e,c("span","x")),o=t.getBoundingClientRect(),i=y(t,0,1).getBoundingClientRect();return se=Math.abs(o.left-i.left)>1}var Ke={},Pe={};function st(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ke[e]=t}function dt(e,t){Pe[e]=t}function Te(e){if(typeof e=="string"&&Pe.hasOwnProperty(e))e=Pe[e];else if(e&&typeof e.name=="string"&&Pe.hasOwnProperty(e.name)){var t=Pe[e.name];typeof t=="string"&&(t={name:t}),e=it(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Te("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Te("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function ke(e,t){t=Te(t);var o=Ke[t.name];if(!o)return ke(e,"text/plain");var i=o(e,t);if(rt.hasOwnProperty(t.name)){var m=rt[t.name];for(var k in m){if(!m.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=m[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var Y in t.modeProps)i[Y]=t.modeProps[Y];return i}var rt={};function Ct(e,t){var o=rt.hasOwnProperty(e)?rt[e]:rt[e]={};R(t,o)}function At(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var o={};for(var i in t){var m=t[i];m instanceof Array&&(m=m.concat([])),o[i]=m}return o}function cn(e,t){for(var o;e.innerMode&&!(o=e.innerMode(t),!o||o.mode==e);)t=o.state,e=o.mode;return o||{mode:e,state:t}}function yn(e,t,o){return e.startState?e.startState(t,o):!0}var en=function(e,t,o){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=o};en.prototype.eol=function(){return this.pos>=this.string.length},en.prototype.sol=function(){return this.pos==this.lineStart},en.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},en.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},en.prototype.eat=function(e){var t=this.string.charAt(this.pos),o;if(typeof e=="string"?o=t==e:o=t&&(e.test?e.test(t):e(t)),o)return++this.pos,t},en.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},en.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},en.prototype.skipToEnd=function(){this.pos=this.string.length},en.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},en.prototype.backUp=function(e){this.pos-=e},en.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},en.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},en.prototype.match=function(e,t,o){if(typeof e=="string"){var i=function(Y){return o?Y.toLowerCase():Y},m=this.string.substr(this.pos,e.length);if(i(m)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},en.prototype.current=function(){return this.string.slice(this.start,this.pos)},en.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},en.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},en.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Dt(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 o=e;!o.lines;)for(var i=0;;++i){var m=o.children[i],k=m.chunkSize();if(t<k){o=m;break}t-=k}return o.lines[t]}function Rn(e,t,o){var i=[],m=t.line;return e.iter(t.line,o.line+1,function(k){var Y=k.text;m==o.line&&(Y=Y.slice(0,o.ch)),m==t.line&&(Y=Y.slice(t.ch)),i.push(Y),++m}),i}function Fn(e,t,o){var i=[];return e.iter(t,o,function(m){i.push(m.text)}),i}function Cn(e,t){var o=t-e.height;if(o)for(var i=e;i;i=i.parent)i.height+=o}function Qt(e){if(e.parent==null)return null;for(var t=e.parent,o=ne(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var m=0;!(i.children[m]==t);++m)o+=i.children[m].chunkSize();return o+t.first}function Sn(e,t){var o=e.first;e:do{for(var i=0;i<e.children.length;++i){var m=e.children[i],k=m.height;if(t<k){e=m;continue e}t-=k,o+=m.chunkSize()}return o}while(!e.lines);for(var Y=0;Y<e.lines.length;++Y){var Z=e.lines[Y],te=Z.height;if(t<te)break;t-=te}return o+Y}function Bn(e,t){return t>=e.first&&t<e.first+e.size}function li(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ct(e,t,o){if(o===void 0&&(o=null),!(this instanceof ct))return new ct(e,t,o);this.line=e,this.ch=t,this.sticky=o}function St(e,t){return e.line-t.line||e.ch-t.ch}function zn(e,t){return e.sticky==t.sticky&&St(e,t)==0}function pi(e){return ct(e.line,e.ch)}function ui(e,t){return St(e,t)<0?t:e}function ki(e,t){return St(e,t)<0?e:t}function J(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function w(e,t){if(t.line<e.first)return ct(e.first,0);var o=e.first+e.size-1;return t.line>o?ct(o,Dt(e,o).text.length):T(t,Dt(e,t.line).text.length)}function T(e,t){var o=e.ch;return o==null||o>t?ct(e.line,t):o<0?ct(e.line,0):e}function j(e,t){for(var o=[],i=0;i<t.length;i++)o[i]=w(e,t[i]);return o}var ee=function(e,t){this.state=e,this.lookAhead=t},X=function(e,t,o,i){this.state=t,this.doc=e,this.line=o,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};X.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},X.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}},X.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},X.fromSaved=function(e,t,o){return t instanceof ee?new X(e,At(e.mode,t.state),o,t.lookAhead):new X(e,At(e.mode,t),o)},X.prototype.save=function(e){var t=e!==!1?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ee(t,this.maxLookAhead):t};function ye(e,t,o,i){var m=[e.state.modeGen],k={};Tt(e,t.text,e.doc.mode,o,function(ie,me){return m.push(ie,me)},k,i);for(var Y=o.state,Z=function(ie){o.baseTokens=m;var me=e.state.overlays[ie],xe=1,Ne=0;o.state=!0,Tt(e,t.text,me.mode,o,function(De,Ze){for(var lt=xe;Ne<De;){var _t=m[xe];_t>De&&m.splice(xe,1,De,m[xe+1],_t),xe+=2,Ne=Math.min(De,_t)}if(!Ze)return;if(me.opaque)m.splice(lt,xe-lt,De,"overlay "+Ze),xe=lt+2;else for(;lt<xe;lt+=2){var Lt=m[lt+1];m[lt+1]=(Lt?Lt+" ":"")+"overlay "+Ze}},k),o.state=Y,o.baseTokens=null,o.baseTokenPos=1},te=0;te<e.state.overlays.length;++te)Z(te);return{styles:m,classes:k.bgClass||k.textClass?k:null}}function Ve(e,t,o){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=ot(e,Qt(t)),m=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,i.state),k=ye(e,t,i);m&&(i.state=m),t.stateAfter=i.save(!m),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),o===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ot(e,t,o){var i=e.doc,m=e.display;if(!i.mode.startState)return new X(i,!0,t);var k=qt(e,t,o),Y=k>i.first&&Dt(i,k-1).stateAfter,Z=Y?X.fromSaved(i,Y,k):new X(i,yn(i.mode),k);return i.iter(k,t,function(te){ht(e,te.text,Z);var ie=Z.line;te.stateAfter=ie==t-1||ie%5==0||ie>=m.viewFrom&&ie<m.viewTo?Z.save():null,Z.nextLine()}),o&&(i.modeFrontier=Z.line),Z}function ht(e,t,o,i){var m=e.doc.mode,k=new en(t,e.options.tabSize,o);for(k.start=k.pos=i||0,t==""&&Ue(m,o.state);!k.eol();)mt(m,k,o.state),k.start=k.pos}function Ue(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var o=cn(e,t);if(o.mode.blankLine)return o.mode.blankLine(o.state)}function mt(e,t,o,i){for(var m=0;m<10;m++){i&&(i[0]=cn(e,o).mode);var k=e.token(t,o);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Rt=function(e,t,o){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=o};function Mt(e,t,o,i){var m=e.doc,k=m.mode,Y;t=w(m,t);var Z=Dt(m,t.line),te=ot(e,t.line,o),ie=new en(Z.text,e.options.tabSize,te),me;for(i&&(me=[]);(i||ie.pos<t.ch)&&!ie.eol();)ie.start=ie.pos,Y=mt(k,ie,te.state),i&&me.push(new Rt(ie,Y,At(m.mode,te.state)));return i?me:new Rt(ie,Y,te.state)}function Jt(e,t){if(e)for(;;){var o=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!o)break;e=e.slice(0,o.index)+e.slice(o.index+o[0].length);var i=o[1]?"bgClass":"textClass";t[i]==null?t[i]=o[2]:new RegExp("(?:^|\\s)"+o[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+o[2])}return e}function Tt(e,t,o,i,m,k,Y){var Z=o.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var te=0,ie=null,me=new en(t,e.options.tabSize,i),xe,Ne=e.options.addModeClass&&[null];for(t==""&&Jt(Ue(o,i.state),k);!me.eol();){if(me.pos>e.options.maxHighlightLength?(Z=!1,Y&&ht(e,t,i,me.pos),me.pos=t.length,xe=null):xe=Jt(mt(o,me,i.state,Ne),k),Ne){var De=Ne[0].name;De&&(xe="m-"+(xe?De+" "+xe:De))}if(!Z||ie!=xe){for(;te<me.start;)te=Math.min(me.start,te+5e3),m(te,ie);ie=xe}me.start=me.pos}for(;te<me.pos;){var Ze=Math.min(me.pos,te+5e3);m(Ze,ie),te=Ze}}function qt(e,t,o){for(var i,m,k=e.doc,Y=o?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>Y;--Z){if(Z<=k.first)return k.first;var te=Dt(k,Z-1),ie=te.stateAfter;if(ie&&(!o||Z+(ie instanceof ee?ie.lookAhead:0)<=k.modeFrontier))return Z;var me=G(te.text,null,e.options.tabSize);(m==null||i>me)&&(m=Z-1,i=me)}return m}function Zt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var o=e.first,i=t-1;i>o;i--){var m=Dt(e,i).stateAfter;if(m&&(!(m instanceof ee)||i+m.lookAhead<t)){o=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,o)}var Mn=!1,Gt=!1;function wn(){Mn=!0}function On(){Gt=!0}function Ln(e,t,o){this.marker=e,this.from=t,this.to=o}function xn(e,t){if(e)for(var o=0;o<e.length;++o){var i=e[o];if(i.marker==t)return i}}function In(e,t){for(var o,i=0;i<e.length;++i)e[i]!=t&&(o||(o=[])).push(e[i]);return o}function Hn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function ri(e,t,o){var i;if(e)for(var m=0;m<e.length;++m){var k=e[m],Y=k.marker,Z=k.from==null||(Y.inclusiveLeft?k.from<=t:k.from<t);if(Z||k.from==t&&Y.type=="bookmark"&&(!o||!k.marker.insertLeft)){var te=k.to==null||(Y.inclusiveRight?k.to>=t:k.to>t);(i||(i=[])).push(new Ln(Y,k.from,te?null:k.to))}}return i}function Vn(e,t,o){var i;if(e)for(var m=0;m<e.length;++m){var k=e[m],Y=k.marker,Z=k.to==null||(Y.inclusiveRight?k.to>=t:k.to>t);if(Z||k.from==t&&Y.type=="bookmark"&&(!o||k.marker.insertLeft)){var te=k.from==null||(Y.inclusiveLeft?k.from<=t:k.from<t);(i||(i=[])).push(new Ln(Y,te?null:k.from-t,k.to==null?null:k.to-t))}}return i}function _n(e,t){if(t.full)return null;var o=Bn(e,t.from.line)&&Dt(e,t.from.line).markedSpans,i=Bn(e,t.to.line)&&Dt(e,t.to.line).markedSpans;if(!o&&!i)return null;var m=t.from.ch,k=t.to.ch,Y=St(t.from,t.to)==0,Z=ri(o,m,Y),te=Vn(i,k,Y),ie=t.text.length==1,me=Le(t.text).length+(ie?m:0);if(Z)for(var xe=0;xe<Z.length;++xe){var Ne=Z[xe];if(Ne.to==null){var De=xn(te,Ne.marker);De?ie&&(Ne.to=De.to==null?null:De.to+me):Ne.to=m}}if(te)for(var Ze=0;Ze<te.length;++Ze){var lt=te[Ze];if(lt.to!=null&&(lt.to+=me),lt.from==null){var _t=xn(Z,lt.marker);_t||(lt.from=me,ie&&(Z||(Z=[])).push(lt))}else lt.from+=me,ie&&(Z||(Z=[])).push(lt)}Z&&(Z=jn(Z)),te&&te!=Z&&(te=jn(te));var Lt=[Z];if(!ie){var Ut=t.text.length-2,It;if(Ut>0&&Z)for(var jt=0;jt<Z.length;++jt)Z[jt].to==null&&(It||(It=[])).push(new Ln(Z[jt].marker,null,null));for(var Yt=0;Yt<Ut;++Yt)Lt.push(It);Lt.push(te)}return Lt}function jn(e){for(var t=0;t<e.length;++t){var o=e[t];o.from!=null&&o.from==o.to&&o.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function dn(e,t,o){var i=null;if(e.iter(t.line,o.line+1,function(De){if(De.markedSpans)for(var Ze=0;Ze<De.markedSpans.length;++Ze){var lt=De.markedSpans[Ze].marker;lt.readOnly&&(!i||ne(i,lt)==-1)&&(i||(i=[])).push(lt)}}),!i)return null;for(var m=[{from:t,to:o}],k=0;k<i.length;++k)for(var Y=i[k],Z=Y.find(0),te=0;te<m.length;++te){var ie=m[te];if(St(ie.to,Z.from)<0||St(ie.from,Z.to)>0)continue;var me=[te,1],xe=St(ie.from,Z.from),Ne=St(ie.to,Z.to);(xe<0||!Y.inclusiveLeft&&!xe)&&me.push({from:ie.from,to:Z.from}),(Ne>0||!Y.inclusiveRight&&!Ne)&&me.push({from:Z.to,to:ie.to}),m.splice.apply(m,me),te+=me.length-3}return m}function pn(e){var t=e.markedSpans;if(!t)return;for(var o=0;o<t.length;++o)t[o].marker.detachLine(e);e.markedSpans=null}function mn(e,t){if(!t)return;for(var o=0;o<t.length;++o)t[o].marker.attachLine(e);e.markedSpans=t}function zt(e){return e.inclusiveLeft?-1:0}function yt(e){return e.inclusiveRight?1:0}function Wt(e,t){var o=e.lines.length-t.lines.length;if(o!=0)return o;var i=e.find(),m=t.find(),k=St(i.from,m.from)||zt(e)-zt(t);if(k)return-k;var Y=St(i.to,m.to)||yt(e)-yt(t);return Y||t.id-e.id}function pt(e,t){var o=Gt&&e.markedSpans,i;if(o)for(var m=void 0,k=0;k<o.length;++k)m=o[k],m.marker.collapsed&&(t?m.from:m.to)==null&&(!i||Wt(i,m.marker)<0)&&(i=m.marker);return i}function $t(e){return pt(e,!0)}function Nt(e){return pt(e,!1)}function Xn(e,t){var o=Gt&&e.markedSpans,i;if(o)for(var m=0;m<o.length;++m){var k=o[m];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!i||Wt(i,k.marker)<0)&&(i=k.marker)}return i}function sn(e,t,o,i,m){var k=Dt(e,t),Y=Gt&&k.markedSpans;if(Y)for(var Z=0;Z<Y.length;++Z){var te=Y[Z];if(!te.marker.collapsed)continue;var ie=te.marker.find(0),me=St(ie.from,o)||zt(te.marker)-zt(m),xe=St(ie.to,i)||yt(te.marker)-yt(m);if(me>=0&&xe<=0||me<=0&&xe>=0)continue;if(me<=0&&(te.marker.inclusiveRight&&m.inclusiveLeft?St(ie.to,o)>=0:St(ie.to,o)>0)||me>=0&&(te.marker.inclusiveRight&&m.inclusiveLeft?St(ie.from,i)<=0:St(ie.from,i)<0))return!0}}function Zn(e){for(var t;t=$t(e);)e=t.find(-1,!0).line;return e}function Ki(e){for(var t;t=Nt(e);)e=t.find(1,!0).line;return e}function Ci(e){for(var t,o;t=Nt(e);)e=t.find(1,!0).line,(o||(o=[])).push(e);return o}function Vi(e,t){var o=Dt(e,t),i=Zn(o);return o==i?t:Qt(i)}function Ni(e,t){if(t>e.lastLine())return t;var o=Dt(e,t),i;if(!Ri(e,o))return t;for(;i=Nt(o);)o=i.find(1,!0).line;return Qt(o)+1}function Ri(e,t){var o=Gt&&t.markedSpans;if(o)for(var i=void 0,m=0;m<o.length;++m){if(i=o[m],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&Gi(e,t,i))return!0}}function Gi(e,t,o){if(o.to==null){var i=o.marker.find(1,!0);return Gi(e,i.line,xn(i.line.markedSpans,o.marker))}if(o.marker.inclusiveRight&&o.to==t.text.length)return!0;for(var m=void 0,k=0;k<t.markedSpans.length;++k)if(m=t.markedSpans[k],m.marker.collapsed&&!m.marker.widgetNode&&m.from==o.to&&(m.to==null||m.to!=o.from)&&(m.marker.inclusiveLeft||o.marker.inclusiveRight)&&Gi(e,t,m))return!0}function Kn(e){e=Zn(e);for(var t=0,o=e.parent,i=0;i<o.lines.length;++i){var m=o.lines[i];if(m==e)break;t+=m.height}for(var k=o.parent;k;o=k,k=o.parent)for(var Y=0;Y<k.children.length;++Y){var Z=k.children[Y];if(Z==o)break;t+=Z.height}return t}function Ht(e){if(e.height==0)return 0;for(var t=e.text.length,o,i=e;o=$t(i);){var m=o.find(0,!0);i=m.from.line,t+=m.from.ch-m.to.ch}for(i=e;o=Nt(i);){var k=o.find(0,!0);t-=i.text.length-k.from.ch,i=k.to.line,t+=i.text.length-k.to.ch}return t}function Xi(e){var t=e.display,o=e.doc;t.maxLine=Dt(o,o.first),t.maxLineLength=Ht(t.maxLine),t.maxLineChanged=!0,o.iter(function(i){var m=Ht(i);m>t.maxLineLength&&(t.maxLineLength=m,t.maxLine=i)})}var _i=function(e,t,o){this.text=e,mn(this,t),this.height=o?o(this):1};_i.prototype.lineNo=function(){return Qt(this)},ce(_i);function nr(e,t,o,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),pn(e),mn(e,o);var m=i?i(e):1;m!=e.height&&Cn(e,m)}function Ft(e){e.parent=null,pn(e)}var Xt={},Kt={};function tn(e,t){if(!e||/^\s*$/.test(e))return null;var o=t.addModeClass?Kt:Xt;return o[e]||(o[e]=e.replace(/\S+/g,"cm-$&"))}function rn(e,t){var o=E("span",null,null,D?"padding-right: .1px":null),i={pre:E("pre",[o],"CodeMirror-line"),content:o,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var m=0;m<=(t.rest?t.rest.length:0);m++){var k=m?t.rest[m-1]:t.line,Y=void 0;i.pos=0,i.addToken=ln,at(e.display.measure)&&(Y=Ot(k,e.doc.direction))&&(i.addToken=ai(i.addToken,Y)),i.map=[];var Z=t!=e.display.externalMeasured&&Qt(k);bi(k,i,Ve(e,k,Z)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=K(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=K(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(bt(e.display.measure))),m==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var te=i.content.lastChild;(/\bcm-tab\b/.test(te.className)||te.querySelector&&te.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=K(i.pre.className,i.textClass||"")),i}function Tn(e){var t=c("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ln(e,t,o,i,m,k,Y){if(!t)return;var Z=e.splitSpaces?Un(t,e.trailingSpace):t,te=e.cm.state.specialChars,ie=!1,me;if(!te.test(t))e.col+=t.length,me=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,me),H&&F<9&&(ie=!0),e.pos+=t.length;else{me=document.createDocumentFragment();for(var xe=0;;){te.lastIndex=xe;var Ne=te.exec(t),De=Ne?Ne.index-xe:t.length-xe;if(De){var Ze=document.createTextNode(Z.slice(xe,xe+De));H&&F<9?me.appendChild(c("span",[Ze])):me.appendChild(Ze),e.map.push(e.pos,e.pos+De,Ze),e.col+=De,e.pos+=De}if(!Ne)break;xe+=De+1;var lt=void 0;if(Ne[0]==" "){var _t=e.cm.options.tabSize,Lt=_t-e.col%_t;lt=me.appendChild(c("span",oe(Lt),"cm-tab")),lt.setAttribute("role","presentation"),lt.setAttribute("cm-text"," "),e.col+=Lt}else Ne[0]=="\r"||Ne[0]==`
|
|
`?(lt=me.appendChild(c("span",Ne[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),lt.setAttribute("cm-text",Ne[0]),e.col+=1):(lt=e.cm.options.specialCharPlaceholder(Ne[0]),lt.setAttribute("cm-text",Ne[0]),H&&F<9?me.appendChild(c("span",[lt])):me.appendChild(lt),e.col+=1);e.map.push(e.pos,e.pos+1,lt),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,o||i||m||ie||k||Y){var Ut=o||"";i&&(Ut+=i),m&&(Ut+=m);var It=c("span",[me],Ut,k);if(Y)for(var jt in Y)Y.hasOwnProperty(jt)&&jt!="style"&&jt!="class"&&It.setAttribute(jt,Y[jt]);return e.content.appendChild(It)}e.content.appendChild(me)}function Un(e,t){if(e.length>1&&!/ /.test(e))return e;for(var o=t,i="",m=0;m<e.length;m++){var k=e.charAt(m);k==" "&&o&&(m==e.length-1||e.charCodeAt(m+1)==32)&&(k="\xA0"),i+=k,o=k==" "}return i}function ai(e,t){return function(o,i,m,k,Y,Z,te){m=m?m+" cm-force-border":"cm-force-border";for(var ie=o.pos,me=ie+i.length;;){for(var xe=void 0,Ne=0;Ne<t.length&&!(xe=t[Ne],xe.to>ie&&xe.from<=ie);Ne++);if(xe.to>=me)return e(o,i,m,k,Y,Z,te);e(o,i.slice(0,xe.to-ie),m,k,null,Z,te),k=null,i=i.slice(xe.to-ie),ie=xe.to}}}function nn(e,t,o,i){var m=!i&&o.widgetNode;m&&e.map.push(e.pos,e.pos+t,m),!i&&e.cm.display.input.needsContentAttribute&&(m||(m=e.content.appendChild(document.createElement("span"))),m.setAttribute("cm-marker",o.id)),m&&(e.cm.display.input.setUneditable(m),e.content.appendChild(m)),e.pos+=t,e.trailingSpace=!1}function bi(e,t,o){var i=e.markedSpans,m=e.text,k=0;if(!i){for(var Y=1;Y<o.length;Y+=2)t.addToken(t,m.slice(k,k=o[Y]),tn(o[Y+1],t.cm.options));return}for(var Z=m.length,te=0,ie=1,me="",xe,Ne,De=0,Ze,lt,_t,Lt,Ut;;){if(De==te){Ze=lt=_t=Ne="",Ut=null,Lt=null,De=Infinity;for(var It=[],jt=void 0,Yt=0;Yt<i.length;++Yt){var Vt=i[Yt],un=Vt.marker;if(un.type=="bookmark"&&Vt.from==te&&un.widgetNode)It.push(un);else if(Vt.from<=te&&(Vt.to==null||Vt.to>te||un.collapsed&&Vt.to==te&&Vt.from==te)){if(Vt.to!=null&&Vt.to!=te&&De>Vt.to&&(De=Vt.to,lt=""),un.className&&(Ze+=" "+un.className),un.css&&(Ne=(Ne?Ne+";":"")+un.css),un.startStyle&&Vt.from==te&&(_t+=" "+un.startStyle),un.endStyle&&Vt.to==De&&(jt||(jt=[])).push(un.endStyle,Vt.to),un.title&&((Ut||(Ut={})).title=un.title),un.attributes)for(var Nn in un.attributes)(Ut||(Ut={}))[Nn]=un.attributes[Nn];un.collapsed&&(!Lt||Wt(Lt.marker,un)<0)&&(Lt=Vt)}else Vt.from>te&&De>Vt.from&&(De=Vt.from)}if(jt)for(var hi=0;hi<jt.length;hi+=2)jt[hi+1]==De&&(lt+=" "+jt[hi]);if(!Lt||Lt.from==te)for(var Gn=0;Gn<It.length;++Gn)nn(t,0,It[Gn]);if(Lt&&(Lt.from||0)==te){if(nn(t,(Lt.to==null?Z+1:Lt.to)-te,Lt.marker,Lt.from==null),Lt.to==null)return;Lt.to==te&&(Lt=!1)}}if(te>=Z)break;for(var ji=Math.min(Z,De);;){if(me){var Di=te+me.length;if(!Lt){var ni=Di>ji?me.slice(0,ji-te):me;t.addToken(t,ni,xe?xe+Ze:Ze,_t,te+ni.length==De?lt:"",Ne,Ut)}if(Di>=ji){me=me.slice(ji-te),te=ji;break}te=Di,_t=""}me=m.slice(k,k=o[ie++]),xe=tn(o[ie++],t.cm.options)}}}function bn(e,t,o){this.line=t,this.rest=Ci(t),this.size=this.rest?Qt(Le(this.rest))-o+1:1,this.node=this.text=null,this.hidden=Ri(e,t)}function Qn(e,t,o){for(var i=[],m,k=t;k<o;k=m){var Y=new bn(e.doc,Dt(e.doc,k),k);m=k+Y.size,i.push(Y)}return i}var qn=null;function mi(e){qn?qn.ops.push(e):e.ownsGroup=qn={ops:[e],delayedCallbacks:[]}}function Wr(e){var t=e.delayedCallbacks,o=0;do{for(;o<t.length;o++)t[o].call(null);for(var i=0;i<e.ops.length;i++){var m=e.ops[i];if(m.cursorActivityHandlers)for(;m.cursorActivityCalled<m.cursorActivityHandlers.length;)m.cursorActivityHandlers[m.cursorActivityCalled++].call(null,m.cm)}}while(o<t.length)}function En(e,t){var o=e.ownsGroup;if(!o)return;try{Wr(o)}finally{qn=null,t(o)}}var hn=null;function gn(e,t){var o=Ge(e,t);if(!o.length)return;var i=Array.prototype.slice.call(arguments,2),m;qn?m=qn.delayedCallbacks:hn?m=hn:(m=hn=[],setTimeout(gi,0));for(var k=function(Z){m.push(function(){return o[Z].apply(null,i)})},Y=0;Y<o.length;++Y)k(Y)}function gi(){var e=hn;hn=null;for(var t=0;t<e.length;++t)e[t]()}function Qi(e,t,o,i){for(var m=0;m<t.changes.length;m++){var k=t.changes[m];k=="text"?on(e,t):k=="gutter"?an(e,t,o,i):k=="class"?Bt(e,t):k=="widget"&&Pt(e,t,i)}t.changes=null}function qi(e){return e.node==e.text&&(e.node=c("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&F<8&&(e.node.style.zIndex=2)),e.node}function ir(e,t){var o=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(o&&(o+=" CodeMirror-linebackground"),t.background)o?t.background.className=o:(t.background.parentNode.removeChild(t.background),t.background=null);else if(o){var i=qi(t);t.background=i.insertBefore(c("div",null,o),i.firstChild),e.display.input.setUneditable(t.background)}}function Tr(e,t){var o=e.display.externalMeasured;return o&&o.line==t.line?(e.display.externalMeasured=null,t.measure=o.measure,o.built):rn(e,t)}function on(e,t){var o=t.text.className,i=Tr(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,Bt(e,t)):o&&(t.text.className=o)}function Bt(e,t){ir(e,t),t.line.wrapClass?qi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var o=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=o||""}function an(e,t,o,i){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 m=qi(t);t.gutterBackground=c("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),m.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var Y=qi(t),Z=t.gutter=c("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),Y.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(c("div",li(e.options,o),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var te=0;te<e.display.gutterSpecs.length;++te){var ie=e.display.gutterSpecs[te].className,me=k.hasOwnProperty(ie)&&k[ie];me&&Z.appendChild(c("div",[me],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ie]+"px; width: "+i.gutterWidth[ie]+"px"))}}}function Pt(e,t,o){t.alignable&&(t.alignable=null);for(var i=C("CodeMirror-linewidget"),m=t.node.firstChild,k=void 0;m;m=k)k=m.nextSibling,i.test(m.className)&&t.node.removeChild(m);Pn(e,t,o)}function fn(e,t,o,i){var m=Tr(e,t);return t.text=t.node=m.pre,m.bgClass&&(t.bgClass=m.bgClass),m.textClass&&(t.textClass=m.textClass),Bt(e,t),an(e,t,o,i),Pn(e,t,i),t.node}function Pn(e,t,o){if(ei(e,t.line,t,o,!0),t.rest)for(var i=0;i<t.rest.length;i++)ei(e,t.rest[i],t,o,!1)}function ei(e,t,o,i,m){if(!t.widgets)return;for(var k=qi(o),Y=0,Z=t.widgets;Y<Z.length;++Y){var te=Z[Y],ie=c("div",[te.node],"CodeMirror-linewidget"+(te.className?" "+te.className:""));te.handleMouseEvents||ie.setAttribute("cm-ignore-events","true"),Si(te,ie,o,i),e.display.input.setUneditable(ie),m&&te.above?k.insertBefore(ie,o.gutter||o.text):k.appendChild(ie),gn(te,"redraw")}}function Si(e,t,o,i){if(e.noHScroll){(o.alignable||(o.alignable=[])).push(t);var m=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(m-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=m+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var o="position: relative;";e.coverGutter&&(o+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(o+="width: "+t.display.wrapper.clientWidth+"px;"),p(t.display.measure,c("div",[e.node],null,o))}return e.height=e.node.parentNode.offsetHeight}function vn(e,t){for(var o=be(t);o!=e.wrapper;o=o.parentNode)if(!o||o.nodeType==1&&o.getAttribute("cm-ignore-events")=="true"||o.parentNode==e.sizer&&o!=e.mover)return!0}function kn(e){return e.lineSpace.offsetTop}function Yi(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Fi(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=p(e.measure,c("pre","x","CodeMirror-line-like")),o=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(o.paddingLeft),right:parseInt(o.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function $n(e){return le-e.display.nativeBarWidth}function vi(e){return e.display.scroller.clientWidth-$n(e)-e.display.barWidth}function wi(e){return e.display.scroller.clientHeight-$n(e)-e.display.barHeight}function oi(e,t,o){var i=e.options.lineWrapping,m=i&&vi(e);if(!t.measure.heights||i&&t.measure.width!=m){var k=t.measure.heights=[];if(i){t.measure.width=m;for(var Y=t.text.firstChild.getClientRects(),Z=0;Z<Y.length-1;Z++){var te=Y[Z],ie=Y[Z+1];Math.abs(te.bottom-ie.bottom)>2&&k.push((te.bottom+ie.top)/2-o.top)}}k.push(o.bottom-o.top)}}function zi(e,t,o){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var m=0;m<e.rest.length;m++)if(Qt(e.rest[m])>o)return{map:e.measure.maps[m],cache:e.measure.caches[m],before:!0}}function Cr(e,t){t=Zn(t);var o=Qt(t),i=e.display.externalMeasured=new bn(e.doc,t,o);i.lineN=o;var m=i.built=rn(e,i);return i.text=m.pre,p(e.display.lineMeasure,m.pre),i}function Bi(e,t,o,i){return er(e,Ei(e,t),o,i)}function da(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[gr(e,t)];var o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size)return o}function Ei(e,t){var o=Qt(t),i=da(e,o);i&&!i.text?i=null:i&&i.changes&&(Qi(e,i,o,Ua(e)),e.curOp.forceUpdate=!0),i||(i=Cr(e,t));var m=zi(i,t,o);return{line:t,view:i,rect:null,map:m.map,cache:m.cache,before:m.before,hasHeights:!1}}function er(e,t,o,i,m){t.before&&(o=-1);var k=o+(i||""),Y;return t.cache.hasOwnProperty(k)?Y=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(oi(e,t.view,t.rect),t.hasHeights=!0),Y=Ws(e,t,o,i),Y.bogus||(t.cache[k]=Y)),{left:Y.left,right:Y.right,top:m?Y.rtop:Y.top,bottom:m?Y.rbottom:Y.bottom}}var fo={left:0,right:0,top:0,bottom:0};function po(e,t,o){for(var i,m,k,Y,Z,te,ie=0;ie<e.length;ie+=3)if(Z=e[ie],te=e[ie+1],t<Z?(m=0,k=1,Y="left"):t<te?(m=t-Z,k=m+1):(ie==e.length-3||t==te&&e[ie+3]>t)&&(k=te-Z,m=k-1,t>=te&&(Y="right")),m!=null){if(i=e[ie+2],Z==te&&o==(i.insertLeft?"left":"right")&&(Y=o),o=="left"&&m==0)for(;ie&&e[ie-2]==e[ie-3]&&e[ie-1].insertLeft;)i=e[(ie-=3)+2],Y="left";if(o=="right"&&m==te-Z)for(;ie<e.length-3&&e[ie+3]==e[ie+4]&&!e[ie+5].insertLeft;)i=e[(ie+=3)+2],Y="right";break}return{node:i,start:m,end:k,collapse:Y,coverStart:Z,coverEnd:te}}function Bs(e,t){var o=fo;if(t=="left")for(var i=0;i<e.length&&!((o=e[i]).left!=o.right);i++);else for(var m=e.length-1;m>=0&&!((o=e[m]).left!=o.right);m--);return o}function Ws(e,t,o,i){var m=po(t.map,o,i),k=m.node,Y=m.start,Z=m.end,te=m.collapse,ie;if(k.nodeType==3){for(var me=0;me<4;me++){for(;Y&&tt(t.line.text.charAt(m.coverStart+Y));)--Y;for(;m.coverStart+Z<m.coverEnd&&tt(t.line.text.charAt(m.coverStart+Z));)++Z;if(H&&F<9&&Y==0&&Z==m.coverEnd-m.coverStart?ie=k.parentNode.getBoundingClientRect():ie=Bs(y(k,Y,Z).getClientRects(),i),ie.left||ie.right||Y==0)break;Z=Y,Y=Y-1,te="right"}H&&F<11&&(ie=Hs(e.display.measure,ie))}else{Y>0&&(te=i="right");var xe;e.options.lineWrapping&&(xe=k.getClientRects()).length>1?ie=xe[i=="right"?xe.length-1:0]:ie=k.getBoundingClientRect()}if(H&&F<9&&!Y&&(!ie||!ie.left&&!ie.right)){var Ne=k.parentNode.getClientRects()[0];Ne?ie={left:Ne.left,right:Ne.left+wr(e.display),top:Ne.top,bottom:Ne.bottom}:ie=fo}for(var De=ie.top-t.rect.top,Ze=ie.bottom-t.rect.top,lt=(De+Ze)/2,_t=t.view.measure.heights,Lt=0;Lt<_t.length-1&&!(lt<_t[Lt]);Lt++);var Ut=Lt?_t[Lt-1]:0,It=_t[Lt],jt={left:(te=="right"?ie.right:ie.left)-t.rect.left,right:(te=="left"?ie.left:ie.right)-t.rect.left,top:Ut,bottom:It};return!ie.left&&!ie.right&&(jt.bogus=!0),e.options.singleCursorHeightPerLine||(jt.rtop=De,jt.rbottom=Ze),jt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ve(e))return t;var o=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*o,right:t.right*o,top:t.top*i,bottom:t.bottom*i}}function mo(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 go(e){e.display.externalMeasure=null,v(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)mo(e.display.view[t])}function Hr(e){go(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function vo(){return g&&r?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function yo(){return g&&r?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Da(e){var t=0;if(e.widgets)for(var o=0;o<e.widgets.length;++o)e.widgets[o].above&&(t+=ti(e.widgets[o]));return t}function ca(e,t,o,i,m){if(!m){var k=Da(t);o.top+=k,o.bottom+=k}if(i=="line")return o;i||(i="local");var Y=Kn(t);if(i=="local"?Y+=kn(e.display):Y-=e.display.viewOffset,i=="page"||i=="window"){var Z=e.display.lineSpace.getBoundingClientRect();Y+=Z.top+(i=="window"?0:yo());var te=Z.left+(i=="window"?0:vo());o.left+=te,o.right+=te}return o.top+=Y,o.bottom+=Y,o}function _o(e,t,o){if(o=="div")return t;var i=t.left,m=t.top;if(o=="page")i-=vo(),m-=yo();else if(o=="local"||!o){var k=e.display.sizer.getBoundingClientRect();i+=k.left,m+=k.top}var Y=e.display.lineSpace.getBoundingClientRect();return{left:i-Y.left,top:m-Y.top}}function Ma(e,t,o,i,m){return i||(i=Dt(e.doc,t.line)),ca(e,i,Bi(e,i,t.ch,m),o)}function $i(e,t,o,i,m,k){i=i||Dt(e.doc,t.line),m||(m=Ei(e,i));function Y(Ze,lt){var _t=er(e,m,Ze,lt?"right":"left",k);return lt?_t.left=_t.right:_t.right=_t.left,ca(e,i,_t,o)}var Z=Ot(i,e.doc.direction),te=t.ch,ie=t.sticky;if(te>=i.text.length?(te=i.text.length,ie="before"):te<=0&&(te=0,ie="after"),!Z)return Y(ie=="before"?te-1:te,ie=="before");function me(Ze,lt,_t){var Lt=Z[lt],Ut=Lt.level==1;return Y(_t?Ze-1:Ze,Ut!=_t)}var xe=xt(Z,te,ie),Ne=Et,De=me(te,xe,ie=="before");return Ne!=null&&(De.other=me(te,Ne,ie!="before")),De}function bo(e,t){var o=0;t=w(e.doc,t),e.options.lineWrapping||(o=wr(e.display)*t.ch);var i=Dt(e.doc,t.line),m=Kn(i)+kn(e.display);return{left:o,right:o,top:m,bottom:m+i.height}}function Pa(e,t,o,i,m){var k=ct(e,t,o);return k.xRel=m,i&&(k.outside=i),k}function ka(e,t,o){var i=e.doc;if(o+=e.display.viewOffset,o<0)return Pa(i.first,0,null,-1,-1);var m=Sn(i,o),k=i.first+i.size-1;if(m>k)return Pa(i.first+i.size-1,Dt(i,k).text.length,null,1,1);t<0&&(t=0);for(var Y=Dt(i,m);;){var Z=Ks(e,Y,m,t,o),te=Xn(Y,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!te)return Z;var ie=te.find(1);if(ie.line==m)return ie;Y=Dt(i,m=ie.line)}}function Eo(e,t,o,i){i-=Da(t);var m=t.text.length,k=vt(function(Y){return er(e,o,Y-1).bottom<=i},m,0);return m=vt(function(Y){return er(e,o,Y).top>i},k,m),{begin:k,end:m}}function xo(e,t,o,i){o||(o=Ei(e,t));var m=ca(e,t,er(e,o,i),"line").top;return Eo(e,t,o,m)}function Na(e,t,o,i){return e.bottom<=o?!1:e.top>o?!0:(i?e.left:e.right)>t}function Ks(e,t,o,i,m){m-=Kn(t);var k=Ei(e,t),Y=Da(t),Z=0,te=t.text.length,ie=!0,me=Ot(t,e.doc.direction);if(me){var xe=(e.options.lineWrapping?zs:Gs)(e,t,o,k,me,i,m);ie=xe.level!=1,Z=ie?xe.from:xe.to-1,te=ie?xe.to:xe.from-1}var Ne=null,De=null,Ze=vt(function(Yt){var Vt=er(e,k,Yt);return Vt.top+=Y,Vt.bottom+=Y,Na(Vt,i,m,!1)?(Vt.top<=m&&Vt.left<=i&&(Ne=Yt,De=Vt),!0):!1},Z,te),lt,_t,Lt=!1;if(De){var Ut=i-De.left<De.right-i,It=Ut==ie;Ze=Ne+(It?0:1),_t=It?"after":"before",lt=Ut?De.left:De.right}else{!ie&&(Ze==te||Ze==Z)&&Ze++,_t=Ze==0?"after":Ze==t.text.length?"before":er(e,k,Ze-(ie?1:0)).bottom+Y<=m==ie?"after":"before";var jt=$i(e,ct(o,Ze,_t),"line",t,k);lt=jt.left,Lt=m<jt.top?-1:m>=jt.bottom?1:0}return Ze=Je(t.text,Ze,1),Pa(o,Ze,_t,Lt,i-lt)}function Gs(e,t,o,i,m,k,Y){var Z=vt(function(xe){var Ne=m[xe],De=Ne.level!=1;return Na($i(e,ct(o,De?Ne.to:Ne.from,De?"before":"after"),"line",t,i),k,Y,!0)},0,m.length-1),te=m[Z];if(Z>0){var ie=te.level!=1,me=$i(e,ct(o,ie?te.from:te.to,ie?"after":"before"),"line",t,i);Na(me,k,Y,!0)&&me.top>Y&&(te=m[Z-1])}return te}function zs(e,t,o,i,m,k,Y){var Z=Eo(e,t,i,Y),te=Z.begin,ie=Z.end;/\s/.test(t.text.charAt(ie-1))&&ie--;for(var me=null,xe=null,Ne=0;Ne<m.length;Ne++){var De=m[Ne];if(De.from>=ie||De.to<=te)continue;var Ze=De.level!=1,lt=er(e,i,Ze?Math.min(ie,De.to)-1:Math.max(te,De.from)).right,_t=lt<k?k-lt+1e9:lt-k;(!me||xe>_t)&&(me=De,xe=_t)}return me||(me=m[m.length-1]),me.from<te&&(me={from:te,to:me.to,level:me.level}),me.to>ie&&(me={from:me.from,to:ie,level:me.level}),me}var pr;function Sr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(pr==null){pr=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)pr.appendChild(document.createTextNode("x")),pr.appendChild(c("br"));pr.appendChild(document.createTextNode("x"))}p(e.measure,pr);var o=pr.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),v(e.measure),o||1}function wr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),o=c("pre",[t],"CodeMirror-line-like");p(e.measure,o);var i=t.getBoundingClientRect(),m=(i.right-i.left)/10;return m>2&&(e.cachedCharWidth=m),m||10}function Ua(e){for(var t=e.display,o={},i={},m=t.gutters.clientLeft,k=t.gutters.firstChild,Y=0;k;k=k.nextSibling,++Y){var Z=e.display.gutterSpecs[Y].className;o[Z]=k.offsetLeft+k.clientLeft+m,i[Z]=k.clientWidth}return{fixedPos:ja(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:o,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ja(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function To(e){var t=Sr(e.display),o=e.options.lineWrapping,i=o&&Math.max(5,e.display.scroller.clientWidth/wr(e.display)-3);return function(m){if(Ri(e.doc,m))return 0;var k=0;if(m.widgets)for(var Y=0;Y<m.widgets.length;Y++)m.widgets[Y].height&&(k+=m.widgets[Y].height);return o?k+(Math.ceil(m.text.length/i)||1)*t:k+t}}function Fa(e){var t=e.doc,o=To(e);t.iter(function(i){var m=o(i);m!=i.height&&Cn(i,m)})}function mr(e,t,o,i){var m=e.display;if(!o&&be(t).getAttribute("cm-not-content")=="true")return null;var k,Y,Z=m.lineSpace.getBoundingClientRect();try{k=t.clientX-Z.left,Y=t.clientY-Z.top}catch(xe){return null}var te=ka(e,k,Y),ie;if(i&&te.xRel>0&&(ie=Dt(e.doc,te.line).text).length==te.ch){var me=G(ie,ie.length,e.options.tabSize)-ie.length;te=ct(te.line,Math.max(0,Math.round((k-Fi(e.display).left)/wr(e.display))-me))}return te}function gr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var o=e.display.view,i=0;i<o.length;i++)if(t-=o[i].size,t<0)return i}function Li(e,t,o,i){t==null&&(t=e.doc.first),o==null&&(o=e.doc.first+e.doc.size),i||(i=0);var m=e.display;if(i&&o<m.viewTo&&(m.updateLineNumbers==null||m.updateLineNumbers>t)&&(m.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=m.viewTo)Gt&&Vi(e.doc,t)<m.viewTo&&sr(e);else if(o<=m.viewFrom)Gt&&Ni(e.doc,o+i)>m.viewFrom?sr(e):(m.viewFrom+=i,m.viewTo+=i);else if(t<=m.viewFrom&&o>=m.viewTo)sr(e);else if(t<=m.viewFrom){var k=ha(e,o,o+i,1);k?(m.view=m.view.slice(k.index),m.viewFrom=k.lineN,m.viewTo+=i):sr(e)}else if(o>=m.viewTo){var Y=ha(e,t,t,-1);Y?(m.view=m.view.slice(0,Y.index),m.viewTo=Y.lineN):sr(e)}else{var Z=ha(e,t,t,-1),te=ha(e,o,o+i,1);Z&&te?(m.view=m.view.slice(0,Z.index).concat(Qn(e,Z.lineN,te.lineN)).concat(m.view.slice(te.index)),m.viewTo+=i):sr(e)}var ie=m.externalMeasured;ie&&(o<ie.lineN?ie.lineN+=i:t<ie.lineN+ie.size&&(m.externalMeasured=null))}function or(e,t,o){e.curOp.viewChanged=!0;var i=e.display,m=e.display.externalMeasured;if(m&&t>=m.lineN&&t<m.lineN+m.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var k=i.view[gr(e,t)];if(k.node==null)return;var Y=k.changes||(k.changes=[]);ne(Y,o)==-1&&Y.push(o)}function sr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ha(e,t,o,i){var m=gr(e,t),k,Y=e.display.view;if(!Gt||o==e.doc.first+e.doc.size)return{index:m,lineN:o};for(var Z=e.display.viewFrom,te=0;te<m;te++)Z+=Y[te].size;if(Z!=t){if(i>0){if(m==Y.length-1)return null;k=Z+Y[m].size-t,m++}else k=Z-t;t+=k,o+=k}for(;Vi(e.doc,o)!=o;){if(m==(i<0?0:Y.length-1))return null;o+=i*Y[m-(i<0?1:0)].size,m+=i}return{index:m,lineN:o}}function Vs(e,t,o){var i=e.display,m=i.view;m.length==0||t>=i.viewTo||o<=i.viewFrom?(i.view=Qn(e,t,o),i.viewFrom=t):(i.viewFrom>t?i.view=Qn(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(gr(e,t))),i.viewFrom=t,i.viewTo<o?i.view=i.view.concat(Qn(e,i.viewTo,o)):i.viewTo>o&&(i.view=i.view.slice(0,gr(e,o)))),i.viewTo=o}function Co(e){for(var t=e.display.view,o=0,i=0;i<t.length;i++){var m=t[i];!m.hidden&&(!m.node||m.changes)&&++o}return o}function Kr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function So(e,t){t===void 0&&(t=!0);for(var o=e.doc,i={},m=i.cursors=document.createDocumentFragment(),k=i.selection=document.createDocumentFragment(),Y=0;Y<o.sel.ranges.length;Y++){if(!t&&Y==o.sel.primIndex)continue;var Z=o.sel.ranges[Y];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var te=Z.empty();(te||e.options.showCursorWhenSelecting)&&wo(e,Z.head,m),te||Xs(e,Z,k)}return i}function wo(e,t,o){var i=$i(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),m=o.appendChild(c("div","\xA0","CodeMirror-cursor"));if(m.style.left=i.left+"px",m.style.top=i.top+"px",m.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var k=o.appendChild(c("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=i.other.left+"px",k.style.top=i.other.top+"px",k.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function fa(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,o){var i=e.display,m=e.doc,k=document.createDocumentFragment(),Y=Fi(e.display),Z=Y.left,te=Math.max(i.sizerWidth,vi(e)-i.sizer.offsetLeft)-Y.right,ie=m.direction=="ltr";function me(It,jt,Yt,Vt){jt<0&&(jt=0),jt=Math.round(jt),Vt=Math.round(Vt),k.appendChild(c("div",null,"CodeMirror-selected","position: absolute; left: "+It+`px;
|
|
top: `+jt+"px; width: "+(Yt==null?te-It:Yt)+`px;
|
|
height: `+(Vt-jt)+"px"))}function xe(It,jt,Yt){var Vt=Dt(m,It),un=Vt.text.length,Nn,hi;function Gn(ni,Mi){return Ma(e,ct(It,ni),"div",Vt,Mi)}function ji(ni,Mi,yi){var si=xo(e,Vt,null,ni),ii=Mi=="ltr"==(yi=="after")?"left":"right",Yn=yi=="after"?si.begin:si.end-(/\s/.test(Vt.text.charAt(si.end-1))?2:1);return Gn(Yn,ii)[ii]}var Di=Ot(Vt,m.direction);return wt(Di,jt||0,Yt==null?un:Yt,function(ni,Mi,yi,si){var ii=yi=="ltr",Yn=Gn(ni,ii?"left":"right"),Pi=Gn(Mi-1,ii?"right":"left"),Fr=jt==null&&ni==0,fr=Yt==null&&Mi==un,Ti=si==0,tr=!Di||si==Di.length-1;if(Pi.top-Yn.top<=3){var fi=(ie?Fr:fr)&&Ti,co=(ie?fr:Fr)&&tr,ar=fi?Z:(ii?Yn:Pi).left,Er=co?te:(ii?Pi:Yn).right;me(ar,Yn.top,Er-ar,Yn.bottom)}else{var xr,Ai,Br,ho;ii?(xr=ie&&Fr&&Ti?Z:Yn.left,Ai=ie?te:ji(ni,yi,"before"),Br=ie?Z:ji(Mi,yi,"after"),ho=ie&&fr&&tr?te:Pi.right):(xr=ie?ji(ni,yi,"before"):Z,Ai=!ie&&Fr&&Ti?te:Yn.right,Br=!ie&&fr&&tr?Z:Pi.left,ho=ie?ji(Mi,yi,"after"):te),me(xr,Yn.top,Ai-xr,Yn.bottom),Yn.bottom<Pi.top&&me(Z,Yn.bottom,null,Pi.top),me(Br,Pi.top,ho-Br,Pi.bottom)}(!Nn||fa(Yn,Nn)<0)&&(Nn=Yn),fa(Pi,Nn)<0&&(Nn=Pi),(!hi||fa(Yn,hi)<0)&&(hi=Yn),fa(Pi,hi)<0&&(hi=Pi)}),{start:Nn,end:hi}}var Ne=t.from(),De=t.to();if(Ne.line==De.line)xe(Ne.line,Ne.ch,De.ch);else{var Ze=Dt(m,Ne.line),lt=Dt(m,De.line),_t=Zn(Ze)==Zn(lt),Lt=xe(Ne.line,Ne.ch,_t?Ze.text.length+1:null).end,Ut=xe(De.line,_t?0:null,De.ch).start;_t&&(Lt.top<Ut.top-2?(me(Lt.right,Lt.top,null,Lt.bottom),me(Z,Ut.top,Ut.left,Ut.bottom)):me(Lt.right,Lt.top,Ut.left-Lt.right,Lt.bottom)),Lt.bottom<Ut.top&&me(Z,Lt.bottom,null,Ut.top)}o.appendChild(k)}function Ba(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var o=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Or(e),t.cursorDiv.style.visibility=(o=!o)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Oo(e){e.state.focused||(e.display.input.focus(),Wa(e))}function Ao(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Or(e))},100)}function Wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ba(e)}function Or(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,b(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function pa(e){for(var t=e.display,o=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var m=t.view[i],k=e.options.lineWrapping,Y=void 0,Z=0;if(m.hidden)continue;if(H&&F<8){var te=m.node.offsetTop+m.node.offsetHeight;Y=te-o,o=te}else{var ie=m.node.getBoundingClientRect();Y=ie.bottom-ie.top,!k&&m.text.firstChild&&(Z=m.text.firstChild.getBoundingClientRect().right-ie.left-1)}var me=m.line.height-Y;if((me>.005||me<-.005)&&(Cn(m.line,Y),Ro(m.line),m.rest))for(var xe=0;xe<m.rest.length;xe++)Ro(m.rest[xe]);if(Z>e.display.sizerWidth){var Ne=Math.ceil(Z/wr(e.display));Ne>e.display.maxLineLength&&(e.display.maxLineLength=Ne,e.display.maxLine=m.line,e.display.maxLineChanged=!0)}}}function Ro(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var o=e.widgets[t],i=o.node.parentNode;i&&(o.height=i.offsetHeight)}}function ma(e,t,o){var i=o&&o.top!=null?Math.max(0,o.top):e.scroller.scrollTop;i=Math.floor(i-kn(e));var m=o&&o.bottom!=null?o.bottom:i+e.wrapper.clientHeight,k=Sn(t,i),Y=Sn(t,m);if(o&&o.ensure){var Z=o.ensure.from.line,te=o.ensure.to.line;Z<k?(k=Z,Y=Sn(t,Kn(Dt(t,Z))+e.wrapper.clientHeight)):Math.min(te,t.lastLine())>=Y&&(k=Sn(t,Kn(Dt(t,te))-e.wrapper.clientHeight),Y=te)}return{from:k,to:Math.max(Y,k+1)}}function Ys(e,t){if(je(e,"scrollCursorIntoView"))return;var o=e.display,i=o.sizer.getBoundingClientRect(),m=null;if(t.top+i.top<0?m=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(m=!1),m!=null&&!s){var k=c("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-o.viewOffset-kn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+$n(e)+o.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(m),e.display.lineSpace.removeChild(k)}}function $s(e,t,o,i){i==null&&(i=0);var m;!e.options.lineWrapping&&t==o&&(t=t.ch?ct(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,o=t.sticky=="before"?ct(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var Y=!1,Z=$i(e,t),te=!o||o==t?Z:$i(e,o);m={left:Math.min(Z.left,te.left),top:Math.min(Z.top,te.top)-i,right:Math.max(Z.left,te.left),bottom:Math.max(Z.bottom,te.bottom)+i};var ie=Ha(e,m),me=e.doc.scrollTop,xe=e.doc.scrollLeft;if(ie.scrollTop!=null&&(zr(e,ie.scrollTop),Math.abs(e.doc.scrollTop-me)>1&&(Y=!0)),ie.scrollLeft!=null&&(vr(e,ie.scrollLeft),Math.abs(e.doc.scrollLeft-xe)>1&&(Y=!0)),!Y)break}return m}function Js(e,t){var o=Ha(e,t);o.scrollTop!=null&&zr(e,o.scrollTop),o.scrollLeft!=null&&vr(e,o.scrollLeft)}function Ha(e,t){var o=e.display,i=Sr(e.display);t.top<0&&(t.top=0);var m=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:o.scroller.scrollTop,k=wi(e),Y={};t.bottom-t.top>k&&(t.bottom=t.top+k);var Z=e.doc.height+Yi(o),te=t.top<i,ie=t.bottom>Z-i;if(t.top<m)Y.scrollTop=te?0:t.top;else if(t.bottom>m+k){var me=Math.min(t.top,(ie?Z:t.bottom)-k);me!=m&&(Y.scrollTop=me)}var xe=e.options.fixedGutter?0:o.gutters.offsetWidth,Ne=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:o.scroller.scrollLeft-xe,De=vi(e)-o.gutters.offsetWidth,Ze=t.right-t.left>De;return Ze&&(t.right=t.left+De),t.left<10?Y.scrollLeft=0:t.left<Ne?Y.scrollLeft=Math.max(0,t.left+xe-(Ze?0:10)):t.right>De+Ne-3&&(Y.scrollLeft=t.right+(Ze?0:10)-De),Y}function Ka(e,t){if(t==null)return;ga(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ar(e){ga(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Gr(e,t,o){(t!=null||o!=null)&&ga(e),t!=null&&(e.curOp.scrollLeft=t),o!=null&&(e.curOp.scrollTop=o)}function Zs(e,t){ga(e),e.curOp.scrollToPos=t}function ga(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var o=bo(e,t.from),i=bo(e,t.to);Lo(e,o,i,t.margin)}}function Lo(e,t,o,i){var m=Ha(e,{left:Math.min(t.left,o.left),top:Math.min(t.top,o.top)-i,right:Math.max(t.right,o.right),bottom:Math.max(t.bottom,o.bottom)+i});Gr(e,m.scrollLeft,m.scrollTop)}function zr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;M||za(e,{top:t}),Io(e,t,!0),M&&za(e),Yr(e,100)}function Io(e,t,o){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!o)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function vr(e,t,o,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(o?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,No(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Vr(e){var t=e.display,o=t.gutters.offsetWidth,i=Math.round(e.doc.height+Yi(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?o:0,docHeight:i,scrollHeight:i+$n(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:o}}var yr=function(e,t,o){this.cm=o;var i=this.vert=c("div",[c("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),m=this.horiz=c("div",[c("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=m.tabIndex=-1,e(i),e(m),Ce(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ce(m,"scroll",function(){m.clientWidth&&t(m.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};yr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,o=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(o){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var m=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+m)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=o?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(o?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:o?i:0,bottom:t?i:0}},yr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},yr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},yr.prototype.zeroWidthHack=function(){var e=n&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Q,this.disableVert=new Q},yr.prototype.enableZeroWidthBar=function(e,t,o){e.style.pointerEvents="auto";function i(){var m=e.getBoundingClientRect(),k=o=="vert"?document.elementFromPoint(m.right-1,(m.top+m.bottom)/2):document.elementFromPoint((m.right+m.left)/2,m.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},yr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Xr=function(){};Xr.prototype.update=function(){return{bottom:0,right:0}},Xr.prototype.setScrollLeft=function(){},Xr.prototype.setScrollTop=function(){},Xr.prototype.clear=function(){};function Rr(e,t){t||(t=Vr(e));var o=e.display.barWidth,i=e.display.barHeight;Do(e,t);for(var m=0;m<4&&o!=e.display.barWidth||i!=e.display.barHeight;m++)o!=e.display.barWidth&&e.options.lineWrapping&&pa(e),Do(e,Vr(e)),o=e.display.barWidth,i=e.display.barHeight}function Do(e,t){var o=e.display,i=o.scrollbars.update(t);o.sizer.style.paddingRight=(o.barWidth=i.right)+"px",o.sizer.style.paddingBottom=(o.barHeight=i.bottom)+"px",o.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(o.scrollbarFiller.style.display="block",o.scrollbarFiller.style.height=i.bottom+"px",o.scrollbarFiller.style.width=i.right+"px"):o.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(o.gutterFiller.style.display="block",o.gutterFiller.style.height=i.bottom+"px",o.gutterFiller.style.width=t.gutterWidth+"px"):o.gutterFiller.style.display=""}var Mo={native:yr,null:Xr};function Po(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&b(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Mo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,o){o=="horizontal"?vr(e,t):zr(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function _r(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:++Qs},mi(e.curOp)}function br(e){var t=e.curOp;t&&En(t,function(o){for(var i=0;i<o.ops.length;i++)o.ops[i].cm.curOp=null;qs(o)})}function qs(e){for(var t=e.ops,o=0;o<t.length;o++)el(t[o]);for(var i=0;i<t.length;i++)tl(t[i]);for(var m=0;m<t.length;m++)nl(t[m]);for(var k=0;k<t.length;k++)il(t[k]);for(var Y=0;Y<t.length;Y++)rl(t[Y])}function el(e){var t=e.cm,o=t.display;ol(t),e.updateMaxLine&&Xi(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<o.viewFrom||e.scrollToPos.to.line>=o.viewTo)||o.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new va(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ga(e.cm,e.update)}function nl(e){var t=e.cm,o=t.display;e.updatedDisplay&&pa(t),e.barMeasure=Vr(t),o.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Bi(t,o.maxLine,o.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(o.scroller.clientWidth,o.sizer.offsetLeft+e.adjustWidthTo+$n(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,o.sizer.offsetLeft+e.adjustWidthTo-vi(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=o.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&vr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var o=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,o),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rr(t,e.barMeasure),e.updatedDisplay&&Xa(t,e.barMeasure),e.selectionChanged&&Ba(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),o&&Oo(e.cm)}function rl(e){var t=e.cm,o=t.display,i=t.doc;if(e.updatedDisplay&&ko(t,e.update),o.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(o.wheelStartX=o.wheelStartY=null),e.scrollTop!=null&&Io(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&vr(t,e.scrollLeft,!0,!0),e.scrollToPos){var m=$s(t,w(i,e.scrollToPos.from),w(i,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,m)}var k=e.maybeHiddenMarkers,Y=e.maybeUnhiddenMarkers;if(k)for(var Z=0;Z<k.length;++Z)k[Z].lines.length||Re(k[Z],"hide");if(Y)for(var te=0;te<Y.length;++te)Y[te].lines.length&&Re(Y[te],"unhide");o.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ui(e,t){if(e.curOp)return t();_r(e);try{return t()}finally{br(e)}}function di(e,t){return function(){if(e.curOp)return t.apply(e,arguments);_r(e);try{return t.apply(e,arguments)}finally{br(e)}}}function Oi(e){return function(){if(this.curOp)return e.apply(this,arguments);_r(this);try{return e.apply(this,arguments)}finally{br(this)}}}function ci(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);_r(t);try{return e.apply(this,arguments)}finally{br(t)}}}function Yr(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 o=+new Date+e.options.workTime,i=ot(e,t.highlightFrontier),m=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var Y=k.styles,Z=k.text.length>e.options.maxHighlightLength?At(t.mode,i.state):null,te=ye(e,k,i,!0);Z&&(i.state=Z),k.styles=te.styles;var ie=k.styleClasses,me=te.classes;me?k.styleClasses=me:ie&&(k.styleClasses=null);for(var xe=!Y||Y.length!=k.styles.length||ie!=me&&(!ie||!me||ie.bgClass!=me.bgClass||ie.textClass!=me.textClass),Ne=0;!xe&&Ne<Y.length;++Ne)xe=Y[Ne]!=k.styles[Ne];xe&&m.push(i.line),k.stateAfter=i.save(),i.nextLine()}else k.text.length<=e.options.maxHighlightLength&&ht(e,k.text,i),k.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>o)return Yr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),m.length&&Ui(e,function(){for(var k=0;k<m.length;k++)or(e,m[k],"text")})}var va=function(e,t,o){var i=e.display;this.viewport=t,this.visible=ma(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=vi(e),this.force=o,this.dims=Ua(e),this.events=[]};va.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},va.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.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=$n(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=$n(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!_(e.display.lineDiv,t))return null;var o={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&_(e.display.lineDiv,i.anchorNode)&&(o.anchorNode=i.anchorNode,o.anchorOffset=i.anchorOffset,o.focusNode=i.focusNode,o.focusOffset=i.focusOffset)}return o}function ll(e){if(!e||!e.activeElt||e.activeElt==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode)){var t=window.getSelection(),o=document.createRange();o.setEnd(e.anchorNode,e.anchorOffset),o.collapse(!1),t.removeAllRanges(),t.addRange(o),t.extend(e.focusNode,e.focusOffset)}}function Ga(e,t){var o=e.display,i=e.doc;if(t.editorIsHidden)return sr(e),!1;if(!t.force&&t.visible.from>=o.viewFrom&&t.visible.to<=o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>=o.viewTo)&&o.renderedView==o.view&&Co(e)==0)return!1;Uo(e)&&(sr(e),t.dims=Ua(e));var m=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),Y=Math.min(m,t.visible.to+e.options.viewportMargin);o.viewFrom<k&&k-o.viewFrom<20&&(k=Math.max(i.first,o.viewFrom)),o.viewTo>Y&&o.viewTo-Y<20&&(Y=Math.min(m,o.viewTo)),Gt&&(k=Vi(e.doc,k),Y=Ni(e.doc,Y));var Z=k!=o.viewFrom||Y!=o.viewTo||o.lastWrapHeight!=t.wrapperHeight||o.lastWrapWidth!=t.wrapperWidth;Vs(e,k,Y),o.viewOffset=Kn(Dt(e.doc,o.viewFrom)),e.display.mover.style.top=o.viewOffset+"px";var te=Co(e);if(!Z&&te==0&&!t.force&&o.renderedView==o.view&&(o.updateLineNumbers==null||o.updateLineNumbers>=o.viewTo))return!1;var ie=sl(e);return te>4&&(o.lineDiv.style.display="none"),ul(e,o.updateLineNumbers,t.dims),te>4&&(o.lineDiv.style.display=""),o.renderedView=o.view,ll(ie),v(o.cursorDiv),v(o.selectionDiv),o.gutters.style.height=o.sizer.style.minHeight=0,Z&&(o.lastWrapHeight=t.wrapperHeight,o.lastWrapWidth=t.wrapperWidth,Yr(e,400)),o.updateLineNumbers=null,!0}function ko(e,t){for(var o=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==vi(e)){if(o&&o.top!=null&&(o={top:Math.min(e.doc.height+Yi(e.display)-wi(e),o.top)}),t.visible=ma(e.display,e.doc,o),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=ma(e.display,e.doc,o));if(!Ga(e,t))break;pa(e);var m=Vr(e);Kr(e),Rr(e,m),Xa(e,m),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 za(e,t){var o=new va(e,t);if(Ga(e,o)){pa(e),ko(e,o);var i=Vr(e);Kr(e),Rr(e,i),Xa(e,i),o.finish()}}function ul(e,t,o){var i=e.display,m=e.options.lineNumbers,k=i.lineDiv,Y=k.firstChild;function Z(Ze){var lt=Ze.nextSibling;return D&&n&&e.display.currentWheelTarget==Ze?Ze.style.display="none":Ze.parentNode.removeChild(Ze),lt}for(var te=i.view,ie=i.viewFrom,me=0;me<te.length;me++){var xe=te[me];if(!xe.hidden)if(!xe.node||xe.node.parentNode!=k){var Ne=fn(e,xe,ie,o);k.insertBefore(Ne,Y)}else{for(;Y!=xe.node;)Y=Z(Y);var De=m&&t!=null&&t<=ie&&xe.lineNumber;xe.changes&&(ne(xe.changes,"gutter")>-1&&(De=!1),Qi(e,xe,ie,o)),De&&(v(xe.lineNumber),xe.lineNumber.appendChild(document.createTextNode(li(e.options,ie)))),Y=xe.node.nextSibling}ie+=xe.size}for(;Y;)Y=Z(Y)}function Va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Xa(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+$n(e)+"px"}function No(e){var t=e.display,o=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ja(t)-t.scroller.scrollLeft+e.doc.scrollLeft,m=t.gutters.offsetWidth,k=i+"px",Y=0;Y<o.length;Y++)if(!o[Y].hidden){e.options.fixedGutter&&(o[Y].gutter&&(o[Y].gutter.style.left=k),o[Y].gutterBackground&&(o[Y].gutterBackground.style.left=k));var Z=o[Y].alignable;if(Z)for(var te=0;te<Z.length;te++)Z[te].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=i+m+"px")}function Uo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,o=li(e.options,t.first+t.size-1),i=e.display;if(o.length!=i.lineNumChars){var m=i.measure.appendChild(c("div",[c("div",o)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=m.firstChild.offsetWidth,Y=m.offsetWidth-k;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(k,i.lineGutter.offsetWidth-Y)+1,i.lineNumWidth=i.lineNumInnerWidth+Y,i.lineNumChars=i.lineNumInnerWidth?o.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Va(e.display),!0}return!1}function Ya(e,t){for(var o=[],i=!1,m=0;m<e.length;m++){var k=e[m],Y=null;if(typeof k!="string"&&(Y=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)i=!0;else continue;o.push({className:k,style:Y})}return t&&!i&&o.push({className:"CodeMirror-linenumbers",style:null}),o}function jo(e){var t=e.gutters,o=e.gutterSpecs;v(t),e.lineGutter=null;for(var i=0;i<o.length;++i){var m=o[i],k=m.className,Y=m.style,Z=t.appendChild(c("div",null,"CodeMirror-gutter "+k));Y&&(Z.style.cssText=Y),k=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=o.length?"":"none",Va(e)}function $r(e){jo(e.display),Li(e),No(e)}function dl(e,t,o,i){var m=this;this.input=o,m.scrollbarFiller=c("div",null,"CodeMirror-scrollbar-filler"),m.scrollbarFiller.setAttribute("cm-not-content","true"),m.gutterFiller=c("div",null,"CodeMirror-gutter-filler"),m.gutterFiller.setAttribute("cm-not-content","true"),m.lineDiv=E("div",null,"CodeMirror-code"),m.selectionDiv=c("div",null,null,"position: relative; z-index: 1"),m.cursorDiv=c("div",null,"CodeMirror-cursors"),m.measure=c("div",null,"CodeMirror-measure"),m.lineMeasure=c("div",null,"CodeMirror-measure"),m.lineSpace=E("div",[m.measure,m.lineMeasure,m.selectionDiv,m.cursorDiv,m.lineDiv],null,"position: relative; outline: none");var k=E("div",[m.lineSpace],"CodeMirror-lines");m.mover=c("div",[k],null,"position: relative"),m.sizer=c("div",[m.mover],"CodeMirror-sizer"),m.sizerWidth=null,m.heightForcer=c("div",null,null,"position: absolute; height: "+le+"px; width: 1px;"),m.gutters=c("div",null,"CodeMirror-gutters"),m.lineGutter=null,m.scroller=c("div",[m.sizer,m.heightForcer,m.gutters],"CodeMirror-scroll"),m.scroller.setAttribute("tabIndex","-1"),m.wrapper=c("div",[m.scrollbarFiller,m.gutterFiller,m.scroller],"CodeMirror"),H&&F<8&&(m.gutters.style.zIndex=-1,m.scroller.style.paddingRight=0),!D&&!(M&&a)&&(m.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(m.wrapper):e(m.wrapper)),m.viewFrom=m.viewTo=t.first,m.reportedViewFrom=m.reportedViewTo=t.first,m.view=[],m.renderedView=null,m.externalMeasured=null,m.viewOffset=0,m.lastWrapHeight=m.lastWrapWidth=0,m.updateLineNumbers=null,m.nativeBarWidth=m.barHeight=m.barWidth=0,m.scrollbarsClipped=!1,m.lineNumWidth=m.lineNumInnerWidth=m.lineNumChars=null,m.alignWidgets=!1,m.cachedCharWidth=m.cachedTextHeight=m.cachedPaddingH=null,m.maxLine=null,m.maxLineLength=0,m.maxLineChanged=!1,m.wheelDX=m.wheelDY=m.wheelStartX=m.wheelStartY=null,m.shift=!1,m.selForContextMenu=null,m.activeTouch=null,m.gutterSpecs=Ya(i.gutters,i.lineNumbers),jo(m),o.init(m)}var ya=0,Wi=null;H?Wi=-.53:M?Wi=15:g?Wi=-.7:u&&(Wi=-1/3);function Fo(e){var t=e.wheelDeltaX,o=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),o==null&&e.detail&&e.axis==e.VERTICAL_AXIS?o=e.detail:o==null&&(o=e.wheelDelta),{x:t,y:o}}function cl(e){var t=Fo(e);return t.x*=Wi,t.y*=Wi,t}function Bo(e,t){var o=Fo(t),i=o.x,m=o.y,k=e.display,Y=k.scroller,Z=Y.scrollWidth>Y.clientWidth,te=Y.scrollHeight>Y.clientHeight;if(!(i&&Z||m&&te))return;if(m&&n&&D){e:for(var ie=t.target,me=k.view;ie!=Y;ie=ie.parentNode)for(var xe=0;xe<me.length;xe++)if(me[xe].node==ie){e.display.currentWheelTarget=ie;break e}}if(i&&!M&&!f&&Wi!=null){m&&te&&zr(e,Math.max(0,Y.scrollTop+m*Wi)),vr(e,Math.max(0,Y.scrollLeft+i*Wi)),(!m||m&&te)&&re(t),k.wheelStartX=null;return}if(m&&Wi!=null){var Ne=m*Wi,De=e.doc.scrollTop,Ze=De+k.wrapper.clientHeight;Ne<0?De=Math.max(0,De+Ne-50):Ze=Math.min(e.doc.height,Ze+Ne+50),za(e,{top:De,bottom:Ze})}ya<20&&(k.wheelStartX==null?(k.wheelStartX=Y.scrollLeft,k.wheelStartY=Y.scrollTop,k.wheelDX=i,k.wheelDY=m,setTimeout(function(){if(k.wheelStartX==null)return;var lt=Y.scrollLeft-k.wheelStartX,_t=Y.scrollTop-k.wheelStartY,Lt=_t&&k.wheelDY&&_t/k.wheelDY||lt&&k.wheelDX&</k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!Lt)return;Wi=(Wi*ya+Lt)/(ya+1),++ya},200)):(k.wheelDX+=i,k.wheelDY+=m))}var Hi=function(e,t){this.ranges=e,this.primIndex=t};Hi.prototype.primary=function(){return this.ranges[this.primIndex]},Hi.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 o=this.ranges[t],i=e.ranges[t];if(!zn(o.anchor,i.anchor)||!zn(o.head,i.head))return!1}return!0},Hi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new An(pi(this.ranges[t].anchor),pi(this.ranges[t].head));return new Hi(e,this.primIndex)},Hi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Hi.prototype.contains=function(e,t){t||(t=e);for(var o=0;o<this.ranges.length;o++){var i=this.ranges[o];if(St(t,i.from())>=0&&St(e,i.to())<=0)return o}return-1};var An=function(e,t){this.anchor=e,this.head=t};An.prototype.from=function(){return ki(this.anchor,this.head)},An.prototype.to=function(){return ui(this.anchor,this.head)},An.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ji(e,t,o){var i=e&&e.options.selectionsMayTouch,m=t[o];t.sort(function(Ne,De){return St(Ne.from(),De.from())}),o=ne(t,m);for(var k=1;k<t.length;k++){var Y=t[k],Z=t[k-1],te=St(Z.to(),Y.from());if(i&&!Y.empty()?te>0:te>=0){var ie=ki(Z.from(),Y.from()),me=ui(Z.to(),Y.to()),xe=Z.empty()?Y.from()==Y.head:Z.from()==Z.head;k<=o&&--o,t.splice(--k,2,new An(xe?me:ie,xe?ie:me))}}return new Hi(t,o)}function lr(e,t){return new Hi([new An(e,t||e)],0)}function ur(e){return e.text?ct(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Wo(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return ur(t);var o=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=ur(t).ch-t.to.ch),ct(o,i)}function $a(e,t){for(var o=[],i=0;i<e.sel.ranges.length;i++){var m=e.sel.ranges[i];o.push(new An(Wo(m.anchor,t),Wo(m.head,t)))}return Ji(e.cm,o,e.sel.primIndex)}function Ho(e,t,o){return e.line==t.line?ct(o.line,e.ch-t.ch+o.ch):ct(o.line+(e.line-t.line),e.ch)}function hl(e,t,o){for(var i=[],m=ct(e.first,0),k=m,Y=0;Y<t.length;Y++){var Z=t[Y],te=Ho(Z.from,m,k),ie=Ho(ur(Z),m,k);if(m=Z.to,k=ie,o=="around"){var me=e.sel.ranges[Y],xe=St(me.head,me.anchor)<0;i[Y]=new An(xe?ie:te,xe?te:ie)}else i[Y]=new An(te,te)}return new Hi(i,e.sel.primIndex)}function Ja(e){e.doc.mode=ke(e.options,e.doc.modeOption),Jr(e)}function Jr(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,Yr(e,100),e.state.modeGen++,e.curOp&&Li(e)}function Ko(e,t){return t.from.ch==0&&t.to.ch==0&&Le(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Za(e,t,o,i){function m(Ut){return o?o[Ut]:null}function k(Ut,It,jt){nr(Ut,It,jt,i),gn(Ut,"change",Ut,t)}function Y(Ut,It){for(var jt=[],Yt=Ut;Yt<It;++Yt)jt.push(new _i(ie[Yt],m(Yt),i));return jt}var Z=t.from,te=t.to,ie=t.text,me=Dt(e,Z.line),xe=Dt(e,te.line),Ne=Le(ie),De=m(ie.length-1),Ze=te.line-Z.line;if(t.full)e.insert(0,Y(0,ie.length)),e.remove(ie.length,e.size-ie.length);else if(Ko(e,t)){var lt=Y(0,ie.length-1);k(xe,xe.text,De),Ze&&e.remove(Z.line,Ze),lt.length&&e.insert(Z.line,lt)}else if(me==xe)if(ie.length==1)k(me,me.text.slice(0,Z.ch)+Ne+me.text.slice(te.ch),De);else{var _t=Y(1,ie.length-1);_t.push(new _i(Ne+me.text.slice(te.ch),De,i)),k(me,me.text.slice(0,Z.ch)+ie[0],m(0)),e.insert(Z.line+1,_t)}else if(ie.length==1)k(me,me.text.slice(0,Z.ch)+ie[0]+xe.text.slice(te.ch),m(0)),e.remove(Z.line+1,Ze);else{k(me,me.text.slice(0,Z.ch)+ie[0],m(0)),k(xe,Ne+xe.text.slice(te.ch),De);var Lt=Y(1,ie.length-1);Ze>1&&e.remove(Z.line+1,Ze-1),e.insert(Z.line+1,Lt)}gn(e,"change",e,t)}function dr(e,t,o){function i(m,k,Y){if(m.linked)for(var Z=0;Z<m.linked.length;++Z){var te=m.linked[Z];if(te.doc==k)continue;var ie=Y&&te.sharedHist;if(o&&!ie)continue;t(te.doc,ie),i(te.doc,m,ie)}}i(e,null,!0)}function Go(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Fa(e),Ja(e),zo(e),e.options.lineWrapping||Xi(e),e.options.mode=t.modeOption,Li(e)}function zo(e){(e.doc.direction=="rtl"?N:b)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ui(e,function(){zo(e),Li(e)})}function _a(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 Qa(e,t){var o={from:pi(t.from),to:ur(t),text:Rn(e,t.from,t.to)};return Yo(e,o,t.from.line,t.to.line+1),dr(e,function(i){return Yo(i,o,t.from.line,t.to.line+1)},!0),o}function Vo(e){for(;e.length;){var t=Le(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Vo(e.done),Le(e.done);if(e.done.length&&!Le(e.done).ranges)return Le(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function Xo(e,t,o,i){var m=e.history;m.undone.length=0;var k=+new Date,Y,Z;if((m.lastOp==i||m.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&m.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(Y=pl(m,m.lastOp==i)))Z=Le(Y.changes),St(t.from,t.to)==0&&St(t.from,Z.to)==0?Z.to=ur(t):Y.changes.push(Qa(e,t));else{var te=Le(m.done);for((!te||!te.ranges)&&ba(e.sel,m.done),Y={changes:[Qa(e,t)],generation:m.generation},m.done.push(Y);m.done.length>m.undoDepth;)m.done.shift(),m.done[0].ranges||m.done.shift()}m.done.push(o),m.generation=++m.maxGeneration,m.lastModTime=m.lastSelTime=k,m.lastOp=m.lastSelOp=i,m.lastOrigin=m.lastSelOrigin=t.origin,Z||Re(e,"historyAdded")}function ml(e,t,o,i){var m=t.charAt(0);return m=="*"||m=="+"&&o.ranges.length==i.ranges.length&&o.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,o,i){var m=e.history,k=i&&i.origin;o==m.lastSelOp||k&&m.lastSelOrigin==k&&(m.lastModTime==m.lastSelTime&&m.lastOrigin==k||ml(e,k,Le(m.done),t))?m.done[m.done.length-1]=t:ba(t,m.done),m.lastSelTime=+new Date,m.lastSelOrigin=k,m.lastSelOp=o,i&&i.clearRedo!==!1&&Vo(m.undone)}function ba(e,t){var o=Le(t);o&&o.ranges&&o.equals(e)||t.push(e)}function Yo(e,t,o,i){var m=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,o),Math.min(e.first+e.size,i),function(Y){Y.markedSpans&&((m||(m=t["spans_"+e.id]={}))[k]=Y.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,o=0;o<e.length;++o)e[o].marker.explicitlyCleared?t||(t=e.slice(0,o)):t&&t.push(e[o]);return t?t.length?t:null:e}function yl(e,t){var o=t["spans_"+e.id];if(!o)return null;for(var i=[],m=0;m<t.text.length;++m)i.push(vl(o[m]));return i}function $o(e,t){var o=yl(e,t),i=_n(e,t);if(!o)return i;if(!i)return o;for(var m=0;m<o.length;++m){var k=o[m],Y=i[m];if(k&&Y){e:for(var Z=0;Z<Y.length;++Z){for(var te=Y[Z],ie=0;ie<k.length;++ie)if(k[ie].marker==te.marker)continue e;k.push(te)}}else Y&&(o[m]=Y)}return o}function Lr(e,t,o){for(var i=[],m=0;m<e.length;++m){var k=e[m];if(k.ranges){i.push(o?Hi.prototype.deepCopy.call(k):k);continue}var Y=k.changes,Z=[];i.push({changes:Z});for(var te=0;te<Y.length;++te){var ie=Y[te],me=void 0;if(Z.push({from:ie.from,to:ie.to,text:ie.text}),t)for(var xe in ie)(me=xe.match(/^spans_(\d+)$/))&&(ne(t,Number(me[1]))>-1&&(Le(Z)[xe]=ie[xe],delete ie[xe]))}}return i}function qa(e,t,o,i){if(i){var m=e.anchor;if(o){var k=St(t,m)<0;k!=St(o,m)<0?(m=t,t=o):k!=St(t,o)<0&&(t=o)}return new An(m,t)}else return new An(o||t,t)}function Ea(e,t,o,i,m){m==null&&(m=e.cm&&(e.cm.display.shift||e.extend)),xi(e,new Hi([qa(e.sel.primary(),t,o,m)],0),i)}function Jo(e,t,o){for(var i=[],m=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)i[k]=qa(e.sel.ranges[k],t[k],null,m);var Y=Ji(e.cm,i,e.sel.primIndex);xi(e,Y,o)}function eo(e,t,o,i){var m=e.sel.ranges.slice(0);m[t]=o,xi(e,Ji(e.cm,m,e.sel.primIndex),i)}function Zo(e,t,o,i){xi(e,lr(t,o),i)}function _l(e,t,o){var i={ranges:t.ranges,update:function(m){this.ranges=[];for(var k=0;k<m.length;k++)this.ranges[k]=new An(w(e,m[k].anchor),w(e,m[k].head))},origin:o&&o.origin};return Re(e,"beforeSelectionChange",e,i),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Ji(e.cm,i.ranges,i.ranges.length-1):t}function Qo(e,t,o){var i=e.history.done,m=Le(i);m&&m.ranges?(i[i.length-1]=t,xa(e,t,o)):xi(e,t,o)}function xi(e,t,o){xa(e,t,o),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,o)}function xa(e,t,o){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,o));var i=o&&o.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);qo(e,ts(e,t,i,!0)),!(o&&o.scroll===!1)&&e.cm&&Ar(e.cm)}function qo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),gn(e,"cursorActivity",e)}function es(e){qo(e,ts(e,e.sel,null,!1))}function ts(e,t,o,i){for(var m,k=0;k<t.ranges.length;k++){var Y=t.ranges[k],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],te=Ta(e,Y.anchor,Z&&Z.anchor,o,i),ie=Ta(e,Y.head,Z&&Z.head,o,i);(m||te!=Y.anchor||ie!=Y.head)&&(m||(m=t.ranges.slice(0,k)),m[k]=new An(te,ie))}return m?Ji(e.cm,m,t.primIndex):t}function Ir(e,t,o,i,m){var k=Dt(e,t.line);if(k.markedSpans)for(var Y=0;Y<k.markedSpans.length;++Y){var Z=k.markedSpans[Y],te=Z.marker,ie="selectLeft"in te?!te.selectLeft:te.inclusiveLeft,me="selectRight"in te?!te.selectRight:te.inclusiveRight;if((Z.from==null||(ie?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(me?Z.to>=t.ch:Z.to>t.ch))){if(m&&(Re(te,"beforeCursorEnter"),te.explicitlyCleared))if(k.markedSpans){--Y;continue}else break;if(!te.atomic)continue;if(o){var xe=te.find(i<0?1:-1),Ne=void 0;if((i<0?me:ie)&&(xe=ns(e,xe,-i,xe&&xe.line==t.line?k:null)),xe&&xe.line==t.line&&(Ne=St(xe,o))&&(i<0?Ne<0:Ne>0))return Ir(e,xe,t,i,m)}var De=te.find(i<0?-1:1);return(i<0?ie:me)&&(De=ns(e,De,i,De.line==t.line?k:null)),De?Ir(e,De,t,i,m):null}}return t}function Ta(e,t,o,i,m){var k=i||1,Y=Ir(e,t,o,k,m)||!m&&Ir(e,t,o,k,!0)||Ir(e,t,o,-k,m)||!m&&Ir(e,t,o,-k,!0);return Y||(e.cantEdit=!0,ct(e.first,0))}function ns(e,t,o,i){return o<0&&t.ch==0?t.line>e.first?w(e,ct(t.line-1)):null:o>0&&t.ch==(i||Dt(e,t.line)).text.length?t.line<e.first+e.size-1?ct(t.line+1,0):null:new ct(t.line,t.ch+o)}function is(e){e.setSelection(ct(e.firstLine(),0),ct(e.lastLine()),pe)}function rs(e,t,o){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return o&&(i.update=function(m,k,Y,Z){m&&(i.from=w(e,m)),k&&(i.to=w(e,k)),Y&&(i.text=Y),Z!==void 0&&(i.origin=Z)}),Re(e,"beforeChange",e,i),e.cm&&Re(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function Dr(e,t,o){if(e.cm){if(!e.cm.curOp)return di(e.cm,Dr)(e,t,o);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=rs(e,t,!0),!t))return;var i=Mn&&!o&&dn(e,t.from,t.to);if(i)for(var m=i.length-1;m>=0;--m)as(e,{from:i[m].from,to:i[m].to,text:m?[""]:t.text,origin:t.origin});else as(e,t)}function as(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var o=$a(e,t);Xo(e,t,o,e.cm?e.cm.curOp.id:NaN),Zr(e,t,o,_n(e,t));var i=[];dr(e,function(m,k){!k&&ne(i,m.history)==-1&&(us(m.history,t),i.push(m.history)),Zr(m,t,null,_n(m,t))})}function Ca(e,t,o){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!o)return;for(var m=e.history,k,Y=e.sel,Z=t=="undo"?m.done:m.undone,te=t=="undo"?m.undone:m.done,ie=0;ie<Z.length&&!(k=Z[ie],o?k.ranges&&!k.equals(e.sel):!k.ranges);ie++);if(ie==Z.length)return;for(m.lastOrigin=m.lastSelOrigin=null;;)if(k=Z.pop(),k.ranges){if(ba(k,te),o&&!k.equals(e.sel)){xi(e,k,{clearRedo:!1});return}Y=k}else if(i){Z.push(k);return}else break;var me=[];ba(Y,te),te.push({changes:me,generation:m.generation}),m.generation=k.generation||++m.maxGeneration;for(var xe=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),Ne=function(lt){var _t=k.changes[lt];if(_t.origin=t,xe&&!rs(e,_t,!1))return Z.length=0,{};me.push(Qa(e,_t));var Lt=lt?$a(e,_t):Le(Z);Zr(e,_t,Lt,$o(e,_t)),!lt&&e.cm&&e.cm.scrollIntoView({from:_t.from,to:ur(_t)});var Ut=[];dr(e,function(It,jt){!jt&&ne(Ut,It.history)==-1&&(us(It.history,_t),Ut.push(It.history)),Zr(It,_t,null,$o(It,_t))})},De=k.changes.length-1;De>=0;--De){var Ze=Ne(De);if(Ze)return Ze.v}}function os(e,t){if(t==0)return;if(e.first+=t,e.sel=new Hi(Ye(e.sel.ranges,function(m){return new An(ct(m.anchor.line+t,m.anchor.ch),ct(m.head.line+t,m.head.ch))}),e.sel.primIndex),e.cm){Li(e.cm,e.first,e.first-t,t);for(var o=e.cm.display,i=o.viewFrom;i<o.viewTo;i++)or(e.cm,i,"gutter")}}function Zr(e,t,o,i){if(e.cm&&!e.cm.curOp)return di(e.cm,Zr)(e,t,o,i);if(t.to.line<e.first){os(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 m=t.text.length-1-(e.first-t.from.line);os(e,m),t={from:ct(e.first,0),to:ct(t.to.line+m,t.to.ch),text:[Le(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:ct(k,Dt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Rn(e,t.from,t.to),o||(o=$a(e,t)),e.cm?bl(e.cm,t,i):Za(e,t,i),xa(e,o,pe),e.cantEdit&&Ta(e,ct(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,o){var i=e.doc,m=e.display,k=t.from,Y=t.to,Z=!1,te=k.line;e.options.lineWrapping||(te=Qt(Zn(Dt(i,k.line))),i.iter(te,Y.line+1,function(De){if(De==m.maxLine)return Z=!0,!0})),i.sel.contains(t.from,t.to)>-1&&ge(e),Za(i,t,o,To(e)),e.options.lineWrapping||(i.iter(te,k.line+t.text.length,function(De){var Ze=Ht(De);Ze>m.maxLineLength&&(m.maxLine=De,m.maxLineLength=Ze,m.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),Zt(i,k.line),Yr(e,400);var ie=t.text.length-(Y.line-k.line)-1;t.full?Li(e):k.line==Y.line&&t.text.length==1&&!Ko(e.doc,t)?or(e,k.line,"text"):Li(e,k.line,Y.line+1,ie);var me=de(e,"changes"),xe=de(e,"change");if(xe||me){var Ne={from:k,to:Y,text:t.text,removed:t.removed,origin:t.origin};xe&&gn(e,"change",e,Ne),me&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ne)}e.display.selForContextMenu=null}function Mr(e,t,o,i,m){var k;i||(i=o),St(i,o)<0&&(k=[i,o],o=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),Dr(e,{from:o,to:i,text:t,origin:m})}function ss(e,t,o,i){o<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function ls(e,t,o,i){for(var m=0;m<e.length;++m){var k=e[m],Y=!0;if(k.ranges){k.copied||(k=e[m]=k.deepCopy(),k.copied=!0);for(var Z=0;Z<k.ranges.length;Z++)ss(k.ranges[Z].anchor,t,o,i),ss(k.ranges[Z].head,t,o,i);continue}for(var te=0;te<k.changes.length;++te){var ie=k.changes[te];if(o<ie.from.line)ie.from=ct(ie.from.line+i,ie.from.ch),ie.to=ct(ie.to.line+i,ie.to.ch);else if(t<=ie.to.line){Y=!1;break}}Y||(e.splice(0,m+1),m=0)}}function us(e,t){var o=t.from.line,i=t.to.line,m=t.text.length-(i-o)-1;ls(e.done,o,i,m),ls(e.undone,o,i,m)}function Qr(e,t,o,i){var m=t,k=t;return typeof t=="number"?k=Dt(e,J(e,t)):m=Qt(t),m==null?null:(i(k,m)&&e.cm&&or(e.cm,m,o),k)}function qr(e){this.lines=e,this.parent=null;for(var t=0,o=0;o<e.length;++o)e[o].parent=this,t+=e[o].height;this.height=t}qr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var o=e,i=e+t;o<i;++o){var m=this.lines[o];this.height-=m.height,Ft(m),gn(m,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,o){this.height+=o,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,o){for(var i=e+t;e<i;++e)if(o(this.lines[e]))return!0}};function ea(e){this.children=e;for(var t=0,o=0,i=0;i<e.length;++i){var m=e[i];t+=m.chunkSize(),o+=m.height,m.parent=this}this.size=t,this.height=o,this.parent=null}ea.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var o=0;o<this.children.length;++o){var i=this.children[o],m=i.chunkSize();if(e<m){var k=Math.min(t,m-e),Y=i.height;if(i.removeInner(e,k),this.height-=Y-i.height,m==k&&(this.children.splice(o--,1),i.parent=null),(t-=k)==0)break;e=0}else e-=m}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof qr))){var Z=[];this.collapse(Z),this.children=[new qr(Z)],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,o){this.size+=t.length,this.height+=o;for(var i=0;i<this.children.length;++i){var m=this.children[i],k=m.chunkSize();if(e<=k){if(m.insertInner(e,t,o),m.lines&&m.lines.length>50){for(var Y=m.lines.length%25+25,Z=Y;Z<m.lines.length;){var te=new qr(m.lines.slice(Z,Z+=25));m.height-=te.height,this.children.splice(++i,0,te),te.parent=this}m.lines=m.lines.slice(0,Y),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),o=new ea(t);if(e.parent){e.size-=o.size,e.height-=o.height;var m=ne(e.parent.children,e);e.parent.children.splice(m+1,0,o)}else{var i=new ea(e.children);i.parent=e,e.children=[i,o],e=i}o.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,o){for(var i=0;i<this.children.length;++i){var m=this.children[i],k=m.chunkSize();if(e<k){var Y=Math.min(t,k-e);if(m.iterN(e,Y,o))return!0;if((t-=Y)==0)break;e=0}else e-=k}}};var ta=function(e,t,o){if(o)for(var i in o)o.hasOwnProperty(i)&&(this[i]=o[i]);this.doc=e,this.node=t};ta.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,o=this.line,i=Qt(o);if(i==null||!t)return;for(var m=0;m<t.length;++m)t[m]==this&&t.splice(m--,1);t.length||(o.widgets=null);var k=ti(this);Cn(o,Math.max(0,o.height-k)),e&&(Ui(e,function(){ds(e,o,-k),or(e,i,"widget")}),gn(e,"lineWidgetCleared",e,this,i))},ta.prototype.changed=function(){var e=this,t=this.height,o=this.doc.cm,i=this.line;this.height=null;var m=ti(this)-t;if(!m)return;Ri(this.doc,i)||Cn(i,i.height+m),o&&Ui(o,function(){o.curOp.forceUpdate=!0,ds(o,i,m),gn(o,"lineWidgetChanged",o,e,Qt(i))})},ce(ta);function ds(e,t,o){Kn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ka(e,o)}function El(e,t,o,i){var m=new ta(e,o,i),k=e.cm;return k&&m.noHScroll&&(k.display.alignWidgets=!0),Qr(e,t,"widget",function(Y){var Z=Y.widgets||(Y.widgets=[]);if(m.insertAt==null?Z.push(m):Z.splice(Math.min(Z.length-1,Math.max(0,m.insertAt)),0,m),m.line=Y,k&&!Ri(e,Y)){var te=Kn(Y)<e.scrollTop;Cn(Y,Y.height+ti(m)),te&&Ka(k,m.height),k.curOp.forceUpdate=!0}return!0}),k&&gn(k,"lineWidgetAdded",k,m,typeof t=="number"?t:Qt(t)),m}var cs=0,cr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++cs};cr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&_r(e),de(this,"clear")){var o=this.find();o&&gn(this,"clear",o.from,o.to)}for(var i=null,m=null,k=0;k<this.lines.length;++k){var Y=this.lines[k],Z=xn(Y.markedSpans,this);e&&!this.collapsed?or(e,Qt(Y),"text"):e&&(Z.to!=null&&(m=Qt(Y)),Z.from!=null&&(i=Qt(Y))),Y.markedSpans=In(Y.markedSpans,Z),Z.from==null&&this.collapsed&&!Ri(this.doc,Y)&&e&&Cn(Y,Sr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var te=0;te<this.lines.length;++te){var ie=Zn(this.lines[te]),me=Ht(ie);me>e.display.maxLineLength&&(e.display.maxLine=ie,e.display.maxLineLength=me,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Li(e,i,m+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&es(e.doc)),e&&gn(e,"markerCleared",e,this,i,m),t&&br(e),this.parent&&this.parent.clear()},cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var o,i,m=0;m<this.lines.length;++m){var k=this.lines[m],Y=xn(k.markedSpans,this);if(Y.from!=null&&(o=ct(t?k:Qt(k),Y.from),e==-1))return o;if(Y.to!=null&&(i=ct(t?k:Qt(k),Y.to),e==1))return i}return o&&{from:o,to:i}},cr.prototype.changed=function(){var e=this,t=this.find(-1,!0),o=this,i=this.doc.cm;if(!t||!i)return;Ui(i,function(){var m=t.line,k=Qt(t.line),Y=da(i,k);if(Y&&(mo(Y),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Ri(o.doc,m)&&o.height!=null){var Z=o.height;o.height=null;var te=ti(o)-Z;te&&Cn(m,m.height+te)}gn(i,"markerChanged",i,e)})},cr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},cr.prototype.detachLine=function(e){if(this.lines.splice(ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(cr);function Pr(e,t,o,i,m){if(i&&i.shared)return xl(e,t,o,i,m);if(e.cm&&!e.cm.curOp)return di(e.cm,Pr)(e,t,o,i,m);var k=new cr(e,m),Y=St(t,o);if(i&&R(i,k,!1),Y>0||Y==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=E("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(sn(e,t.line,t,o,k)||t.line!=o.line&&sn(e,o.line,t,o,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");On()}k.addToHistory&&Xo(e,{from:t,to:o,origin:"markText"},e.sel,NaN);var Z=t.line,te=e.cm,ie;if(e.iter(Z,o.line+1,function(xe){te&&k.collapsed&&!te.options.lineWrapping&&Zn(xe)==te.display.maxLine&&(ie=!0),k.collapsed&&Z!=t.line&&Cn(xe,0),Hn(xe,new Ln(k,Z==t.line?t.ch:null,Z==o.line?o.ch:null)),++Z}),k.collapsed&&e.iter(t.line,o.line+1,function(xe){Ri(e,xe)&&Cn(xe,0)}),k.clearOnEnter&&Ce(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(wn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++cs,k.atomic=!0),te){if(ie&&(te.curOp.updateMaxLine=!0),k.collapsed)Li(te,t.line,o.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var me=t.line;me<=o.line;me++)or(te,me,"text");k.atomic&&es(te.doc),gn(te,"markerAdded",te,k)}return k}var na=function(e,t){this.markers=e,this.primary=t;for(var o=0;o<e.length;++o)e[o].parent=this};na.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();gn(this,"clear")},na.prototype.find=function(e,t){return this.primary.find(e,t)},ce(na);function xl(e,t,o,i,m){i=R(i),i.shared=!1;var k=[Pr(e,t,o,i,m)],Y=k[0],Z=i.widgetNode;return dr(e,function(te){Z&&(i.widgetNode=Z.cloneNode(!0)),k.push(Pr(te,w(te,t),w(te,o),i,m));for(var ie=0;ie<te.linked.length;++ie)if(te.linked[ie].isParent)return;Y=Le(k)}),new na(k,Y)}function hs(e){return e.findMarks(ct(e.first,0),e.clipPos(ct(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var o=0;o<t.length;o++){var i=t[o],m=i.find(),k=e.clipPos(m.from),Y=e.clipPos(m.to);if(St(k,Y)){var Z=Pr(e,k,Y,i.primary,i.primary.type);i.markers.push(Z),Z.parent=i}}}function Cl(e){for(var t=function(i){var m=e[i],k=[m.primary.doc];dr(m.primary.doc,function(te){return k.push(te)});for(var Y=0;Y<m.markers.length;Y++){var Z=m.markers[Y];ne(k,Z.doc)==-1&&(Z.parent=null,m.markers.splice(Y--,1))}},o=0;o<e.length;o++)t(o)}var Sl=0,Ii=function(e,t,o,i,m){if(!(this instanceof Ii))return new Ii(e,t,o,i,m);o==null&&(o=0),ea.call(this,[new qr([new _i("",null)])]),this.first=o,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=o;var k=ct(o,0);this.sel=lr(k),this.history=new _a(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=m=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Za(this,{from:k,to:k,text:e}),xi(this,lr(k),pe)};Ii.prototype=it(ea.prototype,{constructor:Ii,iter:function(e,t,o){o?this.iterN(e-this.first,t-e,o):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var o=0,i=0;i<t.length;++i)o+=t[i].height;this.insertInner(e-this.first,t,o)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ci(function(e){var t=ct(this.first,0),o=this.first+this.size-1;Dr(this,{from:t,to:ct(o,Dt(this,o).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Gr(this.cm,0,0),xi(this,lr(t),pe)}),replaceRange:function(e,t,o,i){t=w(this,t),o=o?w(this,o):t,Mr(this,e,t,o,i)},getRange:function(e,t,o){var i=Rn(this,w(this,e),w(this,t));return o===!1?i:i.join(o||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Bn(this,e))return Dt(this,e)},getLineNumber:function(e){return Qt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Dt(this,e)),Zn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return w(this,e)},getCursor:function(e){var t=this.sel.primary(),o;return e==null||e=="head"?o=t.head:e=="anchor"?o=t.anchor:e=="end"||e=="to"||e===!1?o=t.to():o=t.from(),o},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ci(function(e,t,o){Zo(this,w(this,typeof e=="number"?ct(e,t||0):e),null,o)}),setSelection:ci(function(e,t,o){Zo(this,w(this,e),w(this,t||e),o)}),extendSelection:ci(function(e,t,o){Ea(this,w(this,e),t&&w(this,t),o)}),extendSelections:ci(function(e,t){Jo(this,j(this,e),t)}),extendSelectionsBy:ci(function(e,t){var o=Ye(this.sel.ranges,e);Jo(this,j(this,o),t)}),setSelections:ci(function(e,t,o){if(!e.length)return;for(var i=[],m=0;m<e.length;m++)i[m]=new An(w(this,e[m].anchor),w(this,e[m].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),xi(this,Ji(this.cm,i,t),o)}),addSelection:ci(function(e,t,o){var i=this.sel.ranges.slice(0);i.push(new An(w(this,e),w(this,t||e))),xi(this,Ji(this.cm,i,i.length-1),o)}),getSelection:function(e){for(var t=this.sel.ranges,o,i=0;i<t.length;i++){var m=Rn(this,t[i].from(),t[i].to());o=o?o.concat(m):m}return e===!1?o:o.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],o=this.sel.ranges,i=0;i<o.length;i++){var m=Rn(this,o[i].from(),o[i].to());e!==!1&&(m=m.join(e||this.lineSeparator())),t[i]=m}return t},replaceSelection:function(e,t,o){for(var i=[],m=0;m<this.sel.ranges.length;m++)i[m]=e;this.replaceSelections(i,t,o||"+input")},replaceSelections:ci(function(e,t,o){for(var i=[],m=this.sel,k=0;k<m.ranges.length;k++){var Y=m.ranges[k];i[k]={from:Y.from(),to:Y.to(),text:this.splitLines(e[k]),origin:o}}for(var Z=t&&t!="end"&&hl(this,i,t),te=i.length-1;te>=0;te--)Dr(this,i[te]);Z?Qo(this,Z):this.cm&&Ar(this.cm)}),undo:ci(function(){Ca(this,"undo")}),redo:ci(function(){Ca(this,"redo")}),undoSelection:ci(function(){Ca(this,"undo",!0)}),redoSelection:ci(function(){Ca(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,o=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var m=0;m<e.undone.length;m++)e.undone[m].ranges||++o;return{undo:t,redo:o}},clearHistory:function(){var e=this;this.history=new _a(this.history.maxGeneration),dr(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:Lr(this.history.done),undone:Lr(this.history.undone)}},setHistory:function(e){var t=this.history=new _a(this.history.maxGeneration);t.done=Lr(e.done.slice(0),null,!0),t.undone=Lr(e.undone.slice(0),null,!0)},setGutterMarker:ci(function(e,t,o){return Qr(this,e,"gutter",function(i){var m=i.gutterMarkers||(i.gutterMarkers={});return m[t]=o,!o&>(m)&&(i.gutterMarkers=null),!0})}),clearGutter:ci(function(e){var t=this;this.iter(function(o){o.gutterMarkers&&o.gutterMarkers[e]&&Qr(t,o,"gutter",function(){return o.gutterMarkers[e]=null,gt(o.gutterMarkers)&&(o.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Bn(this,e))return null;if(t=e,e=Dt(this,e),!e)return null}else if(t=Qt(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:ci(function(e,t,o){return Qr(this,e,t=="gutter"?"gutter":"class",function(i){var m=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[m])i[m]=o;else{if(C(o).test(i[m]))return!1;i[m]+=" "+o}return!0})}),removeLineClass:ci(function(e,t,o){return Qr(this,e,t=="gutter"?"gutter":"class",function(i){var m=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=i[m];if(k)if(o==null)i[m]=null;else{var Y=k.match(C(o));if(!Y)return!1;var Z=Y.index+Y[0].length;i[m]=k.slice(0,Y.index)+(!Y.index||Z==k.length?"":" ")+k.slice(Z)||null}else return!1;return!0})}),addLineWidget:ci(function(e,t,o){return El(this,e,t,o)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,o){return Pr(this,w(this,e),w(this,t),o,o&&o.type||"range")},setBookmark:function(e,t){var o={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=w(this,e),Pr(this,e,e,o,"bookmark")},findMarksAt:function(e){e=w(this,e);var t=[],o=Dt(this,e.line).markedSpans;if(o)for(var i=0;i<o.length;++i){var m=o[i];(m.from==null||m.from<=e.ch)&&(m.to==null||m.to>=e.ch)&&t.push(m.marker.parent||m.marker)}return t},findMarks:function(e,t,o){e=w(this,e),t=w(this,t);var i=[],m=e.line;return this.iter(e.line,t.line+1,function(k){var Y=k.markedSpans;if(Y)for(var Z=0;Z<Y.length;Z++){var te=Y[Z];!(te.to!=null&&m==e.line&&e.ch>=te.to||te.from==null&&m!=e.line||te.from!=null&&m==t.line&&te.from>=t.ch)&&(!o||o(te.marker))&&i.push(te.marker.parent||te.marker)}++m}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var o=t.markedSpans;if(o)for(var i=0;i<o.length;++i)o[i].from!=null&&e.push(o[i].marker)}),e},posFromIndex:function(e){var t,o=this.first,i=this.lineSeparator().length;return this.iter(function(m){var k=m.text.length+i;if(k>e)return t=e,!0;e-=k,++o}),w(this,ct(o,t))},indexFromPos:function(e){e=w(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var o=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+o}),t},copy:function(e){var t=new Ii(Fn(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,o=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<o&&(o=e.to);var i=new Ii(Fn(this,t,o),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,hs(this)),i},unlinkDoc:function(e){if(e instanceof Wn&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var o=this.linked[t];if(o.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Cl(hs(this));break}if(e.history==this.history){var i=[e.id];dr(e,function(m){return i.push(m.id)},!0),e.history=new _a(null),e.history.done=Lr(this.history.done,i),e.history.undone=Lr(this.history.undone,i)}},iterLinkedDocs:function(e){dr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Be(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:ci(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Ii.prototype.eachLine=Ii.prototype.iter;var fs=0;function wl(e){var t=this;if(ps(t),je(t,e)||vn(t.display,e))return;re(e),H&&(fs=+new Date);var o=mr(t,e,!0),i=e.dataTransfer.files;if(!o||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var m=i.length,k=Array(m),Y=0,Z=function(){++Y==m&&di(t,function(){o=w(t.doc,o);var De={from:o,to:o,text:t.doc.splitLines(k.filter(function(Ze){return Ze!=null}).join(t.doc.lineSeparator())),origin:"paste"};Dr(t.doc,De),Qo(t.doc,lr(w(t.doc,o),w(t.doc,ur(De))))})()},te=function(De,Ze){if(t.options.allowDropFileTypes&&ne(t.options.allowDropFileTypes,De.type)==-1){Z();return}var lt=new FileReader;lt.onerror=function(){return Z()},lt.onload=function(){var _t=lt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(_t)){Z();return}k[Ze]=_t,Z()},lt.readAsText(De)},ie=0;ie<i.length;ie++)te(i[ie],ie);else{if(t.state.draggingText&&t.doc.sel.contains(o)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var me=e.dataTransfer.getData("Text");if(me){var xe;if(t.state.draggingText&&!t.state.draggingText.copy&&(xe=t.listSelections()),xa(t.doc,lr(o,o)),xe)for(var Ne=0;Ne<xe.length;++Ne)Mr(t.doc,"",xe[Ne].anchor,xe[Ne].head,"drag");t.replaceSelection(me,"around","paste"),t.display.input.focus()}}catch(De){}}}function Ol(e,t){if(H&&(!e.state.draggingText||+new Date-fs<100)){fe(t);return}if(je(e,t)||vn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!u){var o=c("img",null,null,"position: fixed; left: 0; top: 0;");o.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(o.width=o.height=1,e.display.wrapper.appendChild(o),o._top=o.offsetTop),t.dataTransfer.setDragImage(o,0,0),f&&o.parentNode.removeChild(o)}}function Al(e,t){var o=mr(e,t);if(!o)return;var i=document.createDocumentFragment();wo(e,o,i),e.display.dragCursor||(e.display.dragCursor=c("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),p(e.display.dragCursor,i)}function ps(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ms(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),o=[],i=0;i<t.length;i++){var m=t[i].CodeMirror;m&&o.push(m)}o.length&&o[0].operation(function(){for(var k=0;k<o.length;k++)e(o[k])})}var gs=!1;function Rl(){if(gs)return;Ll(),gs=!0}function Ll(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ms(Il)},100))}),Ce(window,"blur",function(){return ms(Or)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var hr={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"},ia=0;ia<10;ia++)hr[ia+48]=hr[ia+96]=String(ia);for(var Sa=65;Sa<=90;Sa++)hr[Sa]=String.fromCharCode(Sa);for(var ra=1;ra<=12;ra++)hr[ra+111]=hr[ra+63235]="F"+ra;var rr={};rr.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"},rr.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"},rr.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"},rr.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"]},rr.default=n?rr.macDefault:rr.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var o,i,m,k,Y=0;Y<t.length-1;Y++){var Z=t[Y];if(/^(cmd|meta|m)$/i.test(Z))k=!0;else if(/^a(lt)?$/i.test(Z))o=!0;else if(/^(c|ctrl|control)$/i.test(Z))i=!0;else if(/^s(hift)?$/i.test(Z))m=!0;else throw new Error("Unrecognized modifier name: "+Z)}return o&&(e="Alt-"+e),i&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),m&&(e="Shift-"+e),e}function Ml(e){var t={};for(var o in e)if(e.hasOwnProperty(o)){var i=e[o];if(/^(name|fallthrough|(de|at)tach)$/.test(o))continue;if(i=="..."){delete e[o];continue}for(var m=Ye(o.split(" "),Dl),k=0;k<m.length;k++){var Y=void 0,Z=void 0;k==m.length-1?(Z=m.join(" "),Y=i):(Z=m.slice(0,k+1).join(" "),Y="...");var te=t[Z];if(!te)t[Z]=Y;else if(te!=Y)throw new Error("Inconsistent bindings for "+Z)}delete e[o]}for(var ie in t)e[ie]=t[ie];return e}function kr(e,t,o,i){t=wa(t);var m=t.call?t.call(e,i):t[e];if(m===!1)return"nothing";if(m==="...")return"multi";if(m!=null&&o(m))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return kr(e,t.fallthrough,o,i);for(var k=0;k<t.fallthrough.length;k++){var Y=kr(e,t.fallthrough[k],o,i);if(Y)return Y}}}function vs(e){var t=typeof e=="string"?e:hr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ys(e,t,o){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!o&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function _s(e,t){if(f&&e.keyCode==34&&e.char)return!1;var o=hr[e.keyCode];return o==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(o=e.code),ys(o,e,t))}function wa(e){return typeof e=="string"?rr[e]:e}function Nr(e,t){for(var o=e.doc.sel.ranges,i=[],m=0;m<o.length;m++){for(var k=t(o[m]);i.length&&St(k.from,Le(i).to)<=0;){var Y=i.pop();if(St(Y.from,k.from)<0){k.from=Y.from;break}}i.push(k)}Ui(e,function(){for(var Z=i.length-1;Z>=0;Z--)Mr(e.doc,"",i[Z].from,i[Z].to,"+delete");Ar(e)})}function to(e,t,o){var i=Je(e.text,t+o,o);return i<0||i>e.text.length?null:i}function no(e,t,o){var i=to(e,t.ch,o);return i==null?null:new ct(t.line,i,o<0?"after":"before")}function io(e,t,o,i,m){if(e){t.doc.direction=="rtl"&&(m=-m);var k=Ot(o,t.doc.direction);if(k){var Y=m<0?Le(k):k[0],Z=m<0==(Y.level==1),te=Z?"after":"before",ie;if(Y.level>0||t.doc.direction=="rtl"){var me=Ei(t,o);ie=m<0?o.text.length-1:0;var xe=er(t,me,ie).top;ie=vt(function(Ne){return er(t,me,Ne).top==xe},m<0==(Y.level==1)?Y.from:Y.to-1,ie),te=="before"&&(ie=to(o,ie,1))}else ie=m<0?Y.to:Y.from;return new ct(i,ie,te)}}return new ct(i,m<0?o.text.length:0,m<0?"before":"after")}function Pl(e,t,o,i){var m=Ot(t,e.doc.direction);if(!m)return no(t,o,i);o.ch>=t.text.length?(o.ch=t.text.length,o.sticky="before"):o.ch<=0&&(o.ch=0,o.sticky="after");var k=xt(m,o.ch,o.sticky),Y=m[k];if(e.doc.direction=="ltr"&&Y.level%2==0&&(i>0?Y.to>o.ch:Y.from<o.ch))return no(t,o,i);var Z=function(Lt,Ut){return to(t,Lt instanceof ct?Lt.ch:Lt,Ut)},te,ie=function(Lt){return e.options.lineWrapping?(te=te||Ei(e,t),xo(e,t,te,Lt)):{begin:0,end:t.text.length}},me=ie(o.sticky=="before"?Z(o,-1):o.ch);if(e.doc.direction=="rtl"||Y.level==1){var xe=Y.level==1==i<0,Ne=Z(o,xe?1:-1);if(Ne!=null&&(xe?Ne<=Y.to&&Ne<=me.end:Ne>=Y.from&&Ne>=me.begin)){var De=xe?"before":"after";return new ct(o.line,Ne,De)}}var Ze=function(Lt,Ut,It){for(var jt=function(Nn,hi){return hi?new ct(o.line,Z(Nn,1),"before"):new ct(o.line,Nn,"after")};Lt>=0&&Lt<m.length;Lt+=Ut){var Yt=m[Lt],Vt=Ut>0==(Yt.level!=1),un=Vt?It.begin:Z(It.end,-1);if(Yt.from<=un&&un<Yt.to)return jt(un,Vt);if(un=Vt?Yt.from:Z(Yt.to,-1),It.begin<=un&&un<It.end)return jt(un,Vt)}},lt=Ze(k+i,i,me);if(lt)return lt;var _t=i>0?me.end:Z(me.begin,-1);return _t!=null&&!(i>0&&_t==t.text.length)&&(lt=Ze(i>0?0:m.length-1,i,ie(_t)),lt)?lt:null}var aa={selectAll:is,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Nr(e,function(t){if(t.empty()){var o=Dt(e.doc,t.head.line).text.length;return t.head.ch==o&&t.head.line<e.lastLine()?{from:t.head,to:ct(t.head.line+1,0)}:{from:t.head,to:ct(t.head.line,o)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Nr(e,function(t){return{from:ct(t.from().line,0),to:w(e.doc,ct(t.to().line+1,0))}})},delLineLeft:function(e){return Nr(e,function(t){return{from:ct(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Nr(e,function(t){var o=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:o},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return Nr(e,function(t){var o=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:o},"div");return{from:t.from(),to:i}})},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(ct(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ct(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return bs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Es(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return kl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:o},"div")},Oe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:o},"div")},Oe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:o},"div");return i.ch<e.getLine(i.line).search(/\S/)?Es(e,t.head):i},Oe)},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=[],o=e.listSelections(),i=e.options.tabSize,m=0;m<o.length;m++){var k=o[m].from(),Y=G(e.getLine(k.line),k.ch,i);t.push(oe(i-Y%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ui(e,function(){for(var t=e.listSelections(),o=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var m=t[i].head,k=Dt(e.doc,m.line).text;if(k){if(m.ch==k.length&&(m=new ct(m.line,m.ch-1)),m.ch>0)m=new ct(m.line,m.ch+1),e.replaceRange(k.charAt(m.ch-1)+k.charAt(m.ch-2),ct(m.line,m.ch-2),m,"+transpose");else if(m.line>e.doc.first){var Y=Dt(e.doc,m.line-1).text;Y&&(m=new ct(m.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+Y.charAt(Y.length-1),ct(m.line-1,Y.length-1),m,"+transpose"))}}o.push(new An(m,m))}e.setSelections(o)})},newlineAndIndent:function(e){return Ui(e,function(){for(var t=e.listSelections(),o=t.length-1;o>=0;o--)e.replaceRange(e.doc.lineSeparator(),t[o].anchor,t[o].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Ar(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function bs(e,t){var o=Dt(e.doc,t),i=Zn(o);return i!=o&&(t=Qt(i)),io(!0,e,i,t,1)}function kl(e,t){var o=Dt(e.doc,t),i=Ki(o);return i!=o&&(t=Qt(i)),io(!0,e,o,t,-1)}function Es(e,t){var o=bs(e,t.line),i=Dt(e.doc,o.line),m=Ot(i,e.doc.direction);if(!m||m[0].level==0){var k=Math.max(o.ch,i.text.search(/\S/)),Y=t.line==o.line&&t.ch<=k&&t.ch;return ct(o.line,Y?0:k,o.sticky)}return o}function Oa(e,t,o){if(typeof t=="string"&&(t=aa[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,m=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o&&(e.display.shift=!1),m=t(e)!=_e}finally{e.display.shift=i,e.state.suppressEdits=!1}return m}function Nl(e,t,o){for(var i=0;i<e.state.keyMaps.length;i++){var m=kr(t,e.state.keyMaps[i],o,e);if(m)return m}return e.options.extraKeys&&kr(t,e.options.extraKeys,o,e)||kr(t,e.options.keyMap,o,e)}var Ul=new Q;function oa(e,t,o,i){var m=e.state.keySeq;if(m){if(vs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==m&&(e.state.keySeq=null,e.display.input.reset())}),xs(e,m+" "+t,o,i))return!0}return xs(e,t,o,i)}function xs(e,t,o,i){var m=Nl(e,t,i);return m=="multi"&&(e.state.keySeq=t),m=="handled"&&gn(e,"keyHandled",e,t,o),(m=="handled"||m=="multi")&&(re(o),Ba(e)),!!m}function Ts(e,t){var o=_s(t,!0);return o?t.shiftKey&&!e.state.keySeq?oa(e,"Shift-"+o,t,function(i){return Oa(e,i,!0)})||oa(e,o,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return Oa(e,i)}):oa(e,o,t,function(i){return Oa(e,i)}):!1}function jl(e,t,o){return oa(e,"'"+o+"'",t,function(i){return Oa(e,i,!0)})}var ro=null;function Cs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),je(t,e))return;H&&F<11&&e.keyCode==27&&(e.returnValue=!1);var o=e.keyCode;t.display.shift=o==16||e.shiftKey;var i=Ts(t,e);f&&(ro=i?o:null,!i&&o==88&&!Me&&(n?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),M&&!n&&!i&&o==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),o==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;N(t,"CodeMirror-crosshair");function o(i){(i.keyCode==18||!i.altKey)&&(b(t,"CodeMirror-crosshair"),ze(document,"keyup",o),ze(document,"mouseover",o))}Ce(document,"keyup",o),Ce(document,"mouseover",o)}function Ss(e){e.keyCode==16&&(this.doc.sel.shift=!1),je(this,e)}function ws(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(vn(t.display,e)||je(t,e)||e.ctrlKey&&!e.altKey||n&&e.metaKey)return;var o=e.keyCode,i=e.charCode;if(f&&o==ro){ro=null,re(e);return}if(f&&(!e.which||e.which<10)&&Ts(t,e))return;var m=String.fromCharCode(i==null?o:i);if(m=="\b")return;if(jl(t,e,m))return;t.display.input.onKeyPress(e)}var Bl=400,ao=function(e,t,o){this.time=e,this.pos=t,this.button=o};ao.prototype.compare=function(e,t,o){return this.time+Bl>e&&St(t,this.pos)==0&&o==this.button};var sa,la;function Wl(e,t){var o=+new Date;return la&&la.compare(o,e,t)?(sa=la=null,"triple"):sa&&sa.compare(o,e,t)?(la=new ao(o,e,t),sa=null,"double"):(sa=new ao(o,e,t),la=null,"single")}function Os(e){var t=this,o=t.display;if(je(t,e)||o.activeTouch&&o.input.supportsTouch())return;if(o.input.ensurePolled(),o.shift=e.shiftKey,vn(o,e)){D||(o.scroller.draggable=!1,setTimeout(function(){return o.scroller.draggable=!0},100));return}if(oo(t,e))return;var i=mr(t,e),m=Ie(e),k=i?Wl(i,m):"single";if(window.focus(),m==1&&t.state.selectingText&&t.state.selectingText(e),i&&Hl(t,m,i,k,e))return;m==1?i?Gl(t,i,k,e):be(e)==o.scroller&&re(e):m==2?(i&&Ea(t.doc,i),setTimeout(function(){return o.input.focus()},20)):m==3&&(A?t.display.input.onContextMenu(e):Ao(t))}function Hl(e,t,o,i,m){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,oa(e,ys(k,m),m,function(Y){if(typeof Y=="string"&&(Y=aa[Y]),!Y)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=Y(e,o)!=_e}finally{e.state.suppressEdits=!1}return Z})}function Kl(e,t,o){var i=e.getOption("configureMouse"),m=i?i(e,t,o):{};if(m.unit==null){var k=h?o.shiftKey&&o.metaKey:o.altKey;m.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(m.extend==null||e.doc.extend)&&(m.extend=e.doc.extend||o.shiftKey),m.addNew==null&&(m.addNew=n?o.metaKey:o.ctrlKey),m.moveOnDrag==null&&(m.moveOnDrag=!(n?o.altKey:o.ctrlKey)),m}function Gl(e,t,o,i){H?setTimeout(B(Oo,e),0):e.curOp.focus=P();var m=Kl(e,o,i),k=e.doc.sel,Y;e.options.dragDrop&&Xe&&!e.isReadOnly()&&o=="single"&&(Y=k.contains(t))>-1&&(St((Y=k.ranges[Y]).from(),t)<0||t.xRel>0)&&(St(Y.to(),t)>0||t.xRel<0)?zl(e,i,t,m):Vl(e,i,t,m)}function zl(e,t,o,i){var m=e.display,k=!1,Y=di(e,function(ie){D&&(m.scroller.draggable=!1),e.state.draggingText=!1,ze(m.wrapper.ownerDocument,"mouseup",Y),ze(m.wrapper.ownerDocument,"mousemove",Z),ze(m.scroller,"dragstart",te),ze(m.scroller,"drop",Y),k||(re(ie),i.addNew||Ea(e.doc,o,null,null,i.extend),D&&!u||H&&F==9?setTimeout(function(){m.wrapper.ownerDocument.body.focus({preventScroll:!0}),m.input.focus()},20):m.input.focus())}),Z=function(ie){k=k||Math.abs(t.clientX-ie.clientX)+Math.abs(t.clientY-ie.clientY)>=10},te=function(){return k=!0};D&&(m.scroller.draggable=!0),e.state.draggingText=Y,Y.copy=!i.moveOnDrag,m.scroller.dragDrop&&m.scroller.dragDrop(),Ce(m.wrapper.ownerDocument,"mouseup",Y),Ce(m.wrapper.ownerDocument,"mousemove",Z),Ce(m.scroller,"dragstart",te),Ce(m.scroller,"drop",Y),Ao(e),setTimeout(function(){return m.input.focus()},20)}function As(e,t,o){if(o=="char")return new An(t,t);if(o=="word")return e.findWordAt(t);if(o=="line")return new An(ct(t.line,0),w(e.doc,ct(t.line+1,0)));var i=o(e,t);return new An(i.from,i.to)}function Vl(e,t,o,i){var m=e.display,k=e.doc;re(t);var Y,Z,te=k.sel,ie=te.ranges;if(i.addNew&&!i.extend?(Z=k.sel.contains(o),Z>-1?Y=ie[Z]:Y=new An(o,o)):(Y=k.sel.primary(),Z=k.sel.primIndex),i.unit=="rectangle")i.addNew||(Y=new An(o,o)),o=mr(e,t,!0,!0),Z=-1;else{var me=As(e,o,i.unit);i.extend?Y=qa(Y,me.anchor,me.head,i.extend):Y=me}i.addNew?Z==-1?(Z=ie.length,xi(k,Ji(e,ie.concat([Y]),Z),{scroll:!1,origin:"*mouse"})):ie.length>1&&ie[Z].empty()&&i.unit=="char"&&!i.extend?(xi(k,Ji(e,ie.slice(0,Z).concat(ie.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),te=k.sel):eo(k,Z,Y,Ee):(Z=0,xi(k,new Hi([Y],0),Ee),te=k.sel);var xe=o;function Ne(It){if(St(xe,It)==0)return;if(xe=It,i.unit=="rectangle"){for(var jt=[],Yt=e.options.tabSize,Vt=G(Dt(k,o.line).text,o.ch,Yt),un=G(Dt(k,It.line).text,It.ch,Yt),Nn=Math.min(Vt,un),hi=Math.max(Vt,un),Gn=Math.min(o.line,It.line),ji=Math.min(e.lastLine(),Math.max(o.line,It.line));Gn<=ji;Gn++){var Di=Dt(k,Gn).text,ni=we(Di,Nn,Yt);Nn==hi?jt.push(new An(ct(Gn,ni),ct(Gn,ni))):Di.length>ni&&jt.push(new An(ct(Gn,ni),ct(Gn,we(Di,hi,Yt))))}jt.length||jt.push(new An(o,o)),xi(k,Ji(e,te.ranges.slice(0,Z).concat(jt),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(It)}else{var Mi=Y,yi=As(e,It,i.unit),si=Mi.anchor,ii;St(yi.anchor,si)>0?(ii=yi.head,si=ki(Mi.from(),yi.anchor)):(ii=yi.anchor,si=ui(Mi.to(),yi.head));var Yn=te.ranges.slice(0);Yn[Z]=Xl(e,new An(w(k,si),ii)),xi(k,Ji(e,Yn,Z),Ee)}}var De=m.wrapper.getBoundingClientRect(),Ze=0;function lt(It){var jt=++Ze,Yt=mr(e,It,!0,i.unit=="rectangle");if(!Yt)return;if(St(Yt,xe)!=0){e.curOp.focus=P(),Ne(Yt);var Vt=ma(m,k);(Yt.line>=Vt.to||Yt.line<Vt.from)&&setTimeout(di(e,function(){Ze==jt&<(It)}),150)}else{var un=It.clientY<De.top?-20:It.clientY>De.bottom?20:0;un&&setTimeout(di(e,function(){if(Ze!=jt)return;m.scroller.scrollTop+=un,lt(It)}),50)}}function _t(It){e.state.selectingText=!1,Ze=Infinity,It&&(re(It),m.input.focus()),ze(m.wrapper.ownerDocument,"mousemove",Lt),ze(m.wrapper.ownerDocument,"mouseup",Ut),k.history.lastSelOrigin=null}var Lt=di(e,function(It){It.buttons===0||!Ie(It)?_t(It):lt(It)}),Ut=di(e,_t);e.state.selectingText=Ut,Ce(m.wrapper.ownerDocument,"mousemove",Lt),Ce(m.wrapper.ownerDocument,"mouseup",Ut)}function Xl(e,t){var o=t.anchor,i=t.head,m=Dt(e.doc,o.line);if(St(o,i)==0&&o.sticky==i.sticky)return t;var k=Ot(m);if(!k)return t;var Y=xt(k,o.ch,o.sticky),Z=k[Y];if(Z.from!=o.ch&&Z.to!=o.ch)return t;var te=Y+(Z.from==o.ch==(Z.level!=1)?0:1);if(te==0||te==k.length)return t;var ie;if(i.line!=o.line)ie=(i.line-o.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var me=xt(k,i.ch,i.sticky),xe=me-Y||(i.ch-o.ch)*(Z.level==1?-1:1);me==te-1||me==te?ie=xe<0:ie=xe>0}var Ne=k[te+(ie?-1:0)],De=ie==(Ne.level==1),Ze=De?Ne.from:Ne.to,lt=De?"after":"before";return o.ch==Ze&&o.sticky==lt?t:new An(new ct(o.line,Ze,lt),i)}function Rs(e,t,o,i){var m,k;if(t.touches)m=t.touches[0].clientX,k=t.touches[0].clientY;else try{m=t.clientX,k=t.clientY}catch(Ne){return!1}if(m>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&re(t);var Y=e.display,Z=Y.lineDiv.getBoundingClientRect();if(k>Z.bottom||!de(e,o))return ue(t);k-=Z.top-Y.viewOffset;for(var te=0;te<e.display.gutterSpecs.length;++te){var ie=Y.gutters.childNodes[te];if(ie&&ie.getBoundingClientRect().right>=m){var me=Sn(e.doc,k),xe=e.display.gutterSpecs[te];return Re(e,o,e,me,xe.className,t),ue(t)}}}function oo(e,t){return Rs(e,t,"gutterClick",!0)}function Ls(e,t){if(vn(e.display,t)||Yl(e,t))return;if(je(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Rs(e,t,"gutterContextMenu",!1):!1}function Is(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hr(e)}var Ur={toString:function(){return"CodeMirror.Init"}},Ds={},Aa={};function $l(e){var t=e.optionHandlers;function o(i,m,k,Y){e.defaults[i]=m,k&&(t[i]=Y?function(Z,te,ie){ie!=Ur&&k(Z,te,ie)}:k)}e.defineOption=o,e.Init=Ur,o("value","",function(i,m){return i.setValue(m)},!0),o("mode",null,function(i,m){i.doc.modeOption=m,Ja(i)},!0),o("indentUnit",2,Ja,!0),o("indentWithTabs",!1),o("smartIndent",!0),o("tabSize",4,function(i){Jr(i),Hr(i),Li(i)},!0),o("lineSeparator",null,function(i,m){if(i.doc.lineSep=m,!m)return;var k=[],Y=i.doc.first;i.doc.iter(function(te){for(var ie=0;;){var me=te.text.indexOf(m,ie);if(me==-1)break;ie=me+m.length,k.push(ct(Y,me))}Y++});for(var Z=k.length-1;Z>=0;Z--)Mr(i.doc,m,k[Z],ct(k[Z].line,k[Z].ch+m.length))}),o("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,m,k){i.state.specialChars=new RegExp(m.source+(m.test(" ")?"":"| "),"g"),k!=Ur&&i.refresh()}),o("specialCharPlaceholder",Tn,function(i){return i.refresh()},!0),o("electricChars",!0),o("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),o("spellcheck",!1,function(i,m){return i.getInputField().spellcheck=m},!0),o("autocorrect",!1,function(i,m){return i.getInputField().autocorrect=m},!0),o("autocapitalize",!1,function(i,m){return i.getInputField().autocapitalize=m},!0),o("rtlMoveVisually",!O),o("wholeLineUpdateBefore",!0),o("theme","default",function(i){Is(i),$r(i)},!0),o("keyMap","default",function(i,m,k){var Y=wa(m),Z=k!=Ur&&wa(k);Z&&Z.detach&&Z.detach(i,Y),Y.attach&&Y.attach(i,Z||null)}),o("extraKeys",null),o("configureMouse",null),o("lineWrapping",!1,Zl,!0),o("gutters",[],function(i,m){i.display.gutterSpecs=Ya(m,i.options.lineNumbers),$r(i)},!0),o("fixedGutter",!0,function(i,m){i.display.gutters.style.left=m?ja(i.display)+"px":"0",i.refresh()},!0),o("coverGutterNextToScrollbar",!1,function(i){return Rr(i)},!0),o("scrollbarStyle","native",function(i){Po(i),Rr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),o("lineNumbers",!1,function(i,m){i.display.gutterSpecs=Ya(i.options.gutters,m),$r(i)},!0),o("firstLineNumber",1,$r,!0),o("lineNumberFormatter",function(i){return i},$r,!0),o("showCursorWhenSelecting",!1,Kr,!0),o("resetSelectionOnContextMenu",!0),o("lineWiseCopyCut",!0),o("pasteLinesPerSelection",!0),o("selectionsMayTouch",!1),o("readOnly",!1,function(i,m){m=="nocursor"&&(Or(i),i.display.input.blur()),i.display.input.readOnlyChanged(m)}),o("screenReaderLabel",null,function(i,m){m=m===""?null:m,i.display.input.screenReaderLabelChanged(m)}),o("disableInput",!1,function(i,m){m||i.display.input.reset()},!0),o("dragDrop",!0,Jl),o("allowDropFileTypes",null),o("cursorBlinkRate",530),o("cursorScrollMargin",0),o("cursorHeight",1,Kr,!0),o("singleCursorHeightPerLine",!0,Kr,!0),o("workTime",100),o("workDelay",100),o("flattenSpans",!0,Jr,!0),o("addModeClass",!1,Jr,!0),o("pollInterval",100),o("undoDepth",200,function(i,m){return i.doc.history.undoDepth=m}),o("historyEventDelay",1250),o("viewportMargin",10,function(i){return i.refresh()},!0),o("maxHighlightLength",1e4,Jr,!0),o("moveInputWithCursor",!0,function(i,m){m||i.display.input.resetPosition()}),o("tabindex",null,function(i,m){return i.display.input.getField().tabIndex=m||""}),o("autofocus",null),o("direction","ltr",function(i,m){return i.doc.setDirection(m)},!0),o("phrases",null)}function Jl(e,t,o){var i=o&&o!=Ur;if(!t!=!i){var m=e.display.dragFunctions,k=t?Ce:ze;k(e.display.scroller,"dragstart",m.start),k(e.display.scroller,"dragenter",m.enter),k(e.display.scroller,"dragover",m.over),k(e.display.scroller,"dragleave",m.leave),k(e.display.scroller,"drop",m.drop)}}function Zl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(b(e.display.wrapper,"CodeMirror-wrap"),Xi(e)),Fa(e),Li(e),Hr(e),setTimeout(function(){return Rr(e)},100)}function Wn(e,t){var o=this;if(!(this instanceof Wn))return new Wn(e,t);this.options=t=t?R(t):{},R(Ds,t,!1);var i=t.value;typeof i=="string"?i=new Ii(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var m=new Wn.inputStyles[t.inputStyle](this),k=this.display=new dl(e,i,m,t);k.wrapper.CodeMirror=this,Is(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Po(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 Q,keySeq:null,specialChars:null},t.autofocus&&!a&&k.input.focus(),H&&F<11&&setTimeout(function(){return o.display.input.reset(!0)},20),Ql(this),Rl(),_r(this),this.curOp.forceUpdate=!0,Go(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){o.hasFocus()&&!o.state.focused&&Wa(o)},20):Or(this);for(var Y in Aa)Aa.hasOwnProperty(Y)&&Aa[Y](this,t[Y],Ur);Uo(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<so.length;++Z)so[Z](this);br(this),D&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Wn.defaults=Ds,Wn.optionHandlers=Aa;function Ql(e){var t=e.display;Ce(t.scroller,"mousedown",di(e,Os)),H&&F<11?Ce(t.scroller,"dblclick",di(e,function(te){if(je(e,te))return;var ie=mr(e,te);if(!ie||oo(e,te)||vn(e.display,te))return;re(te);var me=e.findWordAt(ie);Ea(e.doc,me.anchor,me.head)})):Ce(t.scroller,"dblclick",function(te){return je(e,te)||re(te)}),Ce(t.scroller,"contextmenu",function(te){return Ls(e,te)}),Ce(t.input.getField(),"contextmenu",function(te){t.scroller.contains(te.target)||Ls(e,te)});var o,i={end:0};function m(){t.activeTouch&&(o=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function k(te){if(te.touches.length!=1)return!1;var ie=te.touches[0];return ie.radiusX<=1&&ie.radiusY<=1}function Y(te,ie){if(ie.left==null)return!0;var me=ie.left-te.left,xe=ie.top-te.top;return me*me+xe*xe>20*20}Ce(t.scroller,"touchstart",function(te){if(!je(e,te)&&!k(te)&&!oo(e,te)){t.input.ensurePolled(),clearTimeout(o);var ie=+new Date;t.activeTouch={start:ie,moved:!1,prev:ie-i.end<=300?i:null},te.touches.length==1&&(t.activeTouch.left=te.touches[0].pageX,t.activeTouch.top=te.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(te){var ie=t.activeTouch;if(ie&&!vn(t,te)&&ie.left!=null&&!ie.moved&&new Date-ie.start<300){var me=e.coordsChar(t.activeTouch,"page"),xe;!ie.prev||Y(ie,ie.prev)?xe=new An(me,me):!ie.prev.prev||Y(ie,ie.prev.prev)?xe=e.findWordAt(me):xe=new An(ct(me.line,0),w(e.doc,ct(me.line+1,0))),e.setSelection(xe.anchor,xe.head),e.focus(),re(te)}m()}),Ce(t.scroller,"touchcancel",m),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(zr(e,t.scroller.scrollTop),vr(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(te){return Bo(e,te)}),Ce(t.scroller,"DOMMouseScroll",function(te){return Bo(e,te)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(te){je(e,te)||fe(te)},over:function(te){je(e,te)||(Al(e,te),fe(te))},start:function(te){return Ol(e,te)},drop:di(e,wl),leave:function(te){je(e,te)||ps(e)}};var Z=t.input.getField();Ce(Z,"keyup",function(te){return Ss.call(e,te)}),Ce(Z,"keydown",di(e,Cs)),Ce(Z,"keypress",di(e,ws)),Ce(Z,"focus",function(te){return Wa(e,te)}),Ce(Z,"blur",function(te){return Or(e,te)})}var so=[];Wn.defineInitHook=function(e){return so.push(e)};function ua(e,t,o,i){var m=e.doc,k;o==null&&(o="add"),o=="smart"&&(m.mode.indent?k=ot(e,t).state:o="prev");var Y=e.options.tabSize,Z=Dt(m,t),te=G(Z.text,null,Y);Z.stateAfter&&(Z.stateAfter=null);var ie=Z.text.match(/^\s*/)[0],me;if(!i&&!/\S/.test(Z.text))me=0,o="not";else if(o=="smart"&&(me=m.mode.indent(k,Z.text.slice(ie.length),Z.text),me==_e||me>150)){if(!i)return;o="prev"}o=="prev"?t>m.first?me=G(Dt(m,t-1).text,null,Y):me=0:o=="add"?me=te+e.options.indentUnit:o=="subtract"?me=te-e.options.indentUnit:typeof o=="number"&&(me=te+o),me=Math.max(0,me);var xe="",Ne=0;if(e.options.indentWithTabs)for(var De=Math.floor(me/Y);De;--De)Ne+=Y,xe+=" ";if(Ne<me&&(xe+=oe(me-Ne)),xe!=ie)return Mr(m,xe,ct(t,0),ct(t,ie.length),"+input"),Z.stateAfter=null,!0;for(var Ze=0;Ze<m.sel.ranges.length;Ze++){var lt=m.sel.ranges[Ze];if(lt.head.line==t&<.head.ch<ie.length){var _t=ct(t,ie.length);eo(m,Ze,new An(_t,_t));break}}}var Zi=null;function Ra(e){Zi=e}function lo(e,t,o,i,m){var k=e.doc;e.display.shift=!1,i||(i=k.sel);var Y=+new Date-200,Z=m=="paste"||e.state.pasteIncoming>Y,te=Be(t),ie=null;if(Z&&i.ranges.length>1)if(Zi&&Zi.text.join(`
|
|
`)==t){if(i.ranges.length%Zi.text.length==0){ie=[];for(var me=0;me<Zi.text.length;me++)ie.push(k.splitLines(Zi.text[me]))}}else te.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ie=Ye(te,function(Lt){return[Lt]}));for(var xe=e.curOp.updateInput,Ne=i.ranges.length-1;Ne>=0;Ne--){var De=i.ranges[Ne],Ze=De.from(),lt=De.to();De.empty()&&(o&&o>0?Ze=ct(Ze.line,Ze.ch-o):e.state.overwrite&&!Z?lt=ct(lt.line,Math.min(Dt(k,lt.line).text.length,lt.ch+Le(te).length)):Z&&Zi&&Zi.lineWise&&Zi.text.join(`
|
|
`)==te.join(`
|
|
`)&&(Ze=lt=ct(Ze.line,0)));var _t={from:Ze,to:lt,text:ie?ie[Ne%ie.length]:te,origin:m||(Z?"paste":e.state.cutIncoming>Y?"cut":"+input")};Dr(e.doc,_t),gn(e,"inputRead",e,_t)}t&&!Z&&Ps(e,t),Ar(e),e.curOp.updateInput<2&&(e.curOp.updateInput=xe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ms(e,t){var o=e.clipboardData&&e.clipboardData.getData("Text");if(o)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ui(t,function(){return lo(t,o,0,null,"paste")}),!0}function Ps(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var o=e.doc.sel,i=o.ranges.length-1;i>=0;i--){var m=o.ranges[i];if(m.head.ch>100||i&&o.ranges[i-1].head.line==m.head.line)continue;var k=e.getModeAt(m.head),Y=!1;if(k.electricChars){for(var Z=0;Z<k.electricChars.length;Z++)if(t.indexOf(k.electricChars.charAt(Z))>-1){Y=ua(e,m.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(Dt(e.doc,m.head.line).text.slice(0,m.head.ch))&&(Y=ua(e,m.head.line,"smart")));Y&&gn(e,"electricInput",e,m.head.line)}}function ks(e){for(var t=[],o=[],i=0;i<e.doc.sel.ranges.length;i++){var m=e.doc.sel.ranges[i].head.line,k={anchor:ct(m,0),head:ct(m+1,0)};o.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:o}}function Ns(e,t,o,i){e.setAttribute("autocorrect",o?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Us(){var e=c("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=c("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),l&&(e.style.border="1px solid black"),Ns(e),t}function ql(e){var t=e.optionHandlers,o=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,m){var k=this.options,Y=k[i];if(k[i]==m&&i!="mode")return;k[i]=m,t.hasOwnProperty(i)&&di(this,t[i])(this,m,Y),Re(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,m){this.state.keyMaps[m?"push":"unshift"](wa(i))},removeKeyMap:function(i){for(var m=this.state.keyMaps,k=0;k<m.length;++k)if(m[k]==i||m[k].name==i)return m.splice(k,1),!0},addOverlay:Oi(function(i,m){var k=i.token?i:e.getMode(this.options,i);if(k.startState)throw new Error("Overlays may not be stateful.");nt(this.state.overlays,{mode:k,modeSpec:i,opaque:m&&m.opaque,priority:m&&m.priority||0},function(Y){return Y.priority}),this.state.modeGen++,Li(this)}),removeOverlay:Oi(function(i){for(var m=this.state.overlays,k=0;k<m.length;++k){var Y=m[k].modeSpec;if(Y==i||typeof i=="string"&&Y.name==i){m.splice(k,1),this.state.modeGen++,Li(this);return}}}),indentLine:Oi(function(i,m,k){typeof m!="string"&&typeof m!="number"&&(m==null?m=this.options.smartIndent?"smart":"prev":m=m?"add":"subtract"),Bn(this.doc,i)&&ua(this,i,m,k)}),indentSelection:Oi(function(i){for(var m=this.doc.sel.ranges,k=-1,Y=0;Y<m.length;Y++){var Z=m[Y];if(Z.empty())Z.head.line>k&&(ua(this,Z.head.line,i,!0),k=Z.head.line,Y==this.doc.sel.primIndex&&Ar(this));else{var te=Z.from(),ie=Z.to(),me=Math.max(k,te.line);k=Math.min(this.lastLine(),ie.line-(ie.ch?0:1))+1;for(var xe=me;xe<k;++xe)ua(this,xe,i);var Ne=this.doc.sel.ranges;te.ch==0&&m.length==Ne.length&&Ne[Y].from().ch>0&&eo(this.doc,Y,new An(te,Ne[Y].to()),pe)}}}),getTokenAt:function(i,m){return Mt(this,i,m)},getLineTokens:function(i,m){return Mt(this,ct(i),m,!0)},getTokenTypeAt:function(i){i=w(this.doc,i);var m=Ve(this,Dt(this.doc,i.line)),k=0,Y=(m.length-1)/2,Z=i.ch,te;if(Z==0)te=m[2];else for(;;){var ie=k+Y>>1;if((ie?m[ie*2-1]:0)>=Z)Y=ie;else if(m[ie*2+1]<Z)k=ie+1;else{te=m[ie*2+2];break}}var me=te?te.indexOf("overlay "):-1;return me<0?te:me==0?null:te.slice(0,me-1)},getModeAt:function(i){var m=this.doc.mode;return m.innerMode?e.innerMode(m,this.getTokenAt(i).state).mode:m},getHelper:function(i,m){return this.getHelpers(i,m)[0]},getHelpers:function(i,m){var k=[];if(!o.hasOwnProperty(m))return k;var Y=o[m],Z=this.getModeAt(i);if(typeof Z[m]=="string")Y[Z[m]]&&k.push(Y[Z[m]]);else if(Z[m])for(var te=0;te<Z[m].length;te++){var ie=Y[Z[m][te]];ie&&k.push(ie)}else Z.helperType&&Y[Z.helperType]?k.push(Y[Z.helperType]):Y[Z.name]&&k.push(Y[Z.name]);for(var me=0;me<Y._global.length;me++){var xe=Y._global[me];xe.pred(Z,this)&&ne(k,xe.val)==-1&&k.push(xe.val)}return k},getStateAfter:function(i,m){var k=this.doc;return i=J(k,i==null?k.first+k.size-1:i),ot(this,i+1,m).state},cursorCoords:function(i,m){var k,Y=this.doc.sel.primary();return i==null?k=Y.head:typeof i=="object"?k=w(this.doc,i):k=i?Y.from():Y.to(),$i(this,k,m||"page")},charCoords:function(i,m){return Ma(this,w(this.doc,i),m||"page")},coordsChar:function(i,m){return i=_o(this,i,m||"page"),ka(this,i.left,i.top)},lineAtHeight:function(i,m){return i=_o(this,{top:i,left:0},m||"page").top,Sn(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,m,k){var Y=!1,Z;if(typeof i=="number"){var te=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>te&&(i=te,Y=!0),Z=Dt(this.doc,i)}else Z=i;return ca(this,Z,{top:0,left:0},m||"page",k||Y).top+(Y?this.doc.height-Kn(Z):0)},defaultTextHeight:function(){return Sr(this.display)},defaultCharWidth:function(){return wr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,m,k,Y,Z){var te=this.display;i=$i(this,w(this.doc,i));var ie=i.bottom,me=i.left;if(m.style.position="absolute",m.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(m),te.sizer.appendChild(m),Y=="over")ie=i.top;else if(Y=="above"||Y=="near"){var xe=Math.max(te.wrapper.clientHeight,this.doc.height),Ne=Math.max(te.sizer.clientWidth,te.lineSpace.clientWidth);(Y=="above"||i.bottom+m.offsetHeight>xe)&&i.top>m.offsetHeight?ie=i.top-m.offsetHeight:i.bottom+m.offsetHeight<=xe&&(ie=i.bottom),me+m.offsetWidth>Ne&&(me=Ne-m.offsetWidth)}m.style.top=ie+"px",m.style.left=m.style.right="",Z=="right"?(me=te.sizer.clientWidth-m.offsetWidth,m.style.right="0px"):(Z=="left"?me=0:Z=="middle"&&(me=(te.sizer.clientWidth-m.offsetWidth)/2),m.style.left=me+"px"),k&&Js(this,{left:me,top:ie,right:me+m.offsetWidth,bottom:ie+m.offsetHeight})},triggerOnKeyDown:Oi(Cs),triggerOnKeyPress:Oi(ws),triggerOnKeyUp:Ss,triggerOnMouseDown:Oi(Os),execCommand:function(i){if(aa.hasOwnProperty(i))return aa[i].call(null,this)},triggerElectric:Oi(function(i){Ps(this,i)}),findPosH:function(i,m,k,Y){var Z=1;m<0&&(Z=-1,m=-m);for(var te=w(this.doc,i),ie=0;ie<m&&!(te=uo(this.doc,te,Z,k,Y),te.hitSide);++ie);return te},moveH:Oi(function(i,m){var k=this;this.extendSelectionsBy(function(Y){return k.display.shift||k.doc.extend||Y.empty()?uo(k.doc,Y.head,i,m,k.options.rtlMoveVisually):i<0?Y.from():Y.to()},Oe)}),deleteH:Oi(function(i,m){var k=this.doc.sel,Y=this.doc;k.somethingSelected()?Y.replaceSelection("",null,"+delete"):Nr(this,function(Z){var te=uo(Y,Z.head,i,m,!1);return i<0?{from:te,to:Z.head}:{from:Z.head,to:te}})}),findPosV:function(i,m,k,Y){var Z=1,te=Y;m<0&&(Z=-1,m=-m);for(var ie=w(this.doc,i),me=0;me<m;++me){var xe=$i(this,ie,"div");if(te==null?te=xe.left:xe.left=te,ie=js(this,xe,Z,k),ie.hitSide)break}return ie},moveV:Oi(function(i,m){var k=this,Y=this.doc,Z=[],te=!this.display.shift&&!Y.extend&&Y.sel.somethingSelected();if(Y.extendSelectionsBy(function(me){if(te)return i<0?me.from():me.to();var xe=$i(k,me.head,"div");me.goalColumn!=null&&(xe.left=me.goalColumn),Z.push(xe.left);var Ne=js(k,xe,i,m);return m=="page"&&me==Y.sel.primary()&&Ka(k,Ma(k,Ne,"div").top-xe.top),Ne},Oe),Z.length)for(var ie=0;ie<Y.sel.ranges.length;ie++)Y.sel.ranges[ie].goalColumn=Z[ie]}),findWordAt:function(i){var m=this.doc,k=Dt(m,i.line).text,Y=i.ch,Z=i.ch;if(k){var te=this.getHelper(i,"wordChars");(i.sticky=="before"||Z==k.length)&&Y?--Y:++Z;for(var ie=k.charAt(Y),me=Qe(ie,te)?function(xe){return Qe(xe,te)}:/\s/.test(ie)?function(xe){return/\s/.test(xe)}:function(xe){return!/\s/.test(xe)&&!Qe(xe)};Y>0&&me(k.charAt(Y-1));)--Y;for(;Z<k.length&&me(k.charAt(Z));)++Z}return new An(ct(i.line,Y),ct(i.line,Z))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):b(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Oi(function(i,m){Gr(this,i,m)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-$n(this)-this.display.barHeight,width:i.scrollWidth-$n(this)-this.display.barWidth,clientHeight:wi(this),clientWidth:vi(this)}},scrollIntoView:Oi(function(i,m){i==null?(i={from:this.doc.sel.primary().head,to:null},m==null&&(m=this.options.cursorScrollMargin)):typeof i=="number"?i={from:ct(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=m||0,i.from.line!=null?Zs(this,i):Lo(this,i.from,i.to,i.margin)}),setSize:Oi(function(i,m){var k=this,Y=function(te){return typeof te=="number"||/^\d+$/.test(String(te))?te+"px":te};i!=null&&(this.display.wrapper.style.width=Y(i)),m!=null&&(this.display.wrapper.style.height=Y(m)),this.options.lineWrapping&&go(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(te){if(te.widgets){for(var ie=0;ie<te.widgets.length;ie++)if(te.widgets[ie].noHScroll){or(k,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(i){return Ui(this,i)},startOperation:function(){return _r(this)},endOperation:function(){return br(this)},refresh:Oi(function(){var i=this.display.cachedTextHeight;Li(this),this.curOp.forceUpdate=!0,Hr(this),Gr(this,this.doc.scrollLeft,this.doc.scrollTop),Va(this.display),(i==null||Math.abs(i-Sr(this.display))>.5||this.options.lineWrapping)&&Fa(this),Re(this,"refresh",this)}),swapDoc:Oi(function(i){var m=this.doc;return m.cm=null,this.state.selectingText&&this.state.selectingText(),Go(this,i),Hr(this),this.display.input.reset(),Gr(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,gn(this,"swapDoc",this,m),m}),phrase:function(i){var m=this.options.phrases;return m&&Object.prototype.hasOwnProperty.call(m,i)?m[i]:i},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ce(e),e.registerHelper=function(i,m,k){o.hasOwnProperty(i)||(o[i]=e[i]={_global:[]}),o[i][m]=k},e.registerGlobalHelper=function(i,m,k,Y){e.registerHelper(i,m,Y),o[i]._global.push({pred:k,val:Y})}}function uo(e,t,o,i,m){var k=t,Y=o,Z=Dt(e,t.line),te=m&&e.direction=="rtl"?-o:o;function ie(){var Ut=t.line+te;return Ut<e.first||Ut>=e.first+e.size?!1:(t=new ct(Ut,t.ch,t.sticky),Z=Dt(e,Ut))}function me(Ut){var It;if(i=="codepoint"){var jt=Z.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(jt)?It=null:It=new ct(t.line,Math.max(0,Math.min(Z.text.length,t.ch+o*(jt>=55296&&jt<56320?2:1))),-o)}else m?It=Pl(e.cm,Z,t,o):It=no(Z,t,o);if(It==null)if(!Ut&&ie())t=io(m,e.cm,Z,t.line,te);else return!1;else t=It;return!0}if(i=="char"||i=="codepoint")me();else if(i=="column")me(!0);else if(i=="word"||i=="group")for(var xe=null,Ne=i=="group",De=e.cm&&e.cm.getHelper(t,"wordChars"),Ze=!0;!(o<0&&!me(!Ze));Ze=!1){var lt=Z.text.charAt(t.ch)||`
|
|
`,_t=Qe(lt,De)?"w":Ne&<==`
|
|
`?"n":!Ne||/\s/.test(lt)?null:"p";if(Ne&&!Ze&&!_t&&(_t="s"),xe&&xe!=_t){o<0&&(o=1,me(),t.sticky="after");break}if(_t&&(xe=_t),o>0&&!me(!Ze))break}var Lt=Ta(e,t,k,Y,!0);return zn(k,Lt)&&(Lt.hitSide=!0),Lt}function js(e,t,o,i){var m=e.doc,k=t.left,Y;if(i=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),te=Math.max(Z-.5*Sr(e.display),3);Y=(o>0?t.bottom:t.top)+o*te}else i=="line"&&(Y=o>0?t.bottom+3:t.top-3);for(var ie;!(ie=ka(e,k,Y),!ie.outside);){if(o<0?Y<=0:Y>=m.height){ie.hitSide=!0;break}Y+=o*5}return ie}var Dn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Dn.prototype.init=function(e){var t=this,o=this,i=o.cm,m=o.div=e.lineDiv;Ns(m,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k(Z){for(var te=Z.target;te;te=te.parentNode){if(te==m)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(te.className))break}return!1}Ce(m,"paste",function(Z){if(!k(Z)||je(i,Z)||Ms(Z,i))return;F<=11&&setTimeout(di(i,function(){return t.updateFromDOM()}),20)}),Ce(m,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),Ce(m,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),Ce(m,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(m,"touchstart",function(){return o.forceCompositionEnd()}),Ce(m,"input",function(){t.composing||t.readFromDOMSoon()});function Y(Z){if(!k(Z)||je(i,Z))return;if(i.somethingSelected())Ra({lineWise:!1,text:i.getSelections()}),Z.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var te=ks(i);Ra({lineWise:!0,text:te.text}),Z.type=="cut"&&i.operation(function(){i.setSelections(te.ranges,0,pe),i.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var ie=Zi.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",ie),Z.clipboardData.getData("Text")==ie){Z.preventDefault();return}}var me=Us(),xe=me.firstChild;i.display.lineSpace.insertBefore(me,i.display.lineSpace.firstChild),xe.value=Zi.text.join(`
|
|
`);var Ne=document.activeElement;$(xe),setTimeout(function(){i.display.lineSpace.removeChild(me),Ne.focus(),Ne==m&&o.showPrimarySelection()},50)}Ce(m,"copy",Y),Ce(m,"cut",Y)},Dn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Dn.prototype.prepareSelection=function(){var e=So(this.cm,!1);return e.focus=document.activeElement==this.div,e},Dn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Dn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Dn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,o=t.doc.sel.primary(),i=o.from(),m=o.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||m.line<t.display.viewFrom){e.removeAllRanges();return}var k=La(t,e.anchorNode,e.anchorOffset),Y=La(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&Y&&!Y.bad&&St(ki(k,Y),i)==0&&St(ui(k,Y),m)==0)return;var Z=t.display.view,te=i.line>=t.display.viewFrom&&Fs(t,i)||{node:Z[0].measure.map[2],offset:0},ie=m.line<t.display.viewTo&&Fs(t,m);if(!ie){var me=Z[Z.length-1].measure,xe=me.maps?me.maps[me.maps.length-1]:me.map;ie={node:xe[xe.length-1],offset:xe[xe.length-2]-xe[xe.length-3]}}if(!te||!ie){e.removeAllRanges();return}var Ne=e.rangeCount&&e.getRangeAt(0),De;try{De=y(te.node,te.offset,ie.offset,ie.node)}catch(Ze){}De&&(!M&&t.state.focused?(e.collapse(te.node,te.offset),De.collapsed||(e.removeAllRanges(),e.addRange(De))):(e.removeAllRanges(),e.addRange(De)),Ne&&e.anchorNode==null?e.addRange(Ne):M&&this.startGracePeriod()),this.rememberSelection()},Dn.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)},Dn.prototype.showMultipleSelections=function(e){p(this.cm.display.cursorDiv,e.cursors),p(this.cm.display.selectionDiv,e.selection)},Dn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Dn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},Dn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Dn.prototype.blur=function(){this.div.blur()},Dn.prototype.getField=function(){return this.div},Dn.prototype.supportsTouch=function(){return!0},Dn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ui(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)},Dn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Dn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(r&&g&&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 o=La(t,e.anchorNode,e.anchorOffset),i=La(t,e.focusNode,e.focusOffset);o&&i&&Ui(t,function(){xi(t.doc,lr(o,i),pe),(o.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Dn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,o=e.doc.sel.primary(),i=o.from(),m=o.to();if(i.ch==0&&i.line>e.firstLine()&&(i=ct(i.line-1,Dt(e.doc,i.line-1).length)),m.ch==Dt(e.doc,m.line).text.length&&m.line<e.lastLine()&&(m=ct(m.line+1,0)),i.line<t.viewFrom||m.line>t.viewTo-1)return!1;var k,Y,Z;i.line==t.viewFrom||(k=gr(e,i.line))==0?(Y=Qt(t.view[0].line),Z=t.view[0].node):(Y=Qt(t.view[k].line),Z=t.view[k-1].node.nextSibling);var te=gr(e,m.line),ie,me;if(te==t.view.length-1?(ie=t.viewTo-1,me=t.lineDiv.lastChild):(ie=Qt(t.view[te+1].line)-1,me=t.view[te+1].node.previousSibling),!Z)return!1;for(var xe=e.doc.splitLines(tu(e,Z,me,Y,ie)),Ne=Rn(e.doc,ct(Y,0),ct(ie,Dt(e.doc,ie).text.length));xe.length>1&&Ne.length>1;)if(Le(xe)==Le(Ne))xe.pop(),Ne.pop(),ie--;else if(xe[0]==Ne[0])xe.shift(),Ne.shift(),Y++;else break;for(var De=0,Ze=0,lt=xe[0],_t=Ne[0],Lt=Math.min(lt.length,_t.length);De<Lt&<.charCodeAt(De)==_t.charCodeAt(De);)++De;for(var Ut=Le(xe),It=Le(Ne),jt=Math.min(Ut.length-(xe.length==1?De:0),It.length-(Ne.length==1?De:0));Ze<jt&&Ut.charCodeAt(Ut.length-Ze-1)==It.charCodeAt(It.length-Ze-1);)++Ze;if(xe.length==1&&Ne.length==1&&Y==i.line)for(;De&&De>i.ch&&Ut.charCodeAt(Ut.length-Ze-1)==It.charCodeAt(It.length-Ze-1);)De--,Ze++;xe[xe.length-1]=Ut.slice(0,Ut.length-Ze).replace(/^\u200b+/,""),xe[0]=xe[0].slice(De).replace(/\u200b+$/,"");var Yt=ct(Y,De),Vt=ct(ie,Ne.length?Le(Ne).length-Ze:0);if(xe.length>1||xe[0]||St(Yt,Vt))return Mr(e.doc,xe,Yt,Vt,"+input"),!0},Dn.prototype.ensurePolled=function(){this.forceCompositionEnd()},Dn.prototype.reset=function(){this.forceCompositionEnd()},Dn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Dn.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)},Dn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ui(this.cm,function(){return Li(e.cm)})},Dn.prototype.setUneditable=function(e){e.contentEditable="false"},Dn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||di(this.cm,lo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Dn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Dn.prototype.onContextMenu=function(){},Dn.prototype.resetPosition=function(){},Dn.prototype.needsContentAttribute=!0;function Fs(e,t){var o=da(e,t.line);if(!o||o.hidden)return null;var i=Dt(e.doc,t.line),m=zi(o,i,t.line),k=Ot(i,e.doc.direction),Y="left";if(k){var Z=xt(k,t.ch);Y=Z%2?"right":"left"}var te=po(m.map,t.ch,Y);return te.offset=te.collapse=="right"?te.end:te.start,te}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function jr(e,t){return t&&(e.bad=!0),e}function tu(e,t,o,i,m){var k="",Y=!1,Z=e.doc.lineSeparator(),te=!1;function ie(De){return function(Ze){return Ze.id==De}}function me(){Y&&(k+=Z,te&&(k+=Z),Y=te=!1)}function xe(De){De&&(me(),k+=De)}function Ne(De){if(De.nodeType==1){var Ze=De.getAttribute("cm-text");if(Ze){xe(Ze);return}var lt=De.getAttribute("cm-marker"),_t;if(lt){var Lt=e.findMarks(ct(i,0),ct(m+1,0),ie(+lt));Lt.length&&(_t=Lt[0].find(0))&&xe(Rn(e.doc,_t.from,_t.to).join(Z));return}if(De.getAttribute("contenteditable")=="false")return;var Ut=/^(pre|div|p|li|table|br)$/i.test(De.nodeName);if(!/^br$/i.test(De.nodeName)&&De.textContent.length==0)return;Ut&&me();for(var It=0;It<De.childNodes.length;It++)Ne(De.childNodes[It]);/^(pre|p)$/i.test(De.nodeName)&&(te=!0),Ut&&(Y=!0)}else De.nodeType==3&&xe(De.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ne(t),t==o);)t=t.nextSibling,te=!1;return k}function La(e,t,o){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[o],!i)return jr(e.clipPos(ct(e.display.viewTo-1)),!0);t=null,o=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var m=0;m<e.display.view.length;m++){var k=e.display.view[m];if(k.node==i)return nu(k,t,o)}}function nu(e,t,o){var i=e.text.firstChild,m=!1;if(!t||!_(i,t))return jr(ct(Qt(e.line),0),!0);if(t==i&&(m=!0,t=i.childNodes[o],o=0,!t)){var k=e.rest?Le(e.rest):e.line;return jr(ct(Qt(k),k.text.length),m)}var Y=t.nodeType==3?t:null,Z=t;for(!Y&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(Y=t.firstChild,o&&(o=Y.nodeValue.length));Z.parentNode!=i;)Z=Z.parentNode;var te=e.measure,ie=te.maps;function me(_t,Lt,Ut){for(var It=-1;It<(ie?ie.length:0);It++)for(var jt=It<0?te.map:ie[It],Yt=0;Yt<jt.length;Yt+=3){var Vt=jt[Yt+2];if(Vt==_t||Vt==Lt){var un=Qt(It<0?e.line:e.rest[It]),Nn=jt[Yt]+Ut;return(Ut<0||Vt!=_t)&&(Nn=jt[Yt+(Ut?1:0)]),ct(un,Nn)}}}var xe=me(Y,Z,o);if(xe)return jr(xe,m);for(var Ne=Z.nextSibling,De=Y?Y.nodeValue.length-o:0;Ne;Ne=Ne.nextSibling){if(xe=me(Ne,Ne.firstChild,0),xe)return jr(ct(xe.line,xe.ch-De),m);De+=Ne.textContent.length}for(var Ze=Z.previousSibling,lt=o;Ze;Ze=Ze.previousSibling){if(xe=me(Ze,Ze.firstChild,-1),xe)return jr(ct(xe.line,xe.ch+lt),m);lt+=Ze.textContent.length}}var Jn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Q,this.hasSelection=!1,this.composing=null};Jn.prototype.init=function(e){var t=this,o=this,i=this.cm;this.createField(e);var m=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),l&&(m.style.width="0px"),Ce(m,"input",function(){H&&F>=9&&t.hasSelection&&(t.hasSelection=null),o.poll()}),Ce(m,"paste",function(Y){if(je(i,Y)||Ms(Y,i))return;i.state.pasteIncoming=+new Date,o.fastPoll()});function k(Y){if(je(i,Y))return;if(i.somethingSelected())Ra({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Z=ks(i);Ra({lineWise:!0,text:Z.text}),Y.type=="cut"?i.setSelections(Z.ranges,null,pe):(o.prevInput="",m.value=Z.text.join(`
|
|
`),$(m))}else return;Y.type=="cut"&&(i.state.cutIncoming=+new Date)}Ce(m,"cut",k),Ce(m,"copy",k),Ce(e.scroller,"paste",function(Y){if(vn(e,Y)||je(i,Y))return;if(!m.dispatchEvent){i.state.pasteIncoming=+new Date,o.focus();return}var Z=new Event("paste");Z.clipboardData=Y.clipboardData,m.dispatchEvent(Z)}),Ce(e.lineSpace,"selectstart",function(Y){vn(e,Y)||re(Y)}),Ce(m,"compositionstart",function(){var Y=i.getCursor("from");o.composing&&o.composing.range.clear(),o.composing={start:Y,range:i.markText(Y,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(m,"compositionend",function(){o.composing&&(o.poll(),o.composing.range.clear(),o.composing=null)})},Jn.prototype.createField=function(e){this.wrapper=Us(),this.textarea=this.wrapper.firstChild},Jn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Jn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,o=e.doc,i=So(e);if(e.options.moveInputWithCursor){var m=$i(e,o.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),Y=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,m.top+Y.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,m.left+Y.left-k.left))}return i},Jn.prototype.showSelection=function(e){var t=this.cm,o=t.display;p(o.cursorDiv,e.cursors),p(o.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Jn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var o=t.getSelection();this.textarea.value=o,t.state.focused&&$(this.textarea),H&&F>=9&&(this.hasSelection=o)}else e||(this.prevInput=this.textarea.value="",H&&F>=9&&(this.hasSelection=null))},Jn.prototype.getField=function(){return this.textarea},Jn.prototype.supportsTouch=function(){return!1},Jn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Jn.prototype.blur=function(){this.textarea.blur()},Jn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Jn.prototype.receivedFocus=function(){this.slowPoll()},Jn.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()})},Jn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function o(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,o)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,o)},Jn.prototype.poll=function(){var e=this,t=this.cm,o=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||We(o)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var m=o.value;if(m==i&&!t.somethingSelected())return!1;if(H&&F>=9&&this.hasSelection===m||n&&/[\uf700-\uf7ff]/.test(m))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=m.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var Y=0,Z=Math.min(i.length,m.length);Y<Z&&i.charCodeAt(Y)==m.charCodeAt(Y);)++Y;return Ui(t,function(){lo(t,m.slice(Y),i.length-Y,null,e.composing?"*compose":null),m.length>1e3||m.indexOf(`
|
|
`)>-1?o.value=e.prevInput="":e.prevInput=m,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Jn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Jn.prototype.onKeyPress=function(){H&&F>=9&&(this.hasSelection=null),this.fastPoll()},Jn.prototype.onContextMenu=function(e){var t=this,o=t.cm,i=o.display,m=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=mr(o,e),Y=i.scroller.scrollTop;if(!k||f)return;var Z=o.options.resetSelectionOnContextMenu;Z&&o.doc.sel.contains(k)==-1&&di(o,xi)(o.doc,lr(k),pe);var te=m.style.cssText,ie=t.wrapper.style.cssText,me=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",m.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-me.top-5)+"px; left: "+(e.clientX-me.left-5)+`px;
|
|
z-index: 1000; background: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var xe;D&&(xe=window.scrollY),i.input.focus(),D&&window.scrollTo(null,xe),i.input.reset(),o.somethingSelected()||(m.value=t.prevInput=" "),t.contextMenuPending=De,i.selForContextMenu=o.doc.sel,clearTimeout(i.detectingSelectAll);function Ne(){if(m.selectionStart!=null){var lt=o.somethingSelected(),_t="\u200B"+(lt?m.value:"");m.value="\u21DA",m.value=_t,t.prevInput=lt?"":"\u200B",m.selectionStart=1,m.selectionEnd=_t.length,i.selForContextMenu=o.doc.sel}}function De(){if(t.contextMenuPending!=De)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ie,m.style.cssText=te,H&&F<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=Y),m.selectionStart!=null){(!H||H&&F<9)&&Ne();var lt=0,_t=function(){i.selForContextMenu==o.doc.sel&&m.selectionStart==0&&m.selectionEnd>0&&t.prevInput=="\u200B"?di(o,is)(o):lt++<10?i.detectingSelectAll=setTimeout(_t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(_t,200)}}if(H&&F>=9&&Ne(),A){fe(e);var Ze=function(){ze(window,"mouseup",Ze),setTimeout(De,20)};Ce(window,"mouseup",Ze)}else setTimeout(De,50)},Jn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Jn.prototype.setUneditable=function(){},Jn.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?R(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 o=P();t.autofocus=o==e||e.getAttribute("autofocus")!=null&&o==document.body}function i(){e.value=Z.getValue()}var m;if(e.form&&(Ce(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;m=k.submit;try{var Y=k.submit=function(){i(),k.submit=m,k.submit(),k.submit=Y}}catch(te){}}t.finishInit=function(te){te.save=i,te.getTextArea=function(){return e},te.toTextArea=function(){te.toTextArea=isNaN,i(),e.parentNode.removeChild(te.getWrapperElement()),e.style.display="",e.form&&(ze(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=m))}},e.style.display="none";var Z=Wn(function(te){return e.parentNode.insertBefore(te,e.nextSibling)},t);return Z}function ru(e){e.off=ze,e.on=Ce,e.wheelEventPixels=cl,e.Doc=Ii,e.splitLines=Be,e.countColumn=G,e.findColumn=we,e.isWordChar=$e,e.Pass=_e,e.signal=Re,e.Line=_i,e.changeEnd=ur,e.scrollbarModel=Mo,e.Pos=ct,e.cmpPos=St,e.modes=Ke,e.mimeModes=Pe,e.resolveMode=Te,e.getMode=ke,e.modeExtensions=rt,e.extendMode=Ct,e.copyState=At,e.startState=yn,e.innerMode=cn,e.commands=aa,e.keyMap=rr,e.keyName=_s,e.isModifierKey=vs,e.lookupKey=kr,e.normalizeKeyMap=Ml,e.StringStream=en,e.SharedTextMarker=na,e.TextMarker=cr,e.LineWidget=ta,e.e_preventDefault=re,e.e_stopPropagation=ae,e.e_stop=fe,e.addClass=N,e.contains=_,e.rmClass=b,e.keyNames=hr}$l(Wn),ql(Wn);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ia in Ii.prototype)Ii.prototype.hasOwnProperty(Ia)&&ne(au,Ia)<0&&(Wn.prototype[Ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ii.prototype[Ia]));return ce(Ii),Wn.inputStyles={textarea:Jn,contenteditable:Dn},Wn.defineMode=function(e){!Wn.defaults.mode&&e!="null"&&(Wn.defaults.mode=e),st.apply(this,arguments)},Wn.defineMIME=dt,Wn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Wn.defineMIME("text/plain","null"),Wn.defineExtension=function(e,t){Wn.prototype[e]=t},Wn.defineDocExtension=function(e,t){Ii.prototype[e]=t},Wn.fromTextArea=iu,ru(Wn),Wn.version="5.58.2",Wn})},WaYH:function(Fe,Se,W){"use strict";var q=W("rePB"),V=W("Ff2n"),M=W("VTBJ"),z=W("1OyB"),U=W("vuIU"),L=W("JX7q"),H=W("Ji7U"),F=W("LK+K"),D=W("q1tI"),I=W("TSYQ"),g=W.n(I),f=W("sboe"),u=W("OZM5"),d=function(A){var C=A.prefixCls,b=A.level,v=A.isStart,p=A.isEnd;if(!b)return null;for(var c="".concat(C,"-indent-unit"),E=[],y=0;y<b;y+=1){var _;E.push(D.createElement("span",{key:y,className:g()(c,(_={},Object(q.a)(_,"".concat(c,"-start"),v[y+1]),Object(q.a)(_,"".concat(c,"-end"),p[y+1]),Object(q.a)(_,"".concat(c,"-end-first-level"),!y&&p[0]),_))}))}return D.createElement("span",{"aria-hidden":"true",className:"".concat(C,"-indent")},E)},s=d,l=W("815F"),r="open",a="close",n="---",h=function(x){Object(H.a)(C,x);var A=Object(F.a)(C);function C(){var b;return Object(z.a)(this,C),b=A.apply(this,arguments),b.state={dragNodeHighlight:!1},b.onSelectorClick=function(v){var p=b.props.context.onNodeClick;p(v,Object(l.b)(b.props)),b.isSelectable()?b.onSelect(v):b.onCheck(v)},b.onSelectorDoubleClick=function(v){var p=b.props.context.onNodeDoubleClick;p(v,Object(l.b)(b.props))},b.onSelect=function(v){if(b.isDisabled())return;var p=b.props.context.onNodeSelect;v.preventDefault(),p(v,Object(l.b)(b.props))},b.onCheck=function(v){if(b.isDisabled())return;var p=b.props,c=p.disableCheckbox,E=p.checked,y=b.props.context.onNodeCheck;if(!b.isCheckable()||c)return;v.preventDefault();var _=!E;y(v,Object(l.b)(b.props),_)},b.onMouseEnter=function(v){var p=b.props.context.onNodeMouseEnter;p(v,Object(l.b)(b.props))},b.onMouseLeave=function(v){var p=b.props.context.onNodeMouseLeave;p(v,Object(l.b)(b.props))},b.onContextMenu=function(v){var p=b.props.context.onNodeContextMenu;p(v,Object(l.b)(b.props))},b.onDragStart=function(v){var p=b.props.context.onNodeDragStart;v.stopPropagation(),b.setState({dragNodeHighlight:!0}),p(v,Object(L.a)(b));try{v.dataTransfer.setData("text/plain","")}catch(c){}},b.onDragEnter=function(v){var p=b.props.context.onNodeDragEnter;v.preventDefault(),v.stopPropagation(),p(v,Object(L.a)(b))},b.onDragOver=function(v){var p=b.props.context.onNodeDragOver;v.preventDefault(),v.stopPropagation(),p(v,Object(L.a)(b))},b.onDragLeave=function(v){var p=b.props.context.onNodeDragLeave;v.stopPropagation(),p(v,Object(L.a)(b))},b.onDragEnd=function(v){var p=b.props.context.onNodeDragEnd;v.stopPropagation(),b.setState({dragNodeHighlight:!1}),p(v,Object(L.a)(b))},b.onDrop=function(v){var p=b.props.context.onNodeDrop;v.preventDefault(),v.stopPropagation(),b.setState({dragNodeHighlight:!1}),p(v,Object(L.a)(b))},b.onExpand=function(v){var p=b.props.context.onNodeExpand;p(v,Object(l.b)(b.props))},b.setSelectHandle=function(v){b.selectHandle=v},b.getNodeState=function(){var v=b.props.expanded;return b.isLeaf()?null:v?r:a},b.hasChildren=function(){var v=b.props.eventKey,p=b.props.context.keyEntities,c=p[v]||{},E=c.children;return!!(E||[]).length},b.isLeaf=function(){var v=b.props,p=v.isLeaf,c=v.loaded,E=b.props.context.loadData,y=b.hasChildren();return p===!1?!1:p||!E&&!y||E&&c&&!y},b.isDisabled=function(){var v=b.props.disabled,p=b.props.context.disabled;return!!(p||v)},b.isCheckable=function(){var v=b.props.checkable,p=b.props.context.checkable;return!p||v===!1?!1:p},b.syncLoadData=function(v){var p=v.expanded,c=v.loading,E=v.loaded,y=b.props.context,_=y.loadData,P=y.onNodeLoad;if(c)return;_&&p&&!b.isLeaf()&&(!b.hasChildren()&&!E&&P(Object(l.b)(b.props)))},b.renderSwitcher=function(){var v=b.props,p=v.expanded,c=v.switcherIcon,E=b.props.context,y=E.prefixCls,_=E.switcherIcon,P=c||_;if(b.isLeaf())return D.createElement("span",{className:g()("".concat(y,"-switcher"),"".concat(y,"-switcher-noop"))},typeof P=="function"?P(Object(M.a)(Object(M.a)({},b.props),{},{isLeaf:!0})):P);var N=g()("".concat(y,"-switcher"),"".concat(y,"-switcher_").concat(p?r:a));return D.createElement("span",{onClick:b.onExpand,className:N},typeof P=="function"?P(Object(M.a)(Object(M.a)({},b.props),{},{isLeaf:!1})):P)},b.renderCheckbox=function(){var v=b.props,p=v.checked,c=v.halfChecked,E=v.disableCheckbox,y=b.props.context.prefixCls,_=b.isDisabled(),P=b.isCheckable();if(!P)return null;var N=typeof P!="boolean"?P:null;return D.createElement("span",{className:g()("".concat(y,"-checkbox"),p&&"".concat(y,"-checkbox-checked"),!p&&c&&"".concat(y,"-checkbox-indeterminate"),(_||E)&&"".concat(y,"-checkbox-disabled")),onClick:b.onCheck},N)},b.renderIcon=function(){var v=b.props.loading,p=b.props.context.prefixCls;return D.createElement("span",{className:g()("".concat(p,"-iconEle"),"".concat(p,"-icon__").concat(b.getNodeState()||"docu"),v&&"".concat(p,"-icon_loading"))})},b.renderSelector=function(){var v=b.state.dragNodeHighlight,p=b.props,c=p.title,E=p.selected,y=p.icon,_=p.loading,P=p.data,N=b.props.context,K=N.prefixCls,$=N.showIcon,B=N.icon,R=N.draggable,G=N.loadData,Q=N.titleRender,ne=b.isDisabled(),le="".concat(K,"-node-content-wrapper"),_e;if($){var pe=y||B;_e=pe?D.createElement("span",{className:g()("".concat(K,"-iconEle"),"".concat(K,"-icon__customize"))},typeof pe=="function"?pe(b.props):pe):b.renderIcon()}else G&&_&&(_e=b.renderIcon());var Ee;typeof c=="function"?Ee=c(P):Q?Ee=Q(P):Ee=c;var Oe=D.createElement("span",{className:"".concat(K,"-title")},Ee);return D.createElement("span",{ref:b.setSelectHandle,title:typeof c=="string"?c:"",className:g()("".concat(le),"".concat(le,"-").concat(b.getNodeState()||"normal"),!ne&&(E||v)&&"".concat(K,"-node-selected"),!ne&&R&&"draggable"),draggable:!ne&&R||void 0,"aria-grabbed":!ne&&R||void 0,onMouseEnter:b.onMouseEnter,onMouseLeave:b.onMouseLeave,onContextMenu:b.onContextMenu,onClick:b.onSelectorClick,onDoubleClick:b.onSelectorDoubleClick,onDragStart:R?b.onDragStart:void 0},_e,Oe)},b}return Object(U.a)(C,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var v=this.props.selectable,p=this.props.context.selectable;return typeof v=="boolean"?v:p}},{key:"render",value:function(){var v,p=this.props,c=p.eventKey,E=p.className,y=p.style,_=p.dragOver,P=p.dragOverGapTop,N=p.dragOverGapBottom,K=p.isLeaf,$=p.isStart,B=p.isEnd,R=p.expanded,G=p.selected,Q=p.checked,ne=p.halfChecked,le=p.loading,_e=p.domRef,pe=p.active,Ee=p.onMouseMove,Oe=Object(V.a)(p,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),we=this.props.context,he=we.prefixCls,oe=we.filterTreeNode,Le=we.draggable,Ye=we.keyEntities,nt=this.isDisabled(),qe=Object(u.f)(Oe),it=Ye[c]||{},He=it.level,$e=B[B.length-1];return D.createElement("div",Object.assign({ref:_e,className:g()(E,"".concat(he,"-treenode"),(v={},Object(q.a)(v,"".concat(he,"-treenode-disabled"),nt),Object(q.a)(v,"".concat(he,"-treenode-switcher-").concat(R?"open":"close"),!K),Object(q.a)(v,"".concat(he,"-treenode-checkbox-checked"),Q),Object(q.a)(v,"".concat(he,"-treenode-checkbox-indeterminate"),ne),Object(q.a)(v,"".concat(he,"-treenode-selected"),G),Object(q.a)(v,"".concat(he,"-treenode-loading"),le),Object(q.a)(v,"".concat(he,"-treenode-active"),pe),Object(q.a)(v,"".concat(he,"-treenode-leaf-last"),$e),Object(q.a)(v,"drag-over",!nt&&_),Object(q.a)(v,"drag-over-gap-top",!nt&&P),Object(q.a)(v,"drag-over-gap-bottom",!nt&&N),Object(q.a)(v,"filter-node",oe&&oe(Object(l.b)(this.props))),v)),style:y,onDragEnter:Le?this.onDragEnter:void 0,onDragOver:Le?this.onDragOver:void 0,onDragLeave:Le?this.onDragLeave:void 0,onDrop:Le?this.onDrop:void 0,onDragEnd:Le?this.onDragEnd:void 0,onMouseMove:Ee},qe),D.createElement(s,{prefixCls:he,level:He,isStart:$,isEnd:B}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),C}(D.Component),O=function(A){return D.createElement(f.a.Consumer,null,function(C){return D.createElement(h,Object.assign({},A,{context:C}))})};O.displayName="TreeNode",O.defaultProps={title:n},O.isTreeNode=1;var S=Se.a=O},XIdC:function(Fe,Se,W){"use strict";var q=W("rePB"),V=W("ODXe"),M=W("Ff2n"),z=W("q1tI"),U=W.n(z),L=W("TSYQ"),H=W.n(L),F=W("6cGi"),D=W("4IlW"),I=z.forwardRef(function(g,f){var u,d=g.prefixCls,s=d===void 0?"rc-switch":d,l=g.className,r=g.checked,a=g.defaultChecked,n=g.disabled,h=g.loadingIcon,O=g.checkedChildren,S=g.unCheckedChildren,x=g.onClick,A=g.onChange,C=g.onKeyDown,b=Object(M.a)(g,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),v=Object(F.a)(!1,{value:r,defaultValue:a}),p=Object(V.a)(v,2),c=p[0],E=p[1];function y(K,$){var B=c;return n||(B=K,E(B),A==null||A(B,$)),B}function _(K){K.which===D.a.LEFT?y(!1,K):K.which===D.a.RIGHT&&y(!0,K),C==null||C(K)}function P(K){var $=y(!c,K);x==null||x($,K)}var N=H()(s,l,(u={},Object(q.a)(u,"".concat(s,"-checked"),c),Object(q.a)(u,"".concat(s,"-disabled"),n),u));return z.createElement("button",Object.assign({},b,{type:"button",role:"switch","aria-checked":c,disabled:n,className:N,ref:f,onKeyDown:_,onClick:P}),h,z.createElement("span",{className:"".concat(s,"-inner")},c?O:S))});I.displayName="Switch",Se.a=I},Y1PL:function(Fe,Se,W){"use strict";W.r(Se),W.d(Se,"ResizableTextArea",function(){return ne});var q=W("wx14"),V=W("1OyB"),M=W("vuIU"),z=W("Ji7U"),U=W("LK+K"),L=W("q1tI"),H=W("VTBJ"),F=W("rePB"),D=W("Zm9Q"),I=W("Kwbf"),g=W("c+Xe"),f=W("m+aA"),u=W("bdgK"),d=new Map;function s(pe){pe.forEach(function(Ee){var Oe,we=Ee.target;(Oe=d.get(we))===null||Oe===void 0||Oe.forEach(function(he){return he(we)})})}var l=new u.default(s),r=null,a=null;function n(pe,Ee){d.has(pe)||(d.set(pe,new Set),l.observe(pe)),d.get(pe).add(Ee)}function h(pe,Ee){d.has(pe)&&(d.get(pe).delete(Ee),d.get(pe).size||(l.unobserve(pe),d.delete(pe)))}var O=function(pe){Object(z.a)(Oe,pe);var Ee=Object(U.a)(Oe);function Oe(){return Object(V.a)(this,Oe),Ee.apply(this,arguments)}return Object(M.a)(Oe,[{key:"render",value:function(){return this.props.children}}]),Oe}(L.Component),S=L.createContext(null);function x(pe){var Ee=pe.children,Oe=pe.onBatchResize,we=L.useRef(0),he=L.useRef([]),oe=L.useContext(S),Le=L.useCallback(function(Ye,nt,qe){we.current+=1;var it=we.current;he.current.push({size:Ye,element:nt,data:qe}),Promise.resolve().then(function(){it===we.current&&(Oe==null||Oe(he.current),he.current=[])}),oe==null||oe(Ye,nt,qe)},[Oe,oe]);return L.createElement(S.Provider,{value:Le},Ee)}function A(pe){var Ee=pe.children,Oe=pe.disabled,we=L.useRef(null),he=L.useRef(null),oe=L.useContext(S),Le=L.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ye=L.isValidElement(Ee)&&Object(g.c)(Ee),nt=Ye?Ee.ref:null,qe=L.useMemo(function(){return Object(g.a)(nt,we)},[nt,we]),it=L.useRef(pe);it.current=pe;var He=L.useCallback(function($e){var Qe=it.current,gt=Qe.onResize,et=Qe.data,tt=$e.getBoundingClientRect(),Je=tt.width,vt=tt.height,wt=$e.offsetWidth,Et=$e.offsetHeight,xt=Math.floor(Je),kt=Math.floor(vt);if(Le.current.width!==xt||Le.current.height!==kt||Le.current.offsetWidth!==wt||Le.current.offsetHeight!==Et){var Ot={width:xt,height:kt,offsetWidth:wt,offsetHeight:Et};Le.current=Ot;var Ae=wt===Math.round(Je)?Je:wt,Ce=Et===Math.round(vt)?vt:Et,Ge=Object(H.a)(Object(H.a)({},Ot),{},{offsetWidth:Ae,offsetHeight:Ce});oe==null||oe(Ge,$e,et),gt&&Promise.resolve().then(function(){gt(Ge,$e)})}},[]);return L.useEffect(function(){var $e=Object(f.a)(we.current)||Object(f.a)(he.current);return $e&&!Oe&&n($e,He),function(){return h($e,He)}},[we.current,Oe]),L.createElement(O,{ref:he},Ye?L.cloneElement(Ee,{ref:qe}):Ee)}var C="rc-observer-key";function b(pe){var Ee=pe.children,Oe=Object(D.a)(Ee);return Oe.map(function(we,he){var oe=(we==null?void 0:we.key)||"".concat(C,"-").concat(he);return L.createElement(A,Object(q.a)({},pe,{key:oe}),we)})}b.Collection=x;var v=b,p=W("bT9E"),c=W("TSYQ"),E=W.n(c),y=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,_=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],P={},N;function K(pe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(Ee&&P[Oe])return P[Oe];var we=window.getComputedStyle(pe),he=we.getPropertyValue("box-sizing")||we.getPropertyValue("-moz-box-sizing")||we.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(we.getPropertyValue("padding-bottom"))+parseFloat(we.getPropertyValue("padding-top")),Le=parseFloat(we.getPropertyValue("border-bottom-width"))+parseFloat(we.getPropertyValue("border-top-width")),Ye=_.map(function(qe){return"".concat(qe,":").concat(we.getPropertyValue(qe))}).join(";"),nt={sizingStyle:Ye,paddingSize:oe,borderSize:Le,boxSizing:he};return Ee&&Oe&&(P[Oe]=nt),nt}function $(pe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,we=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)),pe.getAttribute("wrap")?N.setAttribute("wrap",pe.getAttribute("wrap")):N.removeAttribute("wrap");var he=K(pe,Ee),oe=he.paddingSize,Le=he.borderSize,Ye=he.boxSizing,nt=he.sizingStyle;N.setAttribute("style","".concat(nt,";").concat(y)),N.value=pe.value||pe.placeholder||"";var qe=Number.MIN_SAFE_INTEGER,it=Number.MAX_SAFE_INTEGER,He=N.scrollHeight,$e;if(Ye==="border-box"?He+=Le:Ye==="content-box"&&(He-=oe),Oe!==null||we!==null){N.value=" ";var Qe=N.scrollHeight-oe;Oe!==null&&(qe=Qe*Oe,Ye==="border-box"&&(qe=qe+oe+Le),He=Math.max(qe,He)),we!==null&&(it=Qe*we,Ye==="border-box"&&(it=it+oe+Le),$e=He>it?"":"hidden",He=Math.min(it,He))}return{height:He,minHeight:qe,maxHeight:it,overflowY:$e,resize:"none"}}var B=W("Gytx"),R=W.n(B),G;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(G||(G={}));var Q=function(pe){Object(z.a)(Oe,pe);var Ee=Object(U.a)(Oe);function Oe(we){var he;return Object(V.a)(this,Oe),he=Ee.call(this,we),he.nextFrameActionId=void 0,he.resizeFrameId=void 0,he.textArea=void 0,he.saveTextArea=function(oe){he.textArea=oe},he.handleResize=function(oe){var Le=he.state.resizeStatus,Ye=he.props,nt=Ye.autoSize,qe=Ye.onResize;if(Le!==G.NONE)return;typeof qe=="function"&&qe(oe),nt&&he.resizeOnNextFrame()},he.resizeOnNextFrame=function(){cancelAnimationFrame(he.nextFrameActionId),he.nextFrameActionId=requestAnimationFrame(he.resizeTextarea)},he.resizeTextarea=function(){var oe=he.props.autoSize;if(!oe||!he.textArea)return;var Le=oe.minRows,Ye=oe.maxRows,nt=$(he.textArea,!1,Le,Ye);he.setState({textareaStyles:nt,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(he.resizeFrameId),he.resizeFrameId=requestAnimationFrame(function(){he.setState({resizeStatus:G.RESIZED},function(){he.resizeFrameId=requestAnimationFrame(function(){he.setState({resizeStatus:G.NONE}),he.fixFirefoxAutoScroll()})})})})},he.renderTextArea=function(){var oe=he.props,Le=oe.prefixCls,Ye=Le===void 0?"rc-textarea":Le,nt=oe.autoSize,qe=oe.onResize,it=oe.className,He=oe.disabled,$e=he.state,Qe=$e.textareaStyles,gt=$e.resizeStatus,et=Object(p.a)(he.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),tt=E()(Ye,it,Object(F.a)({},"".concat(Ye,"-disabled"),He));"value"in et&&(et.value=et.value||"");var Je=Object(H.a)(Object(H.a)(Object(H.a)({},he.props.style),Qe),gt===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return L.createElement(v,{onResize:he.handleResize,disabled:!(nt||qe)},L.createElement("textarea",Object(q.a)({},et,{className:tt,style:Je,ref:he.saveTextArea})))},he.state={textareaStyles:{},resizeStatus:G.NONE},he}return Object(M.a)(Oe,[{key:"componentDidUpdate",value:function(he){(he.value!==this.props.value||!R()(he.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 he=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(he,oe)}}catch(Le){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Oe}(L.Component),ne=Q,le=function(pe){Object(z.a)(Oe,pe);var Ee=Object(U.a)(Oe);function Oe(we){var he;Object(V.a)(this,Oe),he=Ee.call(this,we),he.resizableTextArea=void 0,he.focus=function(){he.resizableTextArea.textArea.focus()},he.saveTextArea=function(Le){he.resizableTextArea=Le},he.handleChange=function(Le){var Ye=he.props.onChange;he.setValue(Le.target.value,function(){he.resizableTextArea.resizeTextarea()}),Ye&&Ye(Le)},he.handleKeyDown=function(Le){var Ye=he.props,nt=Ye.onPressEnter,qe=Ye.onKeyDown;Le.keyCode===13&&nt&&nt(Le),qe&&qe(Le)};var oe=typeof we.value=="undefined"||we.value===null?we.defaultValue:we.value;return he.state={value:oe},he}return Object(M.a)(Oe,[{key:"setValue",value:function(he,oe){"value"in this.props||this.setState({value:he},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return L.createElement(ne,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(he){return"value"in he?{value:he.value}:null}}]),Oe}(L.Component),_e=Se.default=le},ZD9Y:function(Fe,Se,W){"use strict";var q=W("BoS7"),V=W("Sdc0"),M=W("OaEy"),z=W("2fM7"),U=W("q1tI"),L=W.n(U),H=W("lOMy"),F=W.n(H),D=z.a.Option;Se.a=function(I){var g=I.onFontSizeChange,f=I.cmFontSize,u=I.cmCodeMode,d=I.onCodeModeChange,s=I.onTabToSpace,l=I.className,r=l===void 0?"":l,a=I.tabToSpace,n=I.children;return L.a.createElement("div",{className:"tpi-code-setting ".concat(r)},L.a.createElement("h3",null,"\u4EE3\u7801\u683C\u5F0F"),L.a.createElement("section",null,L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u663E\u793A\u6A21\u5F0F"),L.a.createElement(z.a,{bordered:!1,size:"small",value:u,onChange:d},L.a.createElement(D,{value:"vs"},"\u767D\u8272\u80CC\u666F"),L.a.createElement(D,{value:"vs-dark"},"\u9ED1\u8272\u80CC\u666F"))),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u5B57\u4F53\u5927\u5C0F"),L.a.createElement(z.a,{bordered:!1,size:"small",value:f,onChange:g},L.a.createElement(D,{value:12},"12px"),L.a.createElement(D,{value:14},"14px"),L.a.createElement(D,{value:16},"16px"),L.a.createElement(D,{value:18},"18px"),L.a.createElement(D,{value:20},"20px"),L.a.createElement(D,{value:22},"22px"))),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"Tab\u8F6C\u6362"),L.a.createElement(V.a,{checked:a,onChange:s}))),L.a.createElement("h3",null,"\u5FEB\u6377\u952E"),L.a.createElement("section",null,L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u4FDD\u5B58\u4EE3\u7801"),L.a.createElement("span",null,"Ctrl + S")),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"),L.a.createElement("span",null,"F1 / Alt + F1")),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u5DE6\u53F3\u7F29\u8FDB"),L.a.createElement("span",null,"Ctrl + ]/[")),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"),L.a.createElement("span",null,"Ctrl + Shift + \\")),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u8F6C\u5230\u884C\u9996"),L.a.createElement("span",null,"Home")),L.a.createElement("div",{className:"file-item"},L.a.createElement("b",null,"\u8F6C\u5230\u884C\u5C3E"),L.a.createElement("span",null,"End"))),n)}},ZW9T:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return $});var q=W("k1fw"),V=W("miYZ"),M=W("tsqr"),z=W("rAM+"),U=W("tJVT"),L=W("PpiC"),H=W("q1tI"),F=W.n(H),D=W("bdgK"),I=W("oBTY"),g=W("9og8"),f=W("WmNS"),u=W.n(f),d={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},s={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},l={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},r={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},a=W("5VLF"),n=W.n(a),h={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},O=function(R,G){return G.map(function(Q){return{label:Q,kind:R.languages.CompletionItemKind.Keyword,insertText:Q}})},S=function(R){return Object.keys(h.tables).map(function(G){return{label:G,kind:R.languages.CompletionItemKind.Variable,insertText:G}})},x=function(R,G){var Q=h.tables[R];return Q?Q.map(function(ne){return{label:ne,kind:G.languages.CompletionItemKind.Field,insertText:ne}}):[]};function A(B,R,G,Q,ne){var le=R.getWordUntilPosition(G),_e={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:le.startColumn,endColumn:le.endColumn},pe=Q.map(function(Ee){return{label:Ee,kind:B.languages.CompletionItemKind.Keyword,insertText:Ee,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:_e}});return ne.map(function(Ee){pe.push(Object(q.a)(Object(q.a)({},Ee),{},{range:_e}))}),pe}var C=function(B){h.languages.map(function(ne){return B.languages.registerDocumentFormattingEditProvider(ne,{provideDocumentFormattingEdits:function(_e,pe,Ee){return Object(g.a)(u.a.mark(function Oe(){var we;return u.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return we=n()(_e.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),oe.abrupt("return",[{range:_e.getFullModelRange(),text:we}]);case 2:case"end":return oe.stop()}},Oe)}))()}}),ne});var R=l.quickKey.map(function(ne){return{label:ne.label,kind:B.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=r.quickKey.map(function(ne){return{label:ne.label,kind:B.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Q=s.quickKey.map(function(ne){return{label:ne.label,kind:B.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}});B.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(I.a)(l.keywords),Object(I.a)(l.quickKey.map(function(ne){return ne.label}))),provideCompletionItems:function(le,_e){var pe=le.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),Ee=pe.match(/cu/gim);console.log("match:",Ee,_e,pe,le);var Oe=[],we=_e.lineNumber,he=_e.column,oe=le.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:he}),Le=oe.trim().split(/\s+/),Ye=Le[Le.length-1];if(Ye.endsWith(".")){var nt=Ye.slice(0,Ye.length-1);Object.keys(h.tables).includes(nt)&&(Oe=Object(I.a)(x(nt,B)))}else Ye==="."?Oe=[]:Oe=[].concat(Object(I.a)(S(B)),Object(I.a)(O(B,l.keywords)),Object(I.a)(R));return{suggestions:Oe}}}),B.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(I.a)(d.keywords)),provideCompletionItems:function(le,_e){var pe=le.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),Ee=pe.match(/cu/gim);console.log("match:",Ee,_e,pe,le);var Oe=[],we=_e.lineNumber,he=_e.column,oe=le.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:he}),Le=oe.trim().split(/\s+/),Ye=Le[Le.length-1];if(Ye.endsWith(".")){var nt=Ye.slice(0,Ye.length-1);Object.keys(h.tables).includes(nt)&&(Oe=Object(I.a)(x(nt,B)))}else Ye==="."?Oe=[]:Oe=[].concat(Object(I.a)(S(B)),Object(I.a)(O(B,d.keywords)));return{suggestions:Oe}}}),B.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(I.a)(s.keywords)),provideCompletionItems:function(le,_e){var pe=[],Ee=_e.lineNumber,Oe=_e.column,we=le.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:Oe}),he=we.trim().split(/\s+/),oe=he[he.length-1];if(oe.endsWith(".")){var Le=oe.slice(0,oe.length-1);Object.keys(h.tables).includes(Le)&&(pe=Object(I.a)(x(Le,B)))}else oe==="."?pe=[]:pe=[].concat(Object(I.a)(S(B)),Object(I.a)(O(B,s.keywords)),Object(I.a)(Q));return{suggestions:pe}}}),B.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(I.a)(r.keywords)),provideCompletionItems:function(le,_e){var pe=[],Ee=_e.lineNumber,Oe=_e.column,we=le.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:Oe}),he=we.trim().split(/\s+/),oe=he[he.length-1];if(oe.endsWith(".")){var Le=oe.slice(0,oe.length-1);Object.keys(h.tables).includes(Le)&&(pe=Object(I.a)(x(Le,B)))}else oe==="."?pe=[]:pe=[].concat(Object(I.a)(S(B)),Object(I.a)(O(B,r.keywords)),Object(I.a)(G));return{suggestions:pe}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",v=W("LvDl"),p=W("+ua5");function c(B){return/^\d+$/.test(B)?"".concat(B,"px"):B}function E(){}var y=!1,_={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function P(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],R=B;if(Array.isArray(B)){for(var G=0;G<B.length;G++){var Q=_[B[G]];if(Q)return Q}return R[0]}return _[R]||R}var N=null,K=Se.b=function(B){var R=B.width,G=R===void 0?"100%":R,Q=B.height,ne=Q===void 0?"100%":Q,le=B.value,_e=B.language,pe=_e===void 0?"javascript":_e,Ee=B.style,Oe=Ee===void 0?{}:Ee,we=B.options,he=we===void 0?{}:we,oe=B.overrideServices,Le=oe===void 0?{}:oe,Ye=B.theme,nt=Ye===void 0?"vs-dark":Ye,qe=B.onEditBlur,it=B.onSave,He=B.autoHeight,$e=He===void 0?!1:He,Qe=B.forbidCopy,gt=Qe===void 0?!1:Qe,et=B.onChange,tt=et===void 0?E:et,Je=B.editorDidMount,vt=Je===void 0?E:Je,wt=B.onFocus,Et=wt===void 0?E:wt,xt=B.filename,kt=xt===void 0?"educoder.txt":xt,Ot=B.errorLine,Ae=B.errorContent,Ce=Ae===void 0?"":Ae,Ge=Object(L.a)(B,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),ze=Object(H.useRef)(),Re=Object(H.useRef)({}),je=Object(H.useRef)(),ge=Object(H.useRef)(!1),de=Object(H.useRef)(),ce=Object(H.useState)(!1),re=Object(U.a)(ce,2),ae=re[0],ue=re[1];function fe(){var Te;return ze.current&&(Te=new D.default(function(ke){var rt=Object(z.a)(ke),Ct;try{for(rt.s();!(Ct=rt.n()).done;){var At=Ct.value;(At.target.offsetHeight>0||At.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(cn){rt.e(cn)}finally{rt.f()}}),Te.observe(ze.current)),Te}function be(){M.b.warn(decodeURIComponent(b))}var Ie=function(){var ke=Re.current.instance;if(le!=null&&ke&&ae){var rt=ke.getModel();rt&&le!==rt.getValue()&&(y=!0,rt.setValue(le),ke.layout(),y=!1)}};Object(H.useEffect)(function(){je.current&&clearTimeout(je.current),je.current=setTimeout(function(){Ie()},500)},[le,ae,Re.current]),Object(H.useEffect)(function(){if(Ot&&Re.current&&Re.current.instance){var Te=Re.current.instance;Te.changeViewZones(function(rt){var Ct=document.createElement("div");Ct.style.padding="10px 20px",Ct.style.width="calc(100% - 20px)",Ct.className="my-error-line-wrp",Ct.innerHTML=Ce,rt.addZone({afterLineNumber:Ot||11,heightInLines:3,domNode:Ct})});var ke={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Te.addOverlayWidget(ke),Te.revealPositionInCenter({lineNumber:20,column:1})}},[Ot,Re.current,ae]);function Xe(){var Te=Re.current.instance;if(Te){var ke=Te.getSelection(),rt=Re.current.pastePos||{},Ct=new N.Range(rt.startLineNumber||ke.endLineNumber,rt.startColumn||ke.endColumn,rt.endLineNumber||ke.endLineNumber,rt.endColumn||ke.endColumn);setTimeout(function(){Te.executeEdits("",[{range:Ct,text:""}])},300)}}function ut(Te){(window.navigator.platform.match("Mac")?Te.metaKey:Te.ctrlKey)&&Te.keyCode==83&&(Te.preventDefault(),it())}var bt=function(){if($e&&Re.current.instance){var ke=Re.current.instance.getContentHeight();st(ke<ne?ne:ke)}else st(ne)};function ft(Te){var ke=document.createEvent("MouseEvents");ke.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Te.dispatchEvent(ke)}function at(Te,ke){var rt=window.URL||window.webkitURL||window,Ct=new Blob([ke]),At=document.createElementNS("http://www.w3.org/1999/xhtml","a");At.href=rt.createObjectURL(Ct),At.download=Te,ft(At)}Object(H.useEffect)(function(){bt()},[bt]),Object(H.useEffect)(function(){ze.current&&!ae&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function(Te){try{N=Te,Re.current.instance=N.editor.create(ze.current,{value:le,language:P(pe),theme:nt,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Le);var ke=Re.current.instance;if(vt(ke,N),setTimeout(function(){bt(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){at(kt||"educoder.txt",ke.getValue())}})},500),Re.current.subscription=ke.onDidChangeModelContent(function(Ct){ge.current?clearTimeout(de.current):(bt(),tt(ke.getValue(),Ct)),de.current=setTimeout(function(){ge.current=!1},500)}),window.Monaco||C(N),gt&&(ke.addCommand(N.KeyMod.CtrlCmd|N.KeyMod.Shift|N.KeyCode.KEY_V,function(){return be(),null}),ke.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_C,function(){return be(),null})),window.Monaco=N,qe&&ke.onDidBlurEditorWidget(function(){qe(ke.getValue())}),Et&&ke.onDidFocusEditorText(function(){Et(ke.getValue())}),gt){ke.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_V,function(){return be(),null}),ke.onDidPaste(function(Ct){Re.current.pastePos=Ct});try{window.addEventListener("paste",Xe)}catch(Ct){}}var rt=fe();return ue(!0),function(){var Ct=Re.current.instance;Ct.dispose();var At=Ct.getModel();At&&At.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),gt&&window.removeEventListener("paste",Xe),rt.unobserve(ze.current)}}catch(Ct){}})},[]),Object(H.useEffect)(function(){var Te=Re.current.instance;if(Te&&ae)return document.addEventListener("keydown",ut,!1),function(){document.removeEventListener("keydown",ut)}},[it,ae]),Object(H.useEffect)(function(){var Te=Re.current.instance;if(Te&&ae){var ke=P(pe);N.editor.setModelLanguage(Te.getModel(),ke),console.log("language:",pe,Te.getModel(),ke)}},[pe,ae]),Object(H.useEffect)(function(){var Te=Re.current.instance;Te&&ae&&N.editor.setTheme(nt)},[nt,ae]),Object(H.useEffect)(function(){var Te=Re.current.instance;Te&&ae&&(Te.updateOptions(Object(q.a)({},he)),setTimeout(function(){Te.getModel().updateOptions(Object(q.a)({},he))},200))},[JSON.stringify(he),ae]),Object(H.useEffect)(function(){var Te=Re.current.instance;Te&&ae&&Te.layout()},[G,ne,ae]);var Be=Object(H.useState)(c(G)),We=Object(U.a)(Be,2),Me=We[0],se=We[1],ve=Object(H.useState)(c(ne)),Ke=Object(U.a)(ve,2),Pe=Ke[0],st=Ke[1],dt=Object(q.a)(Object(q.a)({},Oe),{},{width:Me,height:Pe});return F.a.createElement("div",{className:"my-monaco-editor",ref:ze,style:dt})};function $(B){var R=B.width,G=R===void 0?"100%":R,Q=B.height,ne=Q===void 0?"100%":Q,le=B.original,_e=B.modified,pe=B.language,Ee=B.options,Oe=Ee===void 0?{}:Ee,we=Object(H.useRef)(),he=Object(H.useState)(null),oe=Object(U.a)(he,2),Le=oe[0],Ye=oe[1];function nt($e){var Qe;return we.current&&(Qe=new D.default(function(gt){var et=Object(z.a)(gt),tt;try{for(et.s();!(tt=et.n()).done;){var Je=tt.value;(Je.target.offsetHeight>0||Je.target.offsetWidth>0)&&$e.layout()}}catch(vt){et.e(vt)}finally{et.f()}}),Qe.observe(we.current)),Qe}Object(H.useEffect)(function(){we.current&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function($e){N=$e;var Qe=N.editor.createDiffEditor(we.current,Object(q.a)(Object(q.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Oe),{},{wordWrap:!0}));Ye(Qe);var gt=nt(Qe);return function(){Qe.dispose();var et=Qe.getModel();et&&et.dispose(),gt.unobserve(we.current)}})},[]),Object(H.useEffect)(function(){Le&&Le.setModel({original:N.editor.createModel(le,pe),modified:N.editor.createModel(_e,pe)})},[le,_e,pe,Le]);var qe=c(G),it=c(ne),He={width:qe,height:it};return F.a.createElement("div",{className:"my-diff-editor",ref:we,style:He})}},ZpRC:function(Fe,Se,W){"use strict";function q(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function V(g,f){return(!f||g!=="hidden")&&g!=="visible"&&g!=="clip"}function M(g,f){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var u=getComputedStyle(g,null);return V(u.overflowY,f)||V(u.overflowX,f)||function(d){var s=function(l){if(!l.ownerDocument||!l.ownerDocument.defaultView)return null;try{return l.ownerDocument.defaultView.frameElement}catch(r){return null}}(d);return!!s&&(s.clientHeight<d.scrollHeight||s.clientWidth<d.scrollWidth)}(g)}return!1}function z(g,f,u,d,s,l,r,a){return l<g&&r>f||l>g&&r<f?0:l<=g&&a<=u||r>=f&&a>=u?l-g-d:r>f&&a<u||l<g&&a>u?r-f+s:0}var U=function(g,f){var u=window,d=f.scrollMode,s=f.block,l=f.inline,r=f.boundary,a=f.skipOverflowHiddenElements,n=typeof r=="function"?r:function(Qe){return Qe!==r};if(!q(g))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,O=[],S=g;q(S)&&n(S);){if((S=S.parentElement)===h){O.push(S);break}S!=null&&S===document.body&&M(S)&&!M(document.documentElement)||S!=null&&M(S,a)&&O.push(S)}for(var x=u.visualViewport?u.visualViewport.width:innerWidth,A=u.visualViewport?u.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,v=g.getBoundingClientRect(),p=v.height,c=v.width,E=v.top,y=v.right,_=v.bottom,P=v.left,N=s==="start"||s==="nearest"?E:s==="end"?_:E+p/2,K=l==="center"?P+c/2:l==="end"?y:P,$=[],B=0;B<O.length;B++){var R=O[B],G=R.getBoundingClientRect(),Q=G.height,ne=G.width,le=G.top,_e=G.right,pe=G.bottom,Ee=G.left;if(d==="if-needed"&&E>=0&&P>=0&&_<=A&&y<=x&&E>=le&&_<=pe&&P>=Ee&&y<=_e)return $;var Oe=getComputedStyle(R),we=parseInt(Oe.borderLeftWidth,10),he=parseInt(Oe.borderTopWidth,10),oe=parseInt(Oe.borderRightWidth,10),Le=parseInt(Oe.borderBottomWidth,10),Ye=0,nt=0,qe="offsetWidth"in R?R.offsetWidth-R.clientWidth-we-oe:0,it="offsetHeight"in R?R.offsetHeight-R.clientHeight-he-Le:0;if(h===R)Ye=s==="start"?N:s==="end"?N-A:s==="nearest"?z(b,b+A,A,he,Le,b+N,b+N+p,p):N-A/2,nt=l==="start"?K:l==="center"?K-x/2:l==="end"?K-x:z(C,C+x,x,we,oe,C+K,C+K+c,c),Ye=Math.max(0,Ye+b),nt=Math.max(0,nt+C);else{Ye=s==="start"?N-le-he:s==="end"?N-pe+Le+it:s==="nearest"?z(le,pe,Q,he,Le+it,N,N+p,p):N-(le+Q/2)+it/2,nt=l==="start"?K-Ee-we:l==="center"?K-(Ee+ne/2)+qe/2:l==="end"?K-_e+oe+qe:z(Ee,_e,ne,we,oe+qe,K,K+c,c);var He=R.scrollLeft,$e=R.scrollTop;N+=$e-(Ye=Math.max(0,Math.min($e+Ye,R.scrollHeight-Q+it))),K+=He-(nt=Math.max(0,Math.min(He+nt,R.scrollWidth-ne+qe)))}$.push({el:R,top:Ye,left:nt})}return $};function L(g){return g===Object(g)&&Object.keys(g).length!==0}function H(g,f){f===void 0&&(f="auto");var u="scrollBehavior"in document.body.style;g.forEach(function(d){var s=d.el,l=d.top,r=d.left;s.scroll&&u?s.scroll({top:l,left:r,behavior:f}):(s.scrollTop=l,s.scrollLeft=r)})}function F(g){return g===!1?{block:"end",inline:"nearest"}:L(g)?g:{block:"start",inline:"nearest"}}function D(g,f){var u=!g.ownerDocument.documentElement.contains(g);if(L(f)&&typeof f.behavior=="function")return f.behavior(u?[]:U(g,f));if(u)return;var d=F(f);return H(U(g,d),d.behavior)}var I=Se.a=D},a4uL:function(Fe,Se,W){},bCnd:function(Fe,Se,W){"use strict";W.d(Se,"b",function(){return z}),W.d(Se,"a",function(){return U});var q=W("je13"),V=W.n(q),M=!1;function z(L,H){var F=V.a.get("__ec");F||(F={}),F[L]=H,V.a.set("__ec",F)}function U(L,H){var F=V.a.get("__ec");return F?F[L]===void 0?H:F[L]:H}},bT9E:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return V});var q=W("VTBJ");function V(M,z){var U=Object(q.a)({},M);return Array.isArray(z)&&z.forEach(function(L){delete U[L]}),U}},biw7:function(Fe,Se,W){"use strict";var q=W("q1tI"),V=W.n(q),M=q.createContext(null);Se.a=M},c5Ni:function(Fe,Se,W){},cDPC:function(Fe,Se,W){"use strict";var q=W("tJVT"),V=W("q1tI"),M=W.n(V),z=W("i3hx"),U=W.n(z);Se.a=function(L){var H=L.defaultX,F=H===void 0?"40%":H,D=L.leftChild,I=L.rightChild,g=L.className,f=L.hideResize,u=f===void 0?!1:f,d=Object(V.useState)(F),s=Object(q.a)(d,2),l=s[0],r=s[1],a=Object(V.useRef)();function n(){a.current=!0}Object(V.useEffect)(function(){function S(A){a.current&&r(A.pageX)}function x(){a.current=!1}return window.addEventListener("mousemove",S),window.addEventListener("mouseup",x),function(){window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",x)}},[]);var h=typeof l=="number"&&l!==.01?"".concat(l,"px"):F,O="calc(100% - ".concat(u?"0px":"4px"," - ").concat(h,")");return M.a.createElement("div",{className:"split-panel-container ".concat(g)},M.a.createElement("section",{style:{width:h,display:l===.01?"none":""}},D),M.a.createElement("section",{className:"resize-x-bar",onMouseDown:n},M.a.createElement("a",{className:"btn-resize"},M.a.createElement("svg",{width:"16",height:"13",viewBox:"0 0 16 13"},M.a.createElement("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})))),M.a.createElement("section",{style:{width:O}},I))}},dejd:function(Fe,Se,W){},dmUQ:function(Fe,Se,W){"use strict";var q=W("Ff2n"),V=W("rePB"),M=W("1OyB"),z=W("vuIU"),U=W("Ji7U"),L=W("md7G"),H=W("foSv"),F=W("q1tI"),D=W.n(F),I=W("TSYQ"),g=W.n(I),f=W("4IlW");function u(p,c){var E=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);c&&(y=y.filter(function(_){return Object.getOwnPropertyDescriptor(p,_).enumerable})),E.push.apply(E,y)}return E}function d(p){for(var c=1;c<arguments.length;c++){var E=arguments[c]!=null?arguments[c]:{};c%2?u(Object(E),!0).forEach(function(y){Object(V.a)(p,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(E)):u(Object(E)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(E,y))})}return p}function s(p){var c=l();return function(){var y=Object(H.a)(p),_;if(c){var P=Object(H.a)(this).constructor;_=Reflect.construct(y,arguments,P)}else _=y.apply(this,arguments);return Object(L.a)(this,_)}}function l(){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(p){return!1}}function r(){}function a(p){p.preventDefault()}var n=function(c){return c.replace(/[^\w.-]+/g,"")},h=200,O=600,S=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(c){return c!=null},A=function(c,E){return E===c||typeof E=="number"&&typeof c=="number"&&isNaN(E)&&isNaN(c)},C=function(p){Object(U.a)(E,p);var c=s(E);function E(y){var _;Object(M.a)(this,E),_=c.call(this,y),_.onKeyDown=function(K){var $=_.props,B=$.onKeyDown,R=$.onPressEnter;if(K.keyCode===f.a.UP){var G=_.getRatio(K);_.up(K,G,null),_.stop()}else if(K.keyCode===f.a.DOWN){var Q=_.getRatio(K);_.down(K,Q,null),_.stop()}else K.keyCode===f.a.ENTER&&R&&R(K);if(_.recordCursorPosition(),_.lastKeyCode=K.keyCode,B){for(var ne=arguments.length,le=new Array(ne>1?ne-1:0),_e=1;_e<ne;_e++)le[_e-1]=arguments[_e];B.apply(void 0,[K].concat(le))}},_.onKeyUp=function(K){var $=_.props.onKeyUp;if(_.stop(),_.recordCursorPosition(),$){for(var B=arguments.length,R=new Array(B>1?B-1:0),G=1;G<B;G++)R[G-1]=arguments[G];$.apply(void 0,[K].concat(R))}},_.onChange=function(K){var $=_.props.onChange;_.state.focused&&(_.inputting=!0),_.rawInput=_.props.parser(_.getValueFromEvent(K)),_.setState({inputValue:_.rawInput}),$(_.toNumber(_.rawInput))},_.onMouseUp=function(){var K=_.props.onMouseUp;_.recordCursorPosition(),K&&K.apply(void 0,arguments)},_.onFocus=function(){var K;_.setState({focused:!0}),(K=_.props).onFocus.apply(K,arguments)},_.onBlur=function(){var K=_.props.onBlur;_.inputting=!1,_.setState({focused:!1});var $=_.getCurrentValidValue(_.state.inputValue),B=_.setValue($,r);if(K){var R=_.input.value,G=_.getInputDisplayValue({focus:!1,value:B});_.input.value=G&&Number(G),K.apply(void 0,arguments),_.input.value=R}},_.getRatio=function(K){var $=1;return K.metaKey||K.ctrlKey?$=.1:K.shiftKey&&($=10),$},_.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},_.getPrecision=function(K){if(x(_.props.precision))return _.props.precision;var $=String(K);if($.indexOf("e-")>=0)return parseInt($.slice($.indexOf("e-")+2),10);var B=0;return $.indexOf(".")>=0&&(B=$.length-$.indexOf(".")-1),B},_.getInputDisplayValue=function(K){var $=K||_.state,B=$.focused,R=$.inputValue,G=$.value,Q;B?Q=R:Q=_.toPrecisionAsStep(G),Q==null&&(Q="");var ne=_.formatWrapper(Q);return x(_.props.decimalSeparator)&&(ne=ne.toString().replace(".",_.props.decimalSeparator)),ne},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(K){}},_.restoreByAfter=function(K){if(K===void 0)return!1;var $=_.input.value,B=$.lastIndexOf(K);if(B===-1)return!1;var R=_.cursorBefore.length;return _.lastKeyCode===f.a.DELETE&&_.cursorBefore.charAt(R-1)===K[0]?(_.fixCaret(R,R),!0):B+K.length===$.length?(_.fixCaret(B,B),!0):!1},_.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function($,B){var R=K.substring(B);return _.restoreByAfter(R)})},_.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(K,$,B){_.pressingUpOrDown=!0,_.step("down",K,$,B)},_.up=function(K,$,B){_.pressingUpOrDown=!0,_.step("up",K,$,B)},_.saveInput=function(K){_.input=K};var P=y.value;P===void 0&&(P=y.defaultValue),_.state={focused:y.autoFocus};var N=_.getValidValue(_.toNumber(P));return _.state=d(d({},_.state),{},{inputValue:_.toPrecisionAsStep(N),value:N}),_}return Object(z.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var P=this.props,N=P.value,K=P.onChange,$=P.max,B=P.min,R=this.state.focused;if(_){if(!A(_.value,N)||!A(_.max,$)||!A(_.min,B)){var G=R?N:this.getValidValue(N),Q;this.pressingUpOrDown?Q=G:this.inputting?Q=this.rawInput:Q=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Q})}var ne="value"in this.props?N:this.state.value;"max"in this.props&&_.max!==$&&typeof ne=="number"&&ne>$&&K&&K($),"min"in this.props&&_.min!==B&&typeof ne=="number"&&ne<B&&K&&K(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var le=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===f.a.BACKSPACE?le=this.cursorStart-1:this.lastKeyCode===f.a.DELETE&&(le=this.cursorStart):le=this.input.value.length,this.fixCaret(le,le)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case f.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case f.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}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(_){var P=_;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(_){var P=_.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(_){var P=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,K=parseFloat(_);return isNaN(K)?_:(K<P&&(K=P),K>N&&(K=N),K)}},{key:"setValue",value:function(_,P){var N=this.props.precision,K=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),$=this.state.value,B=$===void 0?null:$,R=this.state.inputValue,G=R===void 0?null:R,Q=typeof K=="number"?K.toFixed(N):"".concat(K),ne=K!==B||Q!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},P)):this.setState({value:K,inputValue:this.toPrecisionAsStep(_)},P),ne&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(_){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,K=N.precision,$=N.step;if(x(K))return K;var B=this.getPrecision(P),R=this.getPrecision($),G=this.getPrecision(_);return _?Math.max(G,B+R):B+R}},{key:"getPrecisionFactor",value:function(_){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(_,P);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(_){return this.props.formatter?this.props.formatter(_):_}},{key:"toPrecisionAsStep",value:function(_){if(this.isNotCompleteNumber(_)||_==="")return _;var P=Math.abs(this.getMaxPrecision(_));return isNaN(P)?_.toString():Number(_).toFixed(P)}},{key:"toNumber",value:function(_){var P=this.props.precision,N=this.state.focused,K=_&&_.length>16&&N;return this.isNotCompleteNumber(_)||K?_:x(P)?Math.round(_*Math.pow(10,P))/Math.pow(10,P):Number(_)}},{key:"upStep",value:function(_,P){var N=this.props.step,K=this.getPrecisionFactor(_,P),$=Math.abs(this.getMaxPrecision(_,P)),B=((K*_+K*N*P)/K).toFixed($);return this.toNumber(B)}},{key:"downStep",value:function(_,P){var N=this.props.step,K=this.getPrecisionFactor(_,P),$=Math.abs(this.getMaxPrecision(_,P)),B=((K*_-K*N*P)/K).toFixed($);return this.toNumber(B)}},{key:"step",value:function(_,P){var N=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,$=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var B=this.props;if(B.disabled)return;var R=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(R))return;var G=this["".concat(_,"Step")](R,K),Q=G>B.max||G<B.min;if(G>B.max?G=B.max:G<B.min&&(G=B.min),this.setValue(G,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),Q)return;this.autoStepTimer=setTimeout(function(){N[_](P,K,!0)},$?h:O)}},{key:"fixCaret",value:function(_,P){if(_===void 0||P===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,K=this.input.selectionEnd;(_!==N||P!==K)&&this.input.setSelectionRange(_,P)}catch($){}}},{key:"render",value:function(){var _,P=this.props,N=P.prefixCls,K=P.disabled,$=P.readOnly,B=P.useTouch,R=P.autoComplete,G=P.upHandler,Q=P.downHandler,ne=P.className,le=P.max,_e=P.min,pe=P.style,Ee=P.title,Oe=P.onMouseEnter,we=P.onMouseLeave,he=P.onMouseOver,oe=P.onMouseOut,Le=P.required,Ye=P.onClick,nt=P.tabIndex,qe=P.type,it=P.placeholder,He=P.id,$e=P.inputMode,Qe=P.pattern,gt=P.step,et=P.maxLength,tt=P.autoFocus,Je=P.name,vt=P.onPaste,wt=P.onInput,Et=Object(q.a)(P,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),xt=this.state,kt=xt.value,Ot=xt.focused,Ae=g()(N,(_={},Object(V.a)(_,ne,!!ne),Object(V.a)(_,"".concat(N,"-disabled"),K),Object(V.a)(_,"".concat(N,"-focused"),Ot),_)),Ce={};Object.keys(Et).forEach(function(fe){(fe.substr(0,5)==="data-"||fe.substr(0,5)==="aria-"||fe==="role")&&(Ce[fe]=Et[fe])});var Ge=!$&&!K,ze=this.getInputDisplayValue(null),Re=(kt||kt===0)&&(isNaN(kt)||Number(kt)>=le),je=(kt||kt===0)&&(isNaN(kt)||Number(kt)<=_e),ge=Re||K||$,de=je||K||$,ce=g()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(V.a)({},"".concat(N,"-handler-up-disabled"),ge)),re=g()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(V.a)({},"".concat(N,"-handler-down-disabled"),de)),ae=B?{onTouchStart:ge?r:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?r:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=B?{onTouchStart:de?r:this.down,onTouchEnd:this.stop}:{onMouseDown:de?r:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:Ae,style:pe,title:Ee,onMouseEnter:Oe,onMouseLeave:we,onMouseOver:he,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(N,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),G||D.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:a})),D.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:re}),Q||D.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:a}))),D.a.createElement("div",{className:"".concat(N,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":le,"aria-valuenow":kt,required:Le,type:qe,placeholder:it,onPaste:vt,onClick:Ye,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:nt,autoComplete:R,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ge?this.onKeyDown:r,onKeyUp:Ge?this.onKeyUp:r,autoFocus:tt,maxLength:et,readOnly:$,disabled:K,max:le,min:_e,step:gt,name:Je,title:Ee,id:He,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ze),pattern:Qe,inputMode:$e,onInput:wt},Ce))))}}]),E}(D.a.Component);C.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:r,onKeyDown:r,onPressEnter:r,onFocus:r,onBlur:r,parser:n,required:!1,autoComplete:"off"};var b=C,v=Se.a=b},fcSX:function(Fe,Se,W){"use strict";var q=W("Ff2n"),V=W("1OyB"),M=W("vuIU"),z=W("Ji7U"),U=W("md7G"),L=W("foSv"),H=W("1W/9"),F=W("q1tI"),D=W("rePB"),I=W("JX7q"),g=W("TSYQ"),f=W.n(g),u=W("qx4F"),d=W("4IlW");function s(K){return Array.isArray(K)?K:[K]}var l={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},r=Object.keys(l).filter(function(K){if(typeof document=="undefined")return!1;var $=document.getElementsByTagName("html")[0];return K in($?$.style:{})})[0],a=l[r];function n(K,$,B,R){K.addEventListener?K.addEventListener($,B,R):K.attachEvent&&K.attachEvent("on".concat($),B)}function h(K,$,B,R){K.removeEventListener?K.removeEventListener($,B,R):K.attachEvent&&K.detachEvent("on".concat($),B)}function O(K,$){var B=typeof K=="function"?K($):K;return Array.isArray(B)?B.length===2?B:[B[0],B[1]]:[B]}var S=function($){return!isNaN(parseFloat($))&&isFinite($)},x=!(typeof window!="undefined"&&window.document&&window.document.createElement),A=function K($,B,R,G){if(!B||B===document||B instanceof Document)return!1;if(B===$.parentNode)return!0;var Q=Math.max(Math.abs(R),Math.abs(G))===Math.abs(G),ne=Math.max(Math.abs(R),Math.abs(G))===Math.abs(R),le=B.scrollHeight-B.clientHeight,_e=B.scrollWidth-B.clientWidth,pe=document.defaultView.getComputedStyle(B),Ee=pe.overflowY==="auto"||pe.overflowY==="scroll",Oe=pe.overflowX==="auto"||pe.overflowX==="scroll",we=le&&Ee,he=_e&&Oe;return Q&&(!we||we&&(B.scrollTop>=le&&G<0||B.scrollTop<=0&&G>0))||ne&&(!he||he&&(B.scrollLeft>=_e&&R<0||B.scrollLeft<=0&&R>0))?K($,B.parentNode,R,G):!1};function C(K){var $=b();return function(){var R=Object(L.a)(K),G;if($){var Q=Object(L.a)(this).constructor;G=Reflect.construct(R,arguments,Q)}else G=R.apply(this,arguments);return Object(U.a)(this,G)}}function b(){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(K){return!1}}var v={},p=function(K){Object(z.a)(B,K);var $=C(B);function B(R){var G;return Object(V.a)(this,B),G=$.call(this,R),G.domFocus=function(){G.dom&&G.dom.focus()},G.removeStartHandler=function(Q){if(Q.touches.length>1)return;G.startPos={x:Q.touches[0].clientX,y:Q.touches[0].clientY}},G.removeMoveHandler=function(Q){if(Q.changedTouches.length>1)return;var ne=Q.currentTarget,le=Q.changedTouches[0].clientX-G.startPos.x,_e=Q.changedTouches[0].clientY-G.startPos.y;(ne===G.maskDom||ne===G.handlerDom||ne===G.contentDom&&A(ne,Q.target,le,_e))&&Q.cancelable&&Q.preventDefault()},G.transitionEnd=function(Q){var ne=Q.target;h(ne,a,G.transitionEnd),ne.style.transition=""},G.onKeyDown=function(Q){if(Q.keyCode===d.a.ESC){var ne=G.props.onClose;Q.stopPropagation(),ne&&ne(Q)}},G.onWrapperTransitionEnd=function(Q){var ne=G.props,le=ne.open,_e=ne.afterVisibleChange;Q.target===G.contentWrapper&&Q.propertyName.match(/transform$/)&&(G.dom.style.transition="",!le&&G.getCurrentDrawerSome()&&(document.body.style.overflowX="",G.maskDom&&(G.maskDom.style.left="",G.maskDom.style.width="")),_e&&_e(!!le))},G.openLevelTransition=function(){var Q=G.props,ne=Q.open,le=Q.width,_e=Q.height,pe=G.getHorizontalBoolAndPlacementName(),Ee=pe.isHorizontal,Oe=pe.placementName,we=G.contentDom?G.contentDom.getBoundingClientRect()[Ee?"width":"height"]:0,he=(Ee?le:_e)||we;G.setLevelAndScrolling(ne,Oe,he)},G.setLevelTransform=function(Q,ne,le,_e){var pe=G.props,Ee=pe.placement,Oe=pe.levelMove,we=pe.duration,he=pe.ease,oe=pe.showMask;G.levelDom.forEach(function(Le){Le.style.transition="transform ".concat(we," ").concat(he),n(Le,a,G.transitionEnd);var Ye=Q?le:0;if(Oe){var nt=O(Oe,{target:Le,open:Q});Ye=Q?nt[0]:nt[1]||0}var qe=typeof Ye=="number"?"".concat(Ye,"px"):Ye,it=Ee==="left"||Ee==="top"?qe:"-".concat(qe);it=oe&&Ee==="right"&&_e?"calc(".concat(it," + ").concat(_e,"px)"):it,Le.style.transform=Ye?"".concat(ne,"(").concat(it,")"):""})},G.setLevelAndScrolling=function(Q,ne,le){var _e=G.props.onChange;if(!x){var pe=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(u.a)(!0):0;G.setLevelTransform(Q,ne,le,pe),G.toggleScrollingToDrawerAndBody(pe)}_e&&_e(Q)},G.toggleScrollingToDrawerAndBody=function(Q){var ne=G.props,le=ne.getOpenCount,_e=ne.getContainer,pe=ne.showMask,Ee=ne.open,Oe=_e&&_e(),we=le&&le();if(Oe&&Oe.parentNode===document.body&&pe){var he=["touchstart"],oe=[document.body,G.maskDom,G.handlerDom,G.contentDom];Ee&&document.body.style.overflow!=="hidden"?(Q&&G.addScrollingEffect(Q),we===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",oe.forEach(function(Le,Ye){if(!Le)return;n(Le,he[Ye]||"touchmove",Ye?G.removeMoveHandler:G.removeStartHandler,G.passive)})):G.getCurrentDrawerSome()&&(we||(document.body.style.overflow=""),document.body.style.touchAction="",Q&&G.remScrollingEffect(Q),oe.forEach(function(Le,Ye){if(!Le)return;h(Le,he[Ye]||"touchmove",Ye?G.removeMoveHandler:G.removeStartHandler,G.passive)}))}},G.addScrollingEffect=function(Q){var ne=G.props,le=ne.placement,_e=ne.duration,pe=ne.ease,Ee=ne.getOpenCount,Oe=ne.switchScrollingEffect,we=Ee&&Ee();we===1&&Oe();var he="width ".concat(_e," ").concat(pe),oe="transform ".concat(_e," ").concat(pe);G.dom.style.transition="none";switch(le){case"right":G.dom.style.transform="translateX(-".concat(Q,"px)");break;case"top":case"bottom":G.dom.style.width="calc(100% - ".concat(Q,"px)"),G.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(G.timeout),G.timeout=setTimeout(function(){G.dom&&(G.dom.style.transition="".concat(oe,",").concat(he),G.dom.style.width="",G.dom.style.transform="")})},G.remScrollingEffect=function(Q){var ne=G.props,le=ne.placement,_e=ne.duration,pe=ne.ease,Ee=ne.getOpenCount,Oe=ne.switchScrollingEffect,we=Ee&&Ee();we||Oe(!0),r&&(document.body.style.overflowX="hidden"),G.dom.style.transition="none";var he,oe="width ".concat(_e," ").concat(pe),Le="transform ".concat(_e," ").concat(pe);switch(le){case"left":{G.dom.style.width="100%",oe="width 0s ".concat(pe," ").concat(_e);break}case"right":{G.dom.style.transform="translateX(".concat(Q,"px)"),G.dom.style.width="100%",oe="width 0s ".concat(pe," ").concat(_e),G.maskDom&&(G.maskDom.style.left="-".concat(Q,"px"),G.maskDom.style.width="calc(100% + ".concat(Q,"px)"));break}case"top":case"bottom":{G.dom.style.width="calc(100% + ".concat(Q,"px)"),G.dom.style.height="100%",G.dom.style.transform="translateZ(0)",he="height 0s ".concat(pe," ").concat(_e);break}default:break}clearTimeout(G.timeout),G.timeout=setTimeout(function(){G.dom&&(G.dom.style.transition="".concat(Le,",").concat(he?"".concat(he,","):"").concat(oe),G.dom.style.transform="",G.dom.style.width="",G.dom.style.height="")})},G.getCurrentDrawerSome=function(){return!Object.keys(v).some(function(Q){return v[Q]})},G.getLevelDom=function(Q){var ne=Q.level,le=Q.getContainer;if(x)return;var _e=le&&le(),pe=_e?_e.parentNode:null;if(G.levelDom=[],ne==="all"){var Ee=pe?Array.prototype.slice.call(pe.children):[];Ee.forEach(function(Oe){Oe.nodeName!=="SCRIPT"&&Oe.nodeName!=="STYLE"&&Oe.nodeName!=="LINK"&&Oe!==_e&&G.levelDom.push(Oe)})}else ne&&s(ne).forEach(function(Oe){document.querySelectorAll(Oe).forEach(function(we){G.levelDom.push(we)})})},G.getHorizontalBoolAndPlacementName=function(){var Q=G.props.placement,ne=Q==="left"||Q==="right",le="translate".concat(ne?"X":"Y");return{isHorizontal:ne,placementName:le}},G.state={_self:Object(I.a)(G)},G}return Object(M.a)(B,[{key:"componentDidMount",value:function(){var G=this;if(!x){var Q=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return Q=!0,null}}))}catch(Ee){}this.passive=Q?{passive:!1}:!1}var ne=this.props,le=ne.open,_e=ne.getContainer,pe=_e&&_e();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),le&&(pe&&pe.parentNode===document.body&&(v[this.drawerId]=le),this.openLevelTransition(),this.forceUpdate(function(){G.domFocus()}))}},{key:"componentDidUpdate",value:function(G){var Q=this.props,ne=Q.open,le=Q.getContainer,_e=le&&le();ne!==G.open&&(ne&&this.domFocus(),_e&&_e.parentNode===document.body&&(v[this.drawerId]=!!ne),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var G=this.props,Q=G.getOpenCount,ne=G.open,le=G.switchScrollingEffect,_e=typeof Q=="function"&&Q();delete v[this.drawerId],ne&&(this.setLevelTransform(!1),document.body.style.touchAction=""),_e||(document.body.style.overflow="",le(!0))}},{key:"render",value:function(){var G,Q=this,ne=this.props,le=ne.className,_e=ne.children,pe=ne.style,Ee=ne.width,Oe=ne.height,we=ne.defaultOpen,he=ne.open,oe=ne.prefixCls,Le=ne.placement,Ye=ne.level,nt=ne.levelMove,qe=ne.ease,it=ne.duration,He=ne.getContainer,$e=ne.handler,Qe=ne.onChange,gt=ne.afterVisibleChange,et=ne.showMask,tt=ne.maskClosable,Je=ne.maskStyle,vt=ne.onClose,wt=ne.onHandleClick,Et=ne.keyboard,xt=ne.getOpenCount,kt=ne.switchScrollingEffect,Ot=Object(q.a)(ne,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),Ae=this.dom?he:!1,Ce=f()(oe,(G={},Object(D.a)(G,"".concat(oe,"-").concat(Le),!0),Object(D.a)(G,"".concat(oe,"-open"),Ae),Object(D.a)(G,le||"",!!le),Object(D.a)(G,"no-mask",!et),G)),Ge=this.getHorizontalBoolAndPlacementName(),ze=Ge.placementName,Re=Le==="left"||Le==="top"?"-100%":"100%",je=Ae?"":"".concat(ze,"(").concat(Re,")"),ge=$e&&F.cloneElement($e,{onClick:function(ce){$e.props.onClick&&$e.props.onClick(),wt&&wt(ce)},ref:function(ce){Q.handlerDom=ce}});return F.createElement("div",Object.assign({},Ot,{tabIndex:-1,className:Ce,style:pe,ref:function(ce){Q.dom=ce},onKeyDown:Ae&&Et?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),et&&F.createElement("div",{className:"".concat(oe,"-mask"),onClick:tt?vt:void 0,style:Je,ref:function(ce){Q.maskDom=ce}}),F.createElement("div",{className:"".concat(oe,"-content-wrapper"),style:{transform:je,msTransform:je,width:S(Ee)?"".concat(Ee,"px"):Ee,height:S(Oe)?"".concat(Oe,"px"):Oe},ref:function(ce){Q.contentWrapper=ce}},F.createElement("div",{className:"".concat(oe,"-content"),ref:function(ce){Q.contentDom=ce},onTouchStart:Ae&&et?this.removeStartHandler:void 0,onTouchMove:Ae&&et?this.removeMoveHandler:void 0},_e),ge))}}],[{key:"getDerivedStateFromProps",value:function(G,Q){var ne=Q.prevProps,le=Q._self,_e={prevProps:G};if(ne!==void 0){var pe=G.placement,Ee=G.level;pe!==ne.placement&&(le.contentDom=null),Ee!==ne.level&&le.getLevelDom(G)}return _e}}]),B}(F.Component);p.defaultProps={switchScrollingEffect:function(){}};var c=p;function E(K){var $=y();return function(){var R=Object(L.a)(K),G;if($){var Q=Object(L.a)(this).constructor;G=Reflect.construct(R,arguments,Q)}else G=R.apply(this,arguments);return Object(U.a)(this,G)}}function y(){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(K){return!1}}var _=function(K){Object(z.a)(B,K);var $=E(B);function B(R){var G;Object(V.a)(this,B),G=$.call(this,R),G.onHandleClick=function(ne){var le=G.props,_e=le.onHandleClick,pe=le.open;if(_e&&_e(ne),typeof pe=="undefined"){var Ee=G.state.open;G.setState({open:!Ee})}},G.onClose=function(ne){var le=G.props,_e=le.onClose,pe=le.open;_e&&_e(ne),typeof pe=="undefined"&&G.setState({open:!1})};var Q=typeof R.open!="undefined"?R.open:!!R.defaultOpen;return G.state={open:Q},"onMaskClick"in R&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),G}return Object(M.a)(B,[{key:"render",value:function(){var G=this,Q=this.props,ne=Q.defaultOpen,le=Q.getContainer,_e=Q.wrapperClassName,pe=Q.forceRender,Ee=Q.handler,Oe=Object(q.a)(Q,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),we=this.state.open;if(!le)return F.createElement("div",{className:_e,ref:function(Le){G.dom=Le}},F.createElement(c,Object.assign({},Oe,{open:we,handler:Ee,getContainer:function(){return G.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var he=!!Ee||pe;return F.createElement(H.a,{visible:we,forceRender:he,getContainer:le,wrapperClassName:_e},function(oe){var Le=oe.visible,Ye=oe.afterClose,nt=Object(q.a)(oe,["visible","afterClose"]);return F.createElement(c,Object.assign({},Oe,nt,{open:Le!==void 0?Le:we,afterVisibleChange:Ye!==void 0?Ye:Oe.afterVisibleChange,handler:Ee,onClose:G.onClose,onHandleClick:G.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(G,Q){var ne=Q.prevProps,le={prevProps:G};return typeof ne!="undefined"&&G.open!==ne.open&&(le.open=G.open),le}}]),B}(F.Component);_.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:F.createElement("div",{className:"drawer-handle"},F.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var P=_,N=Se.a=P},fcyK:function(Fe,Se,W){},fyJ8:function(Fe,Se,W){"use strict";var q=W("rePB"),V=W("VTBJ"),M=W("Ff2n"),z=W("U8pU"),U=W("q1tI"),L=W.n(U),H=W("TSYQ"),F=W.n(H),D=W("c+Xe"),I=W("sR1s");function g(l){return l&&Object(z.a)(l)==="object"&&!Array.isArray(l)&&!U.isValidElement(l)}function f(l){return typeof l=="string"?!0:Object(D.c)(l)}function u(l,r){var a,n=l.prefixCls,h=l.className,O=l.record,S=l.index,x=l.dataIndex,A=l.render,C=l.children,b=l.component,v=b===void 0?"td":b,p=l.colSpan,c=l.rowSpan,E=l.fixLeft,y=l.fixRight,_=l.firstFixLeft,P=l.lastFixLeft,N=l.firstFixRight,K=l.lastFixRight,$=l.appendNode,B=l.additionalProps,R=B===void 0?{}:B,G=l.ellipsis,Q=l.align,ne=l.rowType,le=l.isSticky,_e="".concat(n,"-cell"),pe,Ee;if(C)Ee=C;else{var Oe=Object(I.b)(O,x);if(Ee=Oe,A){var we=A(Oe,O,S);g(we)?(Ee=we.children,pe=we.props):Ee=we}}Object(z.a)(Ee)==="object"&&!Array.isArray(Ee)&&!U.isValidElement(Ee)&&(Ee=null),G&&(P||N)&&(Ee=U.createElement("span",{className:"".concat(_e,"-content")},Ee));var he=pe||{},oe=he.colSpan,Le=he.rowSpan,Ye=he.style,nt=he.className,qe=Object(M.a)(he,["colSpan","rowSpan","style","className"]),it=oe!==void 0?oe:p,He=Le!==void 0?Le:c;if(it===0||He===0)return null;var $e={},Qe=typeof E=="number",gt=typeof y=="number";Qe&&($e.position="sticky",$e.left=E),gt&&($e.position="sticky",$e.right=y);var et={};Q&&(et.textAlign=Q);var tt,Je=G===!0?{showTitle:!0}:G;Je&&(Je.showTitle||ne==="header")&&(typeof Ee=="string"||typeof Ee=="number"?tt=Ee.toString():U.isValidElement(Ee)&&typeof Ee.props.children=="string"&&(tt=Ee.props.children));var vt=Object(V.a)(Object(V.a)(Object(V.a)({title:tt},qe),R),{},{colSpan:it&&it!==1?it:null,rowSpan:He&&He!==1?He:null,className:F()(_e,h,(a={},Object(q.a)(a,"".concat(_e,"-fix-left"),Qe),Object(q.a)(a,"".concat(_e,"-fix-left-first"),_),Object(q.a)(a,"".concat(_e,"-fix-left-last"),P),Object(q.a)(a,"".concat(_e,"-fix-right"),gt),Object(q.a)(a,"".concat(_e,"-fix-right-first"),N),Object(q.a)(a,"".concat(_e,"-fix-right-last"),K),Object(q.a)(a,"".concat(_e,"-ellipsis"),G),Object(q.a)(a,"".concat(_e,"-with-append"),$),Object(q.a)(a,"".concat(_e,"-fix-sticky"),(Qe||gt)&&le),a),R.className,nt),style:Object(V.a)(Object(V.a)(Object(V.a)(Object(V.a)({},R.style),et),$e),Ye),ref:f(v)?r:null});return U.createElement(v,Object.assign({},vt),$,Ee)}var d=U.forwardRef(u);d.displayName="Cell";var s=U.memo(d,function(l,r){return r.shouldCellUpdate?!r.shouldCellUpdate(r.record,l.record):!1});Se.a=s},gRFJ:function(Fe,Se,W){Fe.exports=[W("rdUC"),W("ynwM"),W("RELg"),W("DlR+"),W("CrYA"),W("PD8m")]},gaXo:function(module,exports){typeof JSON!="object"&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(Fe){return Fe<10?"0"+Fe:Fe}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(Fe){return rx_escapable.lastIndex=0,rx_escapable.test(Fe)?'"'+Fe.replace(rx_escapable,function(Se){var W=meta[Se];return typeof W=="string"?W:"\\u"+("0000"+Se.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+Fe+'"'}function str(Fe,Se){var W,q,V,M,z=gap,U,L=Se[Fe];L&&typeof L=="object"&&typeof L.toJSON=="function"&&(L=L.toJSON(Fe)),typeof rep=="function"&&(L=rep.call(Se,Fe,L));switch(typeof L){case"string":return quote(L);case"number":return isFinite(L)?String(L):"null";case"boolean":case"null":return String(L);case"object":if(!L)return"null";if(gap+=indent,U=[],Object.prototype.toString.apply(L)==="[object Array]"){for(M=L.length,W=0;W<M;W+=1)U[W]=str(W,L)||"null";return V=U.length===0?"[]":gap?`[
|
|
`+gap+U.join(`,
|
|
`+gap)+`
|
|
`+z+"]":"["+U.join(",")+"]",gap=z,V}if(rep&&typeof rep=="object")for(M=rep.length,W=0;W<M;W+=1)typeof rep[W]=="string"&&(q=rep[W],V=str(q,L),V&&U.push(quote(q)+(gap?": ":":")+V));else for(q in L)Object.prototype.hasOwnProperty.call(L,q)&&(V=str(q,L),V&&U.push(quote(q)+(gap?": ":":")+V));return V=U.length===0?"{}":gap?`{
|
|
`+gap+U.join(`,
|
|
`+gap)+`
|
|
`+z+"}":"{"+U.join(",")+"}",gap=z,V}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(Fe,Se,W){var q;if(gap="",indent="",typeof W=="number")for(q=0;q<W;q+=1)indent+=" ";else typeof W=="string"&&(indent=W);if(rep=Se,Se&&typeof Se!="function"&&(typeof Se!="object"||typeof Se.length!="number"))throw new Error("JSON.stringify");return str("",{"":Fe})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){var j;function walk(Fe,Se){var W,q,V=Fe[Se];if(V&&typeof V=="object")for(W in V)Object.prototype.hasOwnProperty.call(V,W)&&(q=walk(V,W),q!==void 0?V[W]=q:delete V[W]);return reviver.call(Fe,Se,V)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(Fe){return"\\u"+("0000"+Fe.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},hW8S:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return z}),W.d(Se,"c",function(){return U}),W.d(Se,"b",function(){return L});var q=W("VTBJ"),V=W("Ff2n"),M=W("Kwbf"),z="RC_TABLE_INTERNAL_COL_DEFINE";function U(H){var F=H.expandable,D=Object(V.a)(H,["expandable"]);return"expandable"in H?Object(q.a)(Object(q.a)({},D),F):D}function L(H){return Object.keys(H).reduce(function(F,D){return(D.substr(0,5)==="data-"||D.substr(0,5)==="aria-")&&(F[D]=H[D]),F},{})}},i3hx:function(Fe,Se,W){},je13:function(Fe,Se,W){var q=W("5nXd"),V=W("gRFJ"),M=[W("uQRt")];Fe.exports=q.createStore(V,M)},kSUc:function(Fe,Se,W){},"kaH+":function(Fe,Se,W){"use strict";var q=W("+L6B"),V=W("2/Rp"),M=W("tJVT"),z=W("q1tI"),U=W.n(z),L=W("UZu5"),H=W.n(L),F=W("dhSg"),D=W("rLCj"),I=W("dF/Y"),g=W("4i/N");Se.a=function(){var f=Object(z.useState)(""),u=Object(M.a)(f,2),d=u[0],s=u[1],l=Object(z.useState)(0),r=Object(M.a)(l,2),a=r[0],n=r[1],h=Object(z.useRef)("");Object(z.useEffect)(function(){var v=F.a.subscribe("preview-image",function(p){s(p),document.body.style.overflow="hidden"});return v},[]),Object(z.useEffect)(function(){return document.addEventListener("keydown",O),function(){document.removeEventListener("keydown",O)}},[]),Object(z.useEffect)(function(){h.current=d},[d]);function O(v){v.keyCode==27&&h.current&&S()}function S(){document.body.style.overflow="auto",s("")}function x(){n(a+90)}var A=Object(z.useRef)(),C=Object(z.useRef)(),b=function(p){(p.nativeEvent.target===A.current||p.nativeEvent.target===C.current)&&S()};return U.a.createElement(z.Fragment,null,d?U.a.createElement("div",{className:"image-preview-container",ref:A,onClick:b},U.a.createElement("div",{className:"button-group"},U.a.createElement(V.a,{onClick:x},"\u65CB\u8F6C",U.a.createElement(D.a,null)),U.a.createElement(V.a,{href:d},"\u4E0B\u8F7D",U.a.createElement(I.a,null)),U.a.createElement(V.a,{onClick:S},"\u5173\u95ED",U.a.createElement(g.a,null))),U.a.createElement("div",{className:"preview-wrp-group",ref:C},U.a.createElement("img",{className:"image-preview",src:d,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(a,"deg)")}}))):null)}},lOMy:function(Fe,Se,W){},lZu9:function(Fe,Se,W){(function(q){q(W("VrN/"),W("1eCo"),W("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(V,M){var z=q.getMode(V,"text/html"),U=z.name=="null";function L(B){if(q.findModeByName){var R=q.findModeByName(B);R&&(B=R.mime||R.mimes[0])}var G=q.getMode(V,B);return G.name=="null"?null:G}M.highlightFormatting===void 0&&(M.highlightFormatting=!1),M.maxBlockquoteDepth===void 0&&(M.maxBlockquoteDepth=0),M.taskLists===void 0&&(M.taskLists=!1),M.strikethrough===void 0&&(M.strikethrough=!1),M.emoji===void 0&&(M.emoji=!1),M.fencedCodeBlockHighlighting===void 0&&(M.fencedCodeBlockHighlighting=!0),M.fencedCodeBlockDefaultMode===void 0&&(M.fencedCodeBlockDefaultMode="text/plain"),M.xml===void 0&&(M.xml=!0),M.tokenTypeOverrides===void 0&&(M.tokenTypeOverrides={});var H={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var F in H)H.hasOwnProperty(F)&&M.tokenTypeOverrides[F]&&(H[F]=M.tokenTypeOverrides[F]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,I=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,f=M.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,u=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,l=/^\s*\[[^\]]+?\]:.*$/,r=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function n(B,R,G){return R.f=R.inline=G,G(B,R)}function h(B,R,G){return R.f=R.block=G,G(B,R)}function O(B){return!B||!/\S/.test(B.string)}function S(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==A){var R=U;if(!R){var G=q.innerMode(z,B.htmlState);R=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}R&&(B.f=p,B.block=x,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function x(B,R){var G=B.column()===R.indentation,Q=O(R.prevLine.stream),ne=R.indentedCode,le=R.prevLine.hr,_e=R.list!==!1,pe=(R.listStack[R.listStack.length-1]||0)+3;R.indentedCode=!1;var Ee=R.indentation;if(R.indentationDiff===null&&(R.indentationDiff=R.indentation,_e)){for(R.list=null;Ee<R.listStack[R.listStack.length-1];)R.listStack.pop(),R.listStack.length?R.indentation=R.listStack[R.listStack.length-1]:R.list=!1;R.list!==!1&&(R.indentationDiff=Ee-R.listStack[R.listStack.length-1])}var Oe=!Q&&!le&&!R.prevLine.header&&(!_e||!ne)&&!R.prevLine.fencedCodeEnd,we=(R.list===!1||le||Q)&&R.indentation<=pe&&B.match(D),he=null;if(R.indentationDiff>=4&&(ne||R.prevLine.fencedCodeEnd||R.prevLine.header||Q))return B.skipToEnd(),R.indentedCode=!0,H.code;if(B.eatSpace())return null;if(G&&R.indentation<=pe&&(he=B.match(f))&&he[1].length<=6)return R.quote=0,R.header=he[1].length,R.thisLine.header=!0,M.highlightFormatting&&(R.formatting="header"),R.f=R.inline,b(R);if(R.indentation<=pe&&B.eat(">"))return R.quote=G?1:R.quote+1,M.highlightFormatting&&(R.formatting="quote"),B.eatSpace(),b(R);if(!we&&!R.setext&&G&&R.indentation<=pe&&(he=B.match(I))){var oe=he[1]?"ol":"ul";return R.indentation=Ee+B.current().length,R.list=!0,R.quote=0,R.listStack.push(R.indentation),R.em=!1,R.strong=!1,R.code=!1,R.strikethrough=!1,M.taskLists&&B.match(g,!1)&&(R.taskList=!0),R.f=R.inline,M.highlightFormatting&&(R.formatting=["list","list-"+oe]),b(R)}else{if(G&&R.indentation<=pe&&(he=B.match(s,!0)))return R.quote=0,R.fencedEndRE=new RegExp(he[1]+"+ *$"),R.localMode=M.fencedCodeBlockHighlighting&&L(he[2]||M.fencedCodeBlockDefaultMode),R.localMode&&(R.localState=q.startState(R.localMode)),R.f=R.block=C,M.highlightFormatting&&(R.formatting="code-block"),R.code=-1,b(R);if(R.setext||(!Oe||!_e)&&!R.quote&&R.list===!1&&!R.code&&!we&&!l.test(B.string)&&(he=B.lookAhead(1))&&(he=he.match(u)))return R.setext?(R.header=R.setext,R.setext=0,B.skipToEnd(),M.highlightFormatting&&(R.formatting="header")):(R.header=he[0].charAt(0)=="="?1:2,R.setext=R.header),R.thisLine.header=!0,R.f=R.inline,b(R);if(we)return B.skipToEnd(),R.hr=!0,R.thisLine.hr=!0,H.hr;if(B.peek()==="[")return n(B,R,P)}return n(B,R,R.inline)}function A(B,R){var G=z.token(B,R.htmlState);if(!U){var Q=q.innerMode(z,R.htmlState);(Q.mode.name=="xml"&&Q.state.tagStart===null&&!Q.state.context&&Q.state.tokenize.isInText||R.md_inside&&B.current().indexOf(">")>-1)&&(R.f=p,R.block=x,R.htmlState=null)}return G}function C(B,R){var G=R.listStack[R.listStack.length-1]||0,Q=R.indentation<G,ne=G+3;if(R.fencedEndRE&&R.indentation<=ne&&(Q||B.match(R.fencedEndRE))){M.highlightFormatting&&(R.formatting="code-block");var le;return Q||(le=b(R)),R.localMode=R.localState=null,R.block=x,R.f=p,R.fencedEndRE=null,R.code=0,R.thisLine.fencedCodeEnd=!0,Q?h(B,R,R.block):le}else return R.localMode?R.localMode.token(B,R.localState):(B.skipToEnd(),H.code)}function b(B){var R=[];if(B.formatting){R.push(H.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var G=0;G<B.formatting.length;G++)R.push(H.formatting+"-"+B.formatting[G]),B.formatting[G]==="header"&&R.push(H.formatting+"-"+B.formatting[G]+"-"+B.header),B.formatting[G]==="quote"&&(!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=B.quote?R.push(H.formatting+"-"+B.formatting[G]+"-"+B.quote):R.push("error"))}if(B.taskOpen)return R.push("meta"),R.length?R.join(" "):null;if(B.taskClosed)return R.push("property"),R.length?R.join(" "):null;if(B.linkHref?R.push(H.linkHref,"url"):(B.strong&&R.push(H.strong),B.em&&R.push(H.em),B.strikethrough&&R.push(H.strikethrough),B.emoji&&R.push(H.emoji),B.linkText&&R.push(H.linkText),B.code&&R.push(H.code),B.image&&R.push(H.image),B.imageAltText&&R.push(H.imageAltText,"link"),B.imageMarker&&R.push(H.imageMarker)),B.header&&R.push(H.header,H.header+"-"+B.header),B.quote&&(R.push(H.quote),!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=B.quote?R.push(H.quote+"-"+B.quote):R.push(H.quote+"-"+M.maxBlockquoteDepth)),B.list!==!1){var Q=(B.listStack.length-1)%3;Q?Q===1?R.push(H.list2):R.push(H.list3):R.push(H.list1)}return B.trailingSpaceNewLine?R.push("trailing-space-new-line"):B.trailingSpace&&R.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),R.length?R.join(" "):null}function v(B,R){return B.match(d,!0)?b(R):void 0}function p(B,R){var G=R.text(B,R);if(typeof G!="undefined")return G;if(R.list)return R.list=null,b(R);if(R.taskList){var Q=B.match(g,!0)[1]===" ";return Q?R.taskOpen=!0:R.taskClosed=!0,M.highlightFormatting&&(R.formatting="task"),R.taskList=!1,b(R)}if(R.taskOpen=!1,R.taskClosed=!1,R.header&&B.match(/^#+$/,!0))return M.highlightFormatting&&(R.formatting="header"),b(R);var ne=B.next();if(R.linkTitle){R.linkTitle=!1;var le=ne;ne==="("&&(le=")"),le=(le+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+le+"\\\\]+|\\\\\\\\|\\\\.)"+le;if(B.match(new RegExp(_e),!0))return H.linkHref}if(ne==="`"){var pe=R.formatting;M.highlightFormatting&&(R.formatting="code"),B.eatWhile("`");var Ee=B.current().length;if(R.code==0&&(!R.quote||Ee==1))return R.code=Ee,b(R);if(Ee==R.code){var Oe=b(R);return R.code=0,Oe}else return R.formatting=pe,b(R)}else if(R.code)return b(R);if(ne==="\\"&&(B.next(),M.highlightFormatting)){var we=b(R),he=H.formatting+"-escape";return we?we+" "+he:he}if(ne==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return R.imageMarker=!0,R.image=!0,M.highlightFormatting&&(R.formatting="image"),b(R);if(ne==="["&&R.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return R.imageMarker=!1,R.imageAltText=!0,M.highlightFormatting&&(R.formatting="image"),b(R);if(ne==="]"&&R.imageAltText){M.highlightFormatting&&(R.formatting="image");var we=b(R);return R.imageAltText=!1,R.image=!1,R.inline=R.f=E,we}if(ne==="["&&!R.image)return R.linkText&&B.match(/^.*?\]/)||(R.linkText=!0,M.highlightFormatting&&(R.formatting="link")),b(R);if(ne==="]"&&R.linkText){M.highlightFormatting&&(R.formatting="link");var we=b(R);return R.linkText=!1,R.inline=R.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?E:p,we}if(ne==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){R.f=R.inline=c,M.highlightFormatting&&(R.formatting="link");var we=b(R);return we?we+=" ":we="",we+H.linkInline}if(ne==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){R.f=R.inline=c,M.highlightFormatting&&(R.formatting="link");var we=b(R);return we?we+=" ":we="",we+H.linkEmail}if(M.xml&&ne==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=B.string.indexOf(">",B.pos);if(oe!=-1){var Le=B.string.substring(B.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Le)&&(R.md_inside=!0)}return B.backUp(1),R.htmlState=q.startState(z),h(B,R,A)}if(M.xml&&ne==="<"&&B.match(/^\/\w*?>/))return R.md_inside=!1,"tag";if(ne==="*"||ne==="_"){for(var Ye=1,nt=B.pos==1?" ":B.string.charAt(B.pos-2);Ye<3&&B.eat(ne);)Ye++;var qe=B.peek()||" ",it=!/\s/.test(qe)&&(!r.test(qe)||/\s/.test(nt)||r.test(nt)),He=!/\s/.test(nt)&&(!r.test(nt)||/\s/.test(qe)||r.test(qe)),$e=null,Qe=null;if(Ye%2&&(!R.em&&it&&(ne==="*"||!He||r.test(nt))?$e=!0:R.em==ne&&He&&(ne==="*"||!it||r.test(qe))&&($e=!1)),Ye>1&&(!R.strong&&it&&(ne==="*"||!He||r.test(nt))?Qe=!0:R.strong==ne&&He&&(ne==="*"||!it||r.test(qe))&&(Qe=!1)),Qe!=null||$e!=null){M.highlightFormatting&&(R.formatting=$e==null?"strong":Qe==null?"em":"strong em"),$e===!0&&(R.em=ne),Qe===!0&&(R.strong=ne);var Oe=b(R);return $e===!1&&(R.em=!1),Qe===!1&&(R.strong=!1),Oe}}else if(ne===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return b(R);B.backUp(1)}if(M.strikethrough){if(ne==="~"&&B.eatWhile(ne)){if(R.strikethrough){M.highlightFormatting&&(R.formatting="strikethrough");var Oe=b(R);return R.strikethrough=!1,Oe}else if(B.match(/^[^\s]/,!1))return R.strikethrough=!0,M.highlightFormatting&&(R.formatting="strikethrough"),b(R)}else if(ne===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return b(R);B.backUp(2)}}if(M.emoji&&ne===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){R.emoji=!0,M.highlightFormatting&&(R.formatting="emoji");var gt=b(R);return R.emoji=!1,gt}return ne===" "&&(B.match(/^ +$/,!1)?R.trailingSpace++:R.trailingSpace&&(R.trailingSpaceNewLine=!0)),b(R)}function c(B,R){var G=B.next();if(G===">"){R.f=R.inline=p,M.highlightFormatting&&(R.formatting="link");var Q=b(R);return Q?Q+=" ":Q="",Q+H.linkInline}return B.match(/^[^>]+/,!0),H.linkInline}function E(B,R){if(B.eatSpace())return null;var G=B.next();return G==="("||G==="["?(R.f=R.inline=_(G==="("?")":"]"),M.highlightFormatting&&(R.formatting="link-string"),R.linkHref=!0,b(R)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(B){return function(R,G){var Q=R.next();if(Q===B){G.f=G.inline=p,M.highlightFormatting&&(G.formatting="link-string");var ne=b(G);return G.linkHref=!1,ne}return R.match(y[B]),G.linkHref=!0,b(G)}}function P(B,R){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(R.f=N,B.next(),M.highlightFormatting&&(R.formatting="link"),R.linkText=!0,b(R)):n(B,R,p)}function N(B,R){if(B.match(/^\]:/,!0)){R.f=R.inline=K,M.highlightFormatting&&(R.formatting="link");var G=b(R);return R.linkText=!1,G}return B.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function K(B,R){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?R.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),R.f=R.inline=p,H.linkHref+" url")}var $={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:p,text:v,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(z,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,R){if(R.formatting=!1,B!=R.thisLine.stream){if(R.header=0,R.hr=!1,B.match(/^\s*$/,!0))return S(R),null;if(R.prevLine=R.thisLine,R.thisLine={stream:B},R.taskList=!1,R.trailingSpace=0,R.trailingSpaceNewLine=!1,!R.localState&&(R.f=R.block,R.f!=A)){var G=B.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(R.indentation=G,R.indentationDiff=null,G>0)return null}}return R.f(B,R)},innerMode:function(B){return B.block==A?{state:B.htmlState,mode:z}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:$}},indent:function(B,R,G){return B.block==A&&z.indent?z.indent(B.htmlState,R,G):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,R,G):q.Pass},blankLine:S,getType:b,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return $},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},n6Qo:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return F});var q=W("q1tI"),V=W("biw7"),M=W("fyJ8");function z(D){var I=D.className,g=D.index,f=D.children,u=D.colSpan,d=D.rowSpan,s=q.useContext(V.a),l=s.prefixCls,r=s.fixedInfoList,a=r[g];return q.createElement(M.a,Object.assign({className:I,index:g,component:"td",prefixCls:l,record:null,dataIndex:null,render:function(){return{children:f,props:{colSpan:u,rowSpan:d}}}},a))}function U(D){return q.createElement("tr",Object.assign({},D))}function L(D){var I=D.children,g=q.useContext(V.a),f=g.prefixCls;return q.createElement("tfoot",{className:"".concat(f,"-summary")},I)}var H=Se.b=L,F={Cell:z,Row:U}},nWbc:function(Fe,Se,W){},oFv4:function(Fe,Se,W){Fe.exports=W.p+"static/internal.da228387.png"},osHv:function(Fe,Se,W){(function(q){q(W("VrN/"))})(function(q){"use strict";var V=q.Pos;function M(r,a){return r.line-a.line||r.ch-a.ch}var z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",L=new RegExp("<(/?)(["+z+"]["+U+"]*)","g");function H(r,a,n,h){this.line=a,this.ch=n,this.cm=r,this.text=r.getLine(a),this.min=h?Math.max(h.from,r.firstLine()):r.firstLine(),this.max=h?Math.min(h.to-1,r.lastLine()):r.lastLine()}function F(r,a){var n=r.cm.getTokenTypeAt(V(r.line,a));return n&&/\btag\b/.test(n)}function D(r){return r.line>=r.max?void 0:(r.ch=0,r.text=r.cm.getLine(++r.line),!0)}function I(r){return r.line<=r.min?void 0:(r.text=r.cm.getLine(--r.line),r.ch=r.text.length,!0)}function g(r){for(;;){var a=r.text.indexOf(">",r.ch);if(a==-1){if(D(r))continue;return}if(!F(r,a+1)){r.ch=a+1;continue}var n=r.text.lastIndexOf("/",a),h=n>-1&&!/\S/.test(r.text.slice(n+1,a));return r.ch=a+1,h?"selfClose":"regular"}}function f(r){for(;;){var a=r.ch?r.text.lastIndexOf("<",r.ch-1):-1;if(a==-1){if(I(r))continue;return}if(!F(r,a+1)){r.ch=a;continue}L.lastIndex=a,r.ch=a;var n=L.exec(r.text);if(n&&n.index==a)return n}}function u(r){for(;;){L.lastIndex=r.ch;var a=L.exec(r.text);if(!a){if(D(r))continue;return}if(!F(r,a.index+1)){r.ch=a.index+1;continue}return r.ch=a.index+a[0].length,a}}function d(r){for(;;){var a=r.ch?r.text.lastIndexOf(">",r.ch-1):-1;if(a==-1){if(I(r))continue;return}if(!F(r,a+1)){r.ch=a;continue}var n=r.text.lastIndexOf("/",a),h=n>-1&&!/\S/.test(r.text.slice(n+1,a));return r.ch=a+1,h?"selfClose":"regular"}}function s(r,a){for(var n=[];;){var h=u(r),O,S=r.line,x=r.ch-(h?h[0].length:0);if(!h||!(O=g(r)))return;if(O=="selfClose")continue;if(h[1]){for(var A=n.length-1;A>=0;--A)if(n[A]==h[2]){n.length=A;break}if(A<0&&(!a||a==h[2]))return{tag:h[2],from:V(S,x),to:V(r.line,r.ch)}}else n.push(h[2])}}function l(r,a){for(var n=[];;){var h=d(r);if(!h)return;if(h=="selfClose"){f(r);continue}var O=r.line,S=r.ch,x=f(r);if(!x)return;if(x[1])n.push(x[2]);else{for(var A=n.length-1;A>=0;--A)if(n[A]==x[2]){n.length=A;break}if(A<0&&(!a||a==x[2]))return{tag:x[2],from:V(r.line,r.ch),to:V(O,S)}}}}q.registerHelper("fold","xml",function(r,a){for(var n=new H(r,a.line,0);;){var h=u(n);if(!h||n.line!=a.line)return;var O=g(n);if(!O)return;if(!h[1]&&O!="selfClose"){var S=V(n.line,n.ch),x=s(n,h[2]);return x&&M(x.from,S)>0?{from:S,to:x.from}:null}}}),q.findMatchingTag=function(r,a,n){var h=new H(r,a.line,a.ch,n);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var O=g(h),S=O&&V(h.line,h.ch),x=O&&f(h);if(!O||!x||M(h,a)>0)return;var A={from:V(h.line,h.ch),to:S,tag:x[2]};return O=="selfClose"?{open:A,close:null,at:"open"}:x[1]?{open:l(h,x[2]),close:A,at:"close"}:(h=new H(r,S.line,S.ch,n),{open:A,close:s(h,x[2]),at:"open"})},q.findEnclosingTag=function(r,a,n,h){for(var O=new H(r,a.line,a.ch,n);;){var S=l(O,h);if(!S)break;var x=new H(r,a.line,a.ch,n),A=s(x,S.tag);if(A)return{open:S,close:A}}},q.scanForClosingTag=function(r,a,n,h){var O=new H(r,a.line,a.ch,h?{from:0,to:h}:null);return s(O,n)}})},"p/48":function(Fe,Se,W){},p5ED:function(Fe,Se,W){"use strict";var q=W("+L6B"),V=W("2/Rp"),M=W("5Dmo"),z=W("3S7+"),U=W("k1fw"),L=W("tJVT"),H=W("q1tI"),F=W.n(H),D=W("vHTk"),I=W.n(D),g=W("yEEn"),f=W("ZW9T"),u=W("1vsH");Se.a=function(d){var s=d.name,l=d.data,r=d.theme,a=d.type,n=d.filename,h=d.monacoEditor,O=d.className,S=d.style,x=d.close,A=d.onClose,C=d.hasMask,b=Object(H.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),v=Object(L.a)(b,2),p=v[0],c=v[1],E=Object(H.useState)(""),y=Object(L.a)(E,2),_=y[0],P=y[1],N,K=1024*1024,$=10*K,B=Object(H.useRef)();a==="office"&&(N=Object(u.T)(l).filesize,N>$&&(a="other")),n&&(h.filename=n),Object(H.useEffect)(function(){var Q,ne,le=(Q=document.cookie)===null||Q===void 0||((ne=Q.replace(/\s/g,""))===null||ne===void 0)?void 0:ne.split(";");le==null||le.map(function(_e){var pe=_e.split("=");pe[0]==="_educoder_session"&&P(pe[1])})},[]);var R=function(){if(l.startsWith("http")||l.startsWith("/")){G();return}Object(u.z)(n||"educoder",l,n)},G=function(){Object(u.x)(n||s,l)};return console.log("data:",l,"fileanme:",n," name:",s),F.a.createElement("div",{style:Object(U.a)({},S||{}),className:"".concat(C&&I.a.bgBlack," ").concat(a?I.a.wrp:"hide")},x&&F.a.createElement("div",{className:I.a.close,ref:B},F.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return B.current}},F.a.createElement("span",{onClick:G},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return B.current}},F.a.createElement("span",{className:"",onClick:A},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(I.a[O]," ").concat(O," ").concat(I.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&F.a.createElement(f.b,h)),a==="audio"&&F.a.createElement("audio",{src:"".concat(l!=null&&l.startsWith("/")||(l==null?void 0:l.indexOf("https://"))>-1?l:"data:audio/mp3;base64,").concat(l),autoPlay:!0}),a==="video"&&F.a.createElement(F.a.Fragment,null,l!=null&&l.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(l),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(l),autoPlay:!0})),a==="html"&&F.a.createElement("iframe",{src:l+"&disposition=inline"}),a==="pdf"&&F.a.createElement("embed",{className:I.a.embed,src:l}),a==="image"&&F.a.createElement(F.a.Fragment,null,F.a.createElement("img",{src:"".concat(l!=null&&l.startsWith("/")||(l==null?void 0:l.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(l)})),a==="other"&&F.a.createElement("div",null,F.a.createElement(V.a,{type:"primary",size:"large",onClick:R},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&F.a.createElement(V.a,{type:"primary",size:"large",onClick:R},F.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Fe,Se,W){},pPuO:function(Fe,Se,W){Fe.exports={desc:"desc___2o_2w",info:"info___Uro3x","commit-info":"commit-info___o2-Ex"}},psGv:function(Fe,Se,W){var q,V;(function(){var M;(function(){"use strict";var H=[,,function(g){function f(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}f.prototype.clone_empty=function(){var s=new f(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},f.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},f.prototype.has_match=function(s){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(s))return!0;return!1},f.prototype.set_indent=function(s,l){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},f.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(s){this.__items.push(s);var l=s.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=s.length-l:this.__character_count+=s.length},f.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function u(s,l){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),l=l||"",s.indent_level>0&&(l=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}u.prototype.get_indent_size=function(s,l){var r=this.__base_string_length;return l=l||0,s<0&&(r=0),r+=s*this.__indent_size,r+=l,r},u.prototype.get_indent_string=function(s,l){var r=this.__base_string;return l=l||0,s<0&&(s=0,r=""),l+=s*this.__indent_size,this.__ensure_cache(l),r+=this.__cache[l],r},u.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},u.prototype.__add_column=function(){var s=this.__cache.length,l=0,r="";this.__indent_size&&s>=this.__indent_size&&(l=Math.floor(s/this.__indent_size),s-=l*this.__indent_size,r=new Array(l+1).join(this.__indent_string)),s&&(r+=new Array(s+1).join(" ")),this.__cache.push(r)};function d(s,l){this.__indent_cache=new u(s,l),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}d.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},d.prototype.get_line_number=function(){return this.__lines.length},d.prototype.get_indent_string=function(s,l){return this.__indent_cache.get_indent_string(s,l)},d.prototype.get_indent_size=function(s,l){return this.__indent_cache.get_indent_size(s,l)},d.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},d.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},d.prototype.get_code=function(s){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(r=r.replace(/[\n]/g,s)),r},d.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},d.prototype.set_indent=function(s,l){return s=s||0,l=l||0,this.next_line.set_indent(s,l),this.__lines.length>1?(this.current_line.set_indent(s,l),!0):(this.current_line.set_indent(),!1)},d.prototype.add_raw_token=function(s){for(var l=0;l<s.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},d.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},d.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},d.prototype.remove_indent=function(s){for(var l=this.__lines.length;s<l;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},d.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},d.prototype.just_added_newline=function(){return this.current_line.is_empty()},d.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},d.prototype.ensure_empty_line_above=function(s,l){for(var r=this.__lines.length-2;r>=0;){var a=this.__lines[r];if(a.is_empty())break;if(a.item(0).indexOf(s)!==0&&a.item(-1)!==l){this.__lines.splice(r+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},g.exports.Output=d},function(g){function f(u,d,s,l){this.type=u,this.text=d,this.comments_before=null,this.newlines=s||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=f},,,function(g){function f(s,l){this.raw_options=u(s,l),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}f.prototype._get_array=function(s,l){var r=this.raw_options[s],a=l||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(a=r.concat()):typeof r=="string"&&(a=r.split(/[^a-zA-Z0-9_\/\-]+/)),a},f.prototype._get_boolean=function(s,l){var r=this.raw_options[s],a=r===void 0?!!l:!!r;return a},f.prototype._get_characters=function(s,l){var r=this.raw_options[s],a=l||"";return typeof r=="string"&&(a=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),a},f.prototype._get_number=function(s,l){var r=this.raw_options[s];l=parseInt(l,10),isNaN(l)&&(l=0);var a=parseInt(r,10);return isNaN(a)&&(a=l),a},f.prototype._get_selection=function(s,l,r){var a=this._get_selection_list(s,l,r);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[s]+"'");return a[0]},f.prototype._get_selection_list=function(s,l,r){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[l[0]],!this._is_valid_selection(r,l))throw new Error("Invalid Default Value!");var a=this._get_array(s,r);if(!this._is_valid_selection(a,l))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[s]+"'");return a},f.prototype._is_valid_selection=function(s,l){return s.length&&l.length&&!s.some(function(r){return l.indexOf(r)===-1})};function u(s,l){var r={};s=d(s);var a;for(a in s)a!==l&&(r[a]=s[a]);if(l&&s[l])for(a in s[l])r[a]=s[l][a];return r}function d(s){var l={},r;for(r in s){var a=r.replace(/-/g,"_");l[a]=s[r]}return l}g.exports.Options=f,g.exports.normalizeOpts=d,g.exports.mergeOpts=u},,function(g){var f=RegExp.prototype.hasOwnProperty("sticky");function u(d){this.__input=d||"",this.__input_length=this.__input.length,this.__position=0}u.prototype.restart=function(){this.__position=0},u.prototype.back=function(){this.__position>0&&(this.__position-=1)},u.prototype.hasNext=function(){return this.__position<this.__input_length},u.prototype.next=function(){var d=null;return this.hasNext()&&(d=this.__input.charAt(this.__position),this.__position+=1),d},u.prototype.peek=function(d){var s=null;return d=d||0,d+=this.__position,d>=0&&d<this.__input_length&&(s=this.__input.charAt(d)),s},u.prototype.__match=function(d,s){d.lastIndex=s;var l=d.exec(this.__input);return l&&!(f&&d.sticky)&&(l.index!==s&&(l=null)),l},u.prototype.test=function(d,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(d,s):!1},u.prototype.testChar=function(d,s){var l=this.peek(s);return d.lastIndex=0,l!==null&&d.test(l)},u.prototype.match=function(d){var s=this.__match(d,this.__position);return s?this.__position+=s[0].length:s=null,s},u.prototype.read=function(d,s,l){var r="",a;return d&&(a=this.match(d),a&&(r+=a[0])),s&&(a||!d)&&(r+=this.readUntil(s,l)),r},u.prototype.readUntil=function(d,s){var l="",r=this.__position;d.lastIndex=this.__position;var a=d.exec(this.__input);return a?(r=a.index,s&&(r+=a[0].length)):r=this.__input_length,l=this.__input.substring(this.__position,r),this.__position=r,l},u.prototype.readUntilAfter=function(d){return this.readUntil(d,!0)},u.prototype.get_regexp=function(d,s){var l=null,r="g";return s&&f&&(r="y"),typeof d=="string"&&d!==""?l=new RegExp(d,r):d&&(l=new RegExp(d.source,r)),l},u.prototype.get_literal_regexp=function(d){return RegExp(d.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},u.prototype.peekUntilAfter=function(d){var s=this.__position,l=this.readUntilAfter(d);return this.__position=s,l},u.prototype.lookBack=function(d){var s=this.__position-1;return s>=d.length&&this.__input.substring(s-d.length,s).toLowerCase()===d},g.exports.InputScanner=u},function(g,f,u){var d=u(8).InputScanner,s=u(3).Token,l=u(10).TokenStream,r=u(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},n=function(h,O){this._input=new d(h),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};n.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var h,O=new s(a.START,""),S=null,x=[],A=new l;O.type!==a.EOF;){for(h=this._get_next_token(O,S);this._is_comment(h);)A.add(h),h=this._get_next_token(O,S);A.isEmpty()||(h.comments_before=A,A=new l),h.parent=S,this._is_opening(h)?(x.push(S),S=h):S&&this._is_closing(h,S)&&(h.opened=S,S.closed=h,S=x.pop(),h.parent=S),h.previous=O,O.next=h,this.__tokens.add(h),O=h}return this.__tokens},n.prototype._is_first_token=function(){return this.__tokens.isEmpty()},n.prototype._reset=function(){},n.prototype._get_next_token=function(h,O){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(a.RAW,S):this._create_token(a.EOF,"")},n.prototype._is_comment=function(h){return!1},n.prototype._is_opening=function(h){return!1},n.prototype._is_closing=function(h,O){return!1},n.prototype._create_token=function(h,O){var S=new s(h,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},n.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=n,g.exports.TOKEN=a},function(g){function f(u){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=u}f.prototype.restart=function(){this.__position=0},f.prototype.isEmpty=function(){return this.__tokens_length===0},f.prototype.hasNext=function(){return this.__position<this.__tokens_length},f.prototype.next=function(){var u=null;return this.hasNext()&&(u=this.__tokens[this.__position],this.__position+=1),u},f.prototype.peek=function(u){var d=null;return u=u||0,u+=this.__position,u>=0&&u<this.__tokens_length&&(d=this.__tokens[u]),d},f.prototype.add=function(u){this.__parent_token&&(u.parent=this.__parent_token),this.__tokens.push(u),this.__tokens_length+=1},g.exports.TokenStream=f},function(g,f,u){var d=u(12).Pattern;function s(l,r){d.call(this,l,r),r?this._line_regexp=this._input.get_regexp(r._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new d,s.prototype.__set_whitespace_patterns=function(l,r){l+="\\t ",r+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+r+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+r+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var r=this.__split(this._newline_regexp,l);this.newline_count=r.length-1,this.whitespace_before_token=r[this.newline_count]}return l},s.prototype.matching=function(l,r){var a=this._create();return a.__set_whitespace_patterns(l,r),a._update(),a},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(l,r){l.lastIndex=0;for(var a=0,n=[],h=l.exec(r);h;)n.push(r.substring(a,h.index)),a=h.index+h[0].length,h=l.exec(r);return a<r.length?n.push(r.substring(a,r.length)):n.push(""),n},g.exports.WhitespacePattern=s},function(g){function f(u,d){this._input=u,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,d&&(this._starting_pattern=this._input.get_regexp(d._starting_pattern,!0),this._match_pattern=this._input.get_regexp(d._match_pattern,!0),this._until_pattern=this._input.get_regexp(d._until_pattern),this._until_after=d._until_after)}f.prototype.read=function(){var u=this._input.read(this._starting_pattern);return(!this._starting_pattern||u)&&(u+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),u},f.prototype.read_match=function(){return this._input.match(this._match_pattern)},f.prototype.until_after=function(u){var d=this._create();return d._until_after=!0,d._until_pattern=this._input.get_regexp(u),d._update(),d},f.prototype.until=function(u){var d=this._create();return d._until_after=!1,d._until_pattern=this._input.get_regexp(u),d._update(),d},f.prototype.starting_with=function(u){var d=this._create();return d._starting_pattern=this._input.get_regexp(u,!0),d._update(),d},f.prototype.matching=function(u){var d=this._create();return d._match_pattern=this._input.get_regexp(u,!0),d._update(),d},f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){},g.exports.Pattern=f},function(g){function f(u,d){u=typeof u=="string"?u:u.source,d=typeof d=="string"?d:d.source,this.__directives_block_pattern=new RegExp(u+/ beautify( \w+[:]\w+)+ /.source+d,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(u+/\sbeautify\signore:end\s/.source+d,"g")}f.prototype.get_directives=function(u){if(!u.match(this.__directives_block_pattern))return null;var d={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(u);s;)d[s[1]]=s[2],s=this.__directive_pattern.exec(u);return d},f.prototype.readIgnored=function(u){return u.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=f},function(g,f,u){var d=u(12).Pattern,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function l(r,a){d.call(this,r,a),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var n=new d(r);this.__patterns={handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:n.starting_with(/{{{/).until_after(/}}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),php:n.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:n.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:n.starting_with(/{%/).until_after(/%}/),django_value:n.starting_with(/{{/).until_after(/}}/),django_comment:n.starting_with(/{#/).until_after(/#}/),smarty:n.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:n.starting_with(/{\*/).until_after(/\*}/),smarty_literal:n.starting_with(/{literal}/).until_after(/{\/literal}/)}}l.prototype=new d,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(r){var a=this._create();return a._disabled[r]=!0,a._update(),a},l.prototype.read_options=function(r){var a=this._create();for(var n in s)a._disabled[n]=r.templating.indexOf(n)===-1;return a._update(),a},l.prototype.exclude=function(r){var a=this._create();return a._excluded[r]=!0,a._update(),a},l.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=this._input.read(this._starting_pattern,this.__template_pattern);for(var a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),r+=a,a=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},l.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},l.prototype._read_template=function(){var r="",a=this._input.peek();if(a==="<"){var n=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&n==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&n==="%"&&(r=r||this.__patterns.erb.read())}else a==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},g.exports.TemplatablePattern=l},,,,function(g,f,u){var d=u(19).Beautifier,s=u(20).Options;function l(r,a,n,h){var O=new d(r,a,n,h);return O.beautify()}g.exports=l,g.exports.defaultOptions=function(){return new s}},function(g,f,u){var d=u(20).Options,s=u(2).Output,l=u(21).Tokenizer,r=u(21).TOKEN,a=/\r\n|[\r\n]/,n=/\r\n|[\r\n]/g,h=function(E,y){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=E.max_preserve_newlines,this.preserve_newlines=E.preserve_newlines,this._output=new s(E,y)};h.prototype.current_line_has_match=function(E){return this._output.current_line.has_match(E)},h.prototype.set_space_before_token=function(E,y){this._output.space_before_token=E,this._output.non_breaking_space=y},h.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},h.prototype.add_raw_token=function(E){this._output.add_raw_token(E)},h.prototype.print_preserved_newlines=function(E){var y=0;E.type!==r.TEXT&&E.previous.type!==r.TEXT&&(y=E.newlines?1:0),this.preserve_newlines&&(y=E.newlines<this.max_preserve_newlines+1?E.newlines:this.max_preserve_newlines+1);for(var _=0;_<y;_++)this.print_newline(_>0);return y!==0},h.prototype.traverse_whitespace=function(E){return E.whitespace_before||E.newlines?(this.print_preserved_newlines(E)||(this._output.space_before_token=!0),!0):!1},h.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},h.prototype.print_newline=function(E){this._output.add_new_line(E)},h.prototype.print_token=function(E){E.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(E.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(E){return E=this.indent_level+(E||0),E<1?"":this._output.get_indent_string(E)};var O=function(E){for(var y=null,_=E.next;_.type!==r.EOF&&E.closed!==_;){if(_.type===r.ATTRIBUTE&&_.text==="type"){_.next&&_.next.type===r.EQUALS&&_.next.next&&_.next.next.type===r.VALUE&&(y=_.next.next.text);break}_=_.next}return y},S=function(E,y){var _=null,P=null;return y.closed?(E==="script"?_="text/javascript":E==="style"&&(_="text/css"),_=O(y)||_,_.search("text/css")>-1?P="css":_.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":_.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":_.search(/test\/null/)>-1&&(P="null"),P):null};function x(E,y){return y.indexOf(E)!==-1}function A(E,y,_){this.parent=E||null,this.tag=y?y.tag_name:"",this.indent_level=_||0,this.parser_token=y||null}function C(E){this._printer=E,this._current_frame=null}C.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},C.prototype.record_tag=function(E){var y=new A(this._current_frame,E,this._printer.indent_level);this._current_frame=y},C.prototype._try_pop_frame=function(E){var y=null;return E&&(y=E.parser_token,this._printer.indent_level=E.indent_level,this._current_frame=E.parent),y},C.prototype._get_frame=function(E,y){for(var _=this._current_frame;_&&!(E.indexOf(_.tag)!==-1);){if(y&&y.indexOf(_.tag)!==-1){_=null;break}_=_.parent}return _},C.prototype.try_pop=function(E,y){var _=this._get_frame([E],y);return this._try_pop_frame(_)},C.prototype.indent_to_tag=function(E){var y=this._get_frame(E);y&&(this._printer.indent_level=y.indent_level)};function b(E,y,_,P){this._source_text=E||"",y=y||{},this._js_beautify=_,this._css_beautify=P,this._tag_stack=null;var N=new d(y,"html");this._options=N,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}b.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,y=this._options.eol;this._options.eol==="auto"&&(y=`
|
|
`,E&&a.test(E)&&(y=E.match(a)[0])),E=E.replace(n,`
|
|
`);var _=E.match(/^[\t ]*/)[0],P={text:"",type:""},N=new v,K=new h(this._options,_),$=new l(E,this._options).tokenize();this._tag_stack=new C(K);for(var B=null,R=$.next();R.type!==r.EOF;)R.type===r.TAG_OPEN||R.type===r.COMMENT?(B=this._handle_tag_open(K,R,N,P),N=B):R.type===r.ATTRIBUTE||R.type===r.EQUALS||R.type===r.VALUE||R.type===r.TEXT&&!N.tag_complete?B=this._handle_inside_tag(K,R,N,$):R.type===r.TAG_CLOSE?B=this._handle_tag_close(K,R,N):R.type===r.TEXT?B=this._handle_text(K,R,N):K.add_raw_token(R),P=B,R=$.next();var G=K._output.get_code(y);return G},b.prototype._handle_tag_close=function(E,y,_){var P={text:y.text,type:y.type};return E.alignment_size=0,_.tag_complete=!0,E.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),_.is_unformatted?E.add_raw_token(y):(_.tag_start_char==="<"&&(E.set_space_before_token(y.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&_.has_wrapped_attrs&&E.print_newline(!1)),E.print_token(y)),_.indent_content&&!(_.is_unformatted||_.is_content_unformatted)&&(E.indent(),_.indent_content=!1),!_.is_inline_element&&!(_.is_unformatted||_.is_content_unformatted)&&E.set_wrap_point(),P},b.prototype._handle_inside_tag=function(E,y,_,P){var N=_.has_wrapped_attrs,K={text:y.text,type:y.type};if(E.set_space_before_token(y.newlines||y.whitespace_before!=="",!0),_.is_unformatted)E.add_raw_token(y);else if(_.tag_start_char==="{"&&y.type===r.TEXT)E.print_preserved_newlines(y)?(y.newlines=0,E.add_raw_token(y)):E.print_token(y);else{if(y.type===r.ATTRIBUTE?(E.set_space_before_token(!0),_.attr_count+=1):(y.type===r.EQUALS||y.type===r.VALUE&&y.previous.type===r.EQUALS)&&E.set_space_before_token(!1),y.type===r.ATTRIBUTE&&_.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(E.traverse_whitespace(y),N=N||y.newlines!==0),this._is_wrap_attributes_force)){var $=_.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&_.attr_count===1){var B=!0,R=0,G;do{if(G=P.peek(R),G.type===r.ATTRIBUTE){B=!1;break}R+=1}while(R<4&&G.type!==r.EOF&&G.type!==r.TAG_CLOSE);$=!B}$&&(E.print_newline(!1),N=!0)}E.print_token(y),N=N||E.previous_token_wrapped(),_.has_wrapped_attrs=N}return K},b.prototype._handle_text=function(E,y,_){var P={text:y.text,type:"TK_CONTENT"};return _.custom_beautifier_name?this._print_custom_beatifier_text(E,y,_):_.is_unformatted||_.is_content_unformatted?E.add_raw_token(y):(E.traverse_whitespace(y),E.print_token(y)),P},b.prototype._print_custom_beatifier_text=function(E,y,_){var P=this;if(y.text!==""){var N=y.text,K,$=1,B="",R="";_.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:_.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:_.custom_beautifier_name==="html"&&(K=function(pe,Ee){var Oe=new b(pe,Ee,P._js_beautify,P._css_beautify);return Oe.beautify()}),this._options.indent_scripts==="keep"?$=0:this._options.indent_scripts==="separate"&&($=-E.indent_level);var G=E.get_full_indent($);if(N=N.replace(/\n[ \t]*$/,""),_.custom_beautifier_name!=="html"&&N[0]==="<"&&N.match(/^(<!--|<!\[CDATA\[)/)){var Q=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(N);if(!Q){E.add_raw_token(y);return}B=G+Q[1]+`
|
|
`,N=Q[4],Q[5]&&(R=G+Q[5]),N=N.replace(/\n[ \t]*$/,""),(Q[2]||Q[3].indexOf(`
|
|
`)!==-1)&&(Q=Q[3].match(/[ \t]+$/),Q&&(y.whitespace_before=Q[0]))}if(N)if(K){var ne=function(){this.eol=`
|
|
`};ne.prototype=this._options.raw_options;var le=new ne;N=K(G+N,le)}else{var _e=y.whitespace_before;_e&&(N=N.replace(new RegExp(`
|
|
(`+_e+")?","g"),`
|
|
`)),N=G+N.replace(/\n/g,`
|
|
`+G)}B&&(N?N=B+N+`
|
|
`+R:N=B+R),E.print_newline(!1),N&&(y.text=N,y.whitespace_before="",y.newlines=0,E.add_raw_token(y),E.print_newline(!0))}},b.prototype._handle_tag_open=function(E,y,_,P){var N=this._get_tag_open_token(y);return(_.is_unformatted||_.is_content_unformatted)&&!_.is_empty_element&&y.type===r.TAG_OPEN&&y.text.indexOf("</")===0?(E.add_raw_token(y),N.start_tag_token=this._tag_stack.try_pop(N.tag_name)):(E.traverse_whitespace(y),this._set_tag_position(E,y,N,_,P),N.is_inline_element||E.set_wrap_point(),E.print_token(y)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(N.alignment_size=y.text.length+1),!N.tag_complete&&!N.is_unformatted&&(E.alignment_size=N.alignment_size),N};var v=function(E,y){if(this.parent=E||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!y)this.tag_complete=!0;else{var _;this.tag_start_char=y.text[0],this.text=y.text,this.tag_start_char==="<"?(_=y.text.match(/^<([^\s>]*)/),this.tag_check=_?_[1]:""):(_=y.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=_?_[1]:"",(y.text.startsWith("{{#>")||y.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&y.next!==null?this.tag_check=y.next.text.split(" ")[0]:this.tag_check=y.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),y.type===r.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||y.closed&&y.closed.text==="/>";var P=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(P=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(P)))}};b.prototype._get_tag_open_token=function(E){var y=new v(this._tag_stack.get_parser_token(),E);return y.alignment_size=this._options.wrap_attributes_indent_size,y.is_end_tag=y.is_end_tag||x(y.tag_check,this._options.void_elements),y.is_empty_element=y.tag_complete||y.is_start_tag&&y.is_end_tag,y.is_unformatted=!y.tag_complete&&x(y.tag_check,this._options.unformatted),y.is_content_unformatted=!y.is_empty_element&&x(y.tag_check,this._options.content_unformatted),y.is_inline_element=x(y.tag_name,this._options.inline)||y.tag_name.includes("-")||y.tag_start_char==="{",y},b.prototype._set_tag_position=function(E,y,_,P,N){if(_.is_empty_element||(_.is_end_tag?_.start_tag_token=this._tag_stack.try_pop(_.tag_name):(this._do_optional_end_element(_)&&(_.is_inline_element||E.print_newline(!1)),this._tag_stack.record_tag(_),(_.tag_name==="script"||_.tag_name==="style")&&!(_.is_unformatted||_.is_content_unformatted)&&(_.custom_beautifier_name=S(_.tag_check,y)))),x(_.tag_check,this._options.extra_liners)&&(E.print_newline(!1),E._output.just_added_blankline()||E.print_newline(!0)),_.is_empty_element){if(_.tag_start_char==="{"&&_.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),_.indent_content=!0;var K=E.current_line_has_match(/{{#if/);K||E.print_newline(!1)}_.tag_name==="!--"&&N.type===r.TAG_CLOSE&&P.is_end_tag&&_.text.indexOf(`
|
|
`)===-1||(_.is_inline_element||_.is_unformatted||E.print_newline(!1),this._calcluate_parent_multiline(E,_))}else if(_.is_end_tag){var $=!1;$=_.start_tag_token&&_.start_tag_token.multiline_content,$=$||!_.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(N.type===r.TAG_CLOSE&&_.start_tag_token===P)&&N.type!=="TK_CONTENT",(_.is_content_unformatted||_.is_unformatted)&&($=!1),$&&E.print_newline(!1)}else _.indent_content=!_.custom_beautifier_name,_.tag_start_char==="<"&&(_.tag_name==="html"?_.indent_content=this._options.indent_inner_html:_.tag_name==="head"?_.indent_content=this._options.indent_head_inner_html:_.tag_name==="body"&&(_.indent_content=this._options.indent_body_inner_html)),!(_.is_inline_element||_.is_unformatted)&&(N.type!=="TK_CONTENT"||_.is_content_unformatted)&&E.print_newline(!1),this._calcluate_parent_multiline(E,_)},b.prototype._calcluate_parent_multiline=function(E,y){y.parent&&E._output.just_added_newline()&&!((y.is_inline_element||y.is_unformatted)&&y.parent.is_inline_element)&&(y.parent.multiline_content=!0)};var p=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],c=["a","audio","del","ins","map","noscript","video"];b.prototype._do_optional_end_element=function(E){var y=null;if(E.is_empty_element||!E.is_start_tag||!E.parent)return;if(E.tag_name==="body")y=y||this._tag_stack.try_pop("head");else if(E.tag_name==="li")y=y||this._tag_stack.try_pop("li",["ol","ul"]);else if(E.tag_name==="dd"||E.tag_name==="dt")y=y||this._tag_stack.try_pop("dt",["dl"]),y=y||this._tag_stack.try_pop("dd",["dl"]);else if(E.parent.tag_name==="p"&&p.indexOf(E.tag_name)!==-1){var _=E.parent.parent;(!_||c.indexOf(_.tag_name)===-1)&&(y=y||this._tag_stack.try_pop("p"))}else E.tag_name==="rp"||E.tag_name==="rt"?(y=y||this._tag_stack.try_pop("rt",["ruby","rtc"]),y=y||this._tag_stack.try_pop("rp",["ruby","rtc"])):E.tag_name==="optgroup"?y=y||this._tag_stack.try_pop("optgroup",["select"]):E.tag_name==="option"?y=y||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):E.tag_name==="colgroup"?y=y||this._tag_stack.try_pop("caption",["table"]):E.tag_name==="thead"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"])):E.tag_name==="tbody"||E.tag_name==="tfoot"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("thead",["table"]),y=y||this._tag_stack.try_pop("tbody",["table"])):E.tag_name==="tr"?(y=y||this._tag_stack.try_pop("caption",["table"]),y=y||this._tag_stack.try_pop("colgroup",["table"]),y=y||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(E.tag_name==="th"||E.tag_name==="td")&&(y=y||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),y=y||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return E.parent=this._tag_stack.get_parser_token(),y},g.exports.Beautifier=b},function(g,f,u){var d=u(6).Options;function s(l){d.call(this,l,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}s.prototype=new d,g.exports.Options=s},function(g,f,u){var d=u(9).Tokenizer,s=u(9).TOKEN,l=u(13).Directives,r=u(14).TemplatablePattern,a=u(12).Pattern,n={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:s.START,RAW:s.RAW,EOF:s.EOF},h=new l(/<\!--/,/-->/),O=function(S,x){d.call(this,S,x),this._current_tag_name="";var A=new r(this._input).read_options(this._options),C=new a(this._input);if(this.__patterns={word:A.until(/[\n\r\t <]/),single_quote:A.until_after(/'/),double_quote:A.until_after(/"/),attribute:A.until(/[\n\r\t =>]|\/>/),element_name:A.until(/[\n\r\t >\/]/),handlebars_comment:C.starting_with(/{{!--/).until_after(/--}}/),handlebars:C.starting_with(/{{/).until_after(/}}/),handlebars_open:C.until(/[\n\r\t }]/),handlebars_raw_close:C.until(/}}/),comment:C.starting_with(/<!--/).until_after(/-->/),cdata:C.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:C.starting_with(/<!\[/).until_after(/]>/),processing:C.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var b=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=C.matching(b).until_after(b)}};O.prototype=new d,O.prototype._is_comment=function(S){return!1},O.prototype._is_opening=function(S){return S.type===n.TAG_OPEN},O.prototype._is_closing=function(S,x){return S.type===n.TAG_CLOSE&&x&&((S.text===">"||S.text==="/>")&&x.text[0]==="<"||S.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(S,x){var A=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(n.EOF,""):(A=A||this._read_open_handlebars(C,x),A=A||this._read_attribute(C,S,x),A=A||this._read_close(C,x),A=A||this._read_raw_content(C,S,x),A=A||this._read_content_word(C),A=A||this._read_comment_or_cdata(C),A=A||this._read_processing(C),A=A||this._read_open(C,x),A=A||this._create_token(n.UNKNOWN,this._input.next()),A)},O.prototype._read_comment_or_cdata=function(S){var x=null,A=null,C=null;if(S==="<"){var b=this._input.peek(1);b==="!"&&(A=this.__patterns.comment.read(),A?(C=h.get_directives(A),C&&C.ignore==="start"&&(A+=h.readIgnored(this._input))):A=this.__patterns.cdata.read()),A&&(x=this._create_token(n.COMMENT,A),x.directives=C)}return x},O.prototype._read_processing=function(S){var x=null,A=null,C=null;if(S==="<"){var b=this._input.peek(1);(b==="!"||b==="?")&&(A=this.__patterns.conditional_comment.read(),A=A||this.__patterns.processing.read()),A&&(x=this._create_token(n.COMMENT,A),x.directives=C)}return x},O.prototype._read_open=function(S,x){var A=null,C=null;return x||S==="<"&&(A=this._input.next(),this._input.peek()==="/"&&(A+=this._input.next()),A+=this.__patterns.element_name.read(),C=this._create_token(n.TAG_OPEN,A)),C},O.prototype._read_open_handlebars=function(S,x){var A=null,C=null;return x||this._options.indent_handlebars&&S==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(A=this.__patterns.handlebars_comment.read(),A=A||this.__patterns.handlebars.read(),C=this._create_token(n.COMMENT,A)):(A=this.__patterns.handlebars_open.read(),C=this._create_token(n.TAG_OPEN,A))),C},O.prototype._read_close=function(S,x){var A=null,C=null;return x&&(x.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(A=this._input.next(),S==="/"&&(A+=this._input.next()),C=this._create_token(n.TAG_CLOSE,A)):x.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),C=this._create_token(n.TAG_CLOSE,"}}"))),C},O.prototype._read_attribute=function(S,x,A){var C=null,b="";if(A&&A.text[0]==="<")if(S==="=")C=this._create_token(n.EQUALS,this._input.next());else if(S==='"'||S==="'"){var v=this._input.next();S==='"'?v+=this.__patterns.double_quote.read():v+=this.__patterns.single_quote.read(),C=this._create_token(n.VALUE,v)}else b=this.__patterns.attribute.read(),b&&(x.type===n.EQUALS?C=this._create_token(n.VALUE,b):C=this._create_token(n.ATTRIBUTE,b));return C},O.prototype._is_content_unformatted=function(S){return this._options.void_elements.indexOf(S)===-1&&(this._options.content_unformatted.indexOf(S)!==-1||this._options.unformatted.indexOf(S)!==-1)},O.prototype._read_raw_content=function(S,x,A){var C="";if(A&&A.text[0]==="{")C=this.__patterns.handlebars_raw_close.read();else if(x.type===n.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var b=x.opened.text.substr(1).toLowerCase();if(b==="script"||b==="style"){var v=this._read_comment_or_cdata(S);if(v)return v.type=n.TEXT,v;C=this._input.readUntil(new RegExp("</"+b+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(b)&&(C=this._input.readUntil(new RegExp("</"+b+"[\\n\\r\\t ]*?>","ig")))}return C?this._create_token(n.TEXT,C):null},O.prototype._read_content_word=function(S){var x="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(n.TEXT,x)},g.exports.Tokenizer=O,g.exports.TOKEN=n}],F={};function D(g){var f=F[g];if(f!==void 0)return f.exports;var u=F[g]={exports:{}};return H[g](u,u.exports,D),u.exports}var I=D(18);M=I})();var z=M;if(!0)!(q=[W,W("6UM0"),W("TXwP")],V=function(H){var F=W("6UM0"),D=W("TXwP");return{html_beautify:function(I,g){return z(I,g,F.js_beautify,D.css_beautify)}}}.apply(Se,q),V!==void 0&&(Fe.exports=V));else var U,L})()},"qJ4+":function(Fe,Se,W){},"rAM+":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return V});var q=W("Qw5x");function V(M,z){var U;if(typeof Symbol=="undefined"||M[Symbol.iterator]==null){if(Array.isArray(M)||(U=Object(q.a)(M))||z&&M&&typeof M.length=="number"){U&&(M=U);var L=0,H=function(){};return{s:H,n:function(){return L>=M.length?{done:!0}:{done:!1,value:M[L++]}},e:function(f){throw f},f:H}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var F=!0,D=!1,I;return{s:function(){U=M[Symbol.iterator]()},n:function(){var f=U.next();return F=f.done,f},e:function(f){D=!0,I=f},f:function(){try{!F&&U.return!=null&&U.return()}finally{if(D)throw I}}}}},rUJ1:function(Fe,Se){const W=/[&<>"']/,q=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,M=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},U=C=>z[C];function L(C,b){if(b){if(W.test(C))return C.replace(q,U)}else if(V.test(C))return C.replace(M,U);return C}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(C){return C.replace(H,(b,v)=>(v=v.toLowerCase(),v==="colon"?":":v.charAt(0)==="#"?v.charAt(1)==="x"?String.fromCharCode(parseInt(v.substring(2),16)):String.fromCharCode(+v.substring(1)):""))}const D=/(^|[^\[])\^/g;function I(C,b){C=C.source||C,b=b||"";const v={replace:(p,c)=>(c=c.source||c,c=c.replace(D,"$1"),C=C.replace(p,c),v),getRegex:()=>new RegExp(C,b)};return v}const g=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(C,b,v){if(C){let p;try{p=decodeURIComponent(F(v)).replace(g,"").toLowerCase()}catch(c){return null}if(p.indexOf("javascript:")===0||p.indexOf("vbscript:")===0||p.indexOf("data:")===0)return null}b&&!f.test(v)&&(v=a(b,v));try{v=encodeURI(v).replace(/%25/g,"%")}catch(p){return null}return v}const d={},s=/^[^:]+:\/*[^/]*$/,l=/^([^:]+:)[\s\S]*$/,r=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(C,b){d[" "+C]||(s.test(C)?d[" "+C]=C+"/":d[" "+C]=S(C,"/",!0)),C=d[" "+C];const v=C.indexOf(":")===-1;return b.substring(0,2)==="//"?v?b:C.replace(l,"$1")+b:b.charAt(0)==="/"?v?b:C.replace(r,"$1")+b:C+b}const n={exec:function(){}};function h(C){let b=1,v,p;for(;b<arguments.length;b++){v=arguments[b];for(p in v)Object.prototype.hasOwnProperty.call(v,p)&&(C[p]=v[p])}return C}function O(C,b){const v=C.replace(/\|/g,(E,y,_)=>{let P=!1,N=y;for(;--N>=0&&_[N]==="\\";)P=!P;return P?"|":" |"}),p=v.split(/ \|/);let c=0;if(p.length>b)p.splice(b);else for(;p.length<b;)p.push("");for(;c<p.length;c++)p[c]=p[c].trim().replace(/\\\|/g,"|");return p}function S(C,b,v){const p=C.length;if(p===0)return"";let c=0;for(;c<p;){const E=C.charAt(p-c-1);if(E===b&&!v)c++;else if(E!==b&&v)c++;else break}return C.substr(0,p-c)}function x(C,b){if(C.indexOf(b[1])===-1)return-1;const v=C.length;let p=0,c=0;for(;c<v;c++)if(C[c]==="\\")c++;else if(C[c]===b[0])p++;else if(C[c]===b[1]&&(p--,p<0))return c;return-1}function A(C){C&&C.sanitize&&!C.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")}Fe.exports={escape:L,unescape:F,edit:I,cleanUrl:u,resolveUrl:a,noopTest:n,merge:h,splitCells:O,rtrim:S,findClosingBracket:x,checkSanitizeDeprecation:A}},rdUC:function(Fe,Se,W){var q=W("MFOe"),V=q.Global;Fe.exports={name:"localStorage",read:z,write:U,each:L,remove:H,clearAll:F};function M(){return V.localStorage}function z(D){return M().getItem(D)}function U(D,I){return M().setItem(D,I)}function L(D){for(var I=M().length-1;I>=0;I--){var g=M().key(I);D(z(g),g)}}function H(D){return M().removeItem(D)}function F(){return M().clear()}},sR1s:function(Fe,Se,W){"use strict";W.d(Se,"b",function(){return z}),W.d(Se,"a",function(){return U}),W.d(Se,"c",function(){return L}),W.d(Se,"d",function(){return H});var q=W("U8pU"),V="RC_TABLE_KEY";function M(F){return F==null?[]:Array.isArray(F)?F:[F]}function z(F,D){if(!D&&typeof D!="number")return F;for(var I=M(D),g=F,f=0;f<I.length;f+=1){if(!g)return null;var u=I[f];g=g[u]}return g}function U(F){var D=[],I={};return F.forEach(function(g){for(var f=g||{},u=f.key,d=f.dataIndex,s=u||M(d).join("-")||V;I[s];)s="".concat(s,"_next");I[s]=!0,D.push(s)}),D}function L(){var F={};function D(u,d){d&&Object.keys(d).forEach(function(s){var l=d[s];l&&Object(q.a)(l)==="object"?(u[s]=u[s]||{},D(u[s],l)):u[s]=l})}for(var I=arguments.length,g=new Array(I),f=0;f<I;f++)g[f]=arguments[f];return g.forEach(function(u){D(F,u)}),F}function H(F){return F!=null}},sboe:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return M});var q=W("q1tI"),V=W.n(q),M=q.createContext(null)},"t/PP":function(Fe,Se,W){Fe.exports=W.p+"static/title.dd3b799f.svg"},t23M:function(Fe,Se,W){"use strict";var q=W("VTBJ"),V=W("1OyB"),M=W("vuIU"),z=W("Ji7U"),U=W("LK+K"),L=W("q1tI"),H=W.n(L),F=W("m+aA"),D=W("Zm9Q"),I=W("Kwbf"),g=W("c+Xe"),f=W("bdgK"),u="rc-observer-key",d=function(s){Object(z.a)(r,s);var l=Object(U.a)(r);function r(){var a;return Object(V.a)(this,r),a=l.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(n){var h=a.props.onResize,O=n[0].target,S=O.getBoundingClientRect(),x=S.width,A=S.height,C=O.offsetWidth,b=O.offsetHeight,v=Math.floor(x),p=Math.floor(A);if(a.state.width!==v||a.state.height!==p||a.state.offsetWidth!==C||a.state.offsetHeight!==b){var c={width:v,height:p,offsetWidth:C,offsetHeight:b};a.setState(c),h&&Promise.resolve().then(function(){h(Object(q.a)(Object(q.a)({},c),{},{offsetWidth:C,offsetHeight:b}))})}},a.setChildNode=function(n){a.childNode=n},a}return Object(M.a)(r,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var n=this.props.disabled;if(n){this.destroyObserver();return}var h=Object(F.a)(this.childNode||this),O=h!==this.currentElement;O&&(this.destroyObserver(),this.currentElement=h),!this.resizeObserver&&h&&(this.resizeObserver=new f.default(this.onResize),this.resizeObserver.observe(h))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var n=this.props.children,h=Object(D.a)(n);if(h.length>1)Object(I.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(h.length===0)return Object(I.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var O=h[0];if(L.isValidElement(O)&&Object(g.c)(O)){var S=O.ref;h[0]=L.cloneElement(O,{ref:Object(g.a)(S,this.setChildNode)})}return h.length===1?h[0]:h.map(function(x,A){return!L.isValidElement(x)||"key"in x&&x.key!==null?x:L.cloneElement(x,{key:"".concat(u,"-").concat(A)})})}}]),r}(L.Component);d.displayName="ResizeObserver",Se.a=d},uD2n:function(Fe,Se,W){Fe.exports={"dis-input-editor-container":"dis-input-editor-container___3uf7A",active:"active___20tmT","input-mask":"input-mask___1kijM","text-area":"text-area___2gTEA","tip-container":"tip-container___2tKkE",hide:"hide___3jIwM","md-container":"md-container___14zRI","btn-send":"btn-send___3TabT"}},uMZB:function(Fe,Se,W){Fe.exports={header:"header___3a50V",checkboxs:"checkboxs___3TnBC",field:"field___SHW6f","oj-form-container":"oj-form-container___36KBv","oj-left-panel":"oj-left-panel___3Fdj5","oj-form-info":"oj-form-info___dilPb",footer:"footer___1Ie9U","test-case-name":"test-case-name___356US","btn-remove-case":"btn-remove-case___1Z5cd","icon-tag":"icon-tag___3zUaP",btn_back:"btn_back___2UBbR",testJi:"testJi___1dyLk",upBtn:"upBtn___1I0SJ"}},uQRt:function(Fe,Se,W){Fe.exports=q;function q(){return W("gaXo"),{}}},ulZh:function(Fe,Se,W){typeof window!="undefined"&&function(V,M){Fe.exports=M()}(this,function(){return function(q){var V={};function M(z){if(V[z])return V[z].exports;var U=V[z]={i:z,l:!1,exports:{}};return q[z].call(U.exports,U,U.exports,M),U.l=!0,U.exports}return M.m=q,M.c=V,M.d=function(z,U,L){M.o(z,U)||Object.defineProperty(z,U,{enumerable:!0,get:L})},M.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},M.t=function(z,U){if(U&1&&(z=M(z)),U&8)return z;if(U&4&&typeof z=="object"&&z&&z.__esModule)return z;var L=Object.create(null);if(M.r(L),Object.defineProperty(L,"default",{enumerable:!0,value:z}),U&2&&typeof z!="string")for(var H in z)M.d(L,H,function(F){return z[F]}.bind(null,H));return L},M.n=function(z){var U=z&&z.__esModule?function(){return z.default}:function(){return z};return M.d(U,"a",U),U},M.o=function(z,U){return Object.prototype.hasOwnProperty.call(z,U)},M.p="/dist/",M(M.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,V,M){"use strict";var z=Object.prototype.hasOwnProperty,U="~";function L(){}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(U=!1));function H(g,f,u){this.fn=g,this.context=f,this.once=u||!1}function F(g,f,u,d,s){if(typeof u!="function")throw new TypeError("The listener must be a function");var l=new H(u,d||g,s),r=U?U+f:f;return g._events[r]?g._events[r].fn?g._events[r]=[g._events[r],l]:g._events[r].push(l):(g._events[r]=l,g._eventsCount++),g}function D(g,f){--g._eventsCount===0?g._events=new L:delete g._events[f]}function I(){this._events=new L,this._eventsCount=0}I.prototype.eventNames=function(){var f=[],u,d;if(this._eventsCount===0)return f;for(d in u=this._events)z.call(u,d)&&f.push(U?d.slice(1):d);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(u)):f},I.prototype.listeners=function(f){var u=U?U+f:f,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var s=0,l=d.length,r=new Array(l);s<l;s++)r[s]=d[s].fn;return r},I.prototype.listenerCount=function(f){var u=U?U+f:f,d=this._events[u];return d?d.fn?1:d.length:0},I.prototype.emit=function(f,u,d,s,l,r){var a=U?U+f:f;if(!this._events[a])return!1;var n=this._events[a],h=arguments.length,O,S;if(n.fn){n.once&&this.removeListener(f,n.fn,void 0,!0);switch(h){case 1:return n.fn.call(n.context),!0;case 2:return n.fn.call(n.context,u),!0;case 3:return n.fn.call(n.context,u,d),!0;case 4:return n.fn.call(n.context,u,d,s),!0;case 5:return n.fn.call(n.context,u,d,s,l),!0;case 6:return n.fn.call(n.context,u,d,s,l,r),!0}for(S=1,O=new Array(h-1);S<h;S++)O[S-1]=arguments[S];n.fn.apply(n.context,O)}else{var x=n.length,A;for(S=0;S<x;S++){n[S].once&&this.removeListener(f,n[S].fn,void 0,!0);switch(h){case 1:n[S].fn.call(n[S].context);break;case 2:n[S].fn.call(n[S].context,u);break;case 3:n[S].fn.call(n[S].context,u,d);break;case 4:n[S].fn.call(n[S].context,u,d,s);break;default:if(!O)for(A=1,O=new Array(h-1);A<h;A++)O[A-1]=arguments[A];n[S].fn.apply(n[S].context,O)}}}return!0},I.prototype.on=function(f,u,d){return F(this,f,u,d,!1)},I.prototype.once=function(f,u,d){return F(this,f,u,d,!0)},I.prototype.removeListener=function(f,u,d,s){var l=U?U+f:f;if(!this._events[l])return this;if(!u)return D(this,l),this;var r=this._events[l];if(r.fn)r.fn===u&&(!s||r.once)&&(!d||r.context===d)&&D(this,l);else{for(var a=0,n=[],h=r.length;a<h;a++)(r[a].fn!==u||s&&!r[a].once||d&&r[a].context!==d)&&n.push(r[a]);n.length?this._events[l]=n.length===1?n[0]:n:D(this,l)}return this},I.prototype.removeAllListeners=function(f){var u;return f?(u=U?U+f:f,this._events[u]&&D(this,u)):(this._events=new L,this._eventsCount=0),this},I.prototype.off=I.prototype.removeListener,I.prototype.addListener=I.prototype.on,I.prefixed=U,I.EventEmitter=I,q.exports=I},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,V,M){(function(z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,L=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(I,g,f){if(f=f||{},I=I.trim(),g=g.trim(),!g){if(!f.alwaysNormalize)return I;var u=D.parseURL(I);if(!u)throw new Error("Error trying to parse base URL.");return u.path=D.normalizePath(u.path),D.buildURLFromParts(u)}var d=D.parseURL(g);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return f.alwaysNormalize?(d.path=D.normalizePath(d.path),D.buildURLFromParts(d)):g;var s=D.parseURL(I);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&s.path[0]!=="/"){var l=L.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var r={scheme:s.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(r.netLoc=s.netLoc,d.path[0]!=="/"))if(!d.path)r.path=s.path,d.params||(r.params=s.params,d.query||(r.query=s.query));else{var a=s.path,n=a.substring(0,a.lastIndexOf("/")+1)+d.path;r.path=D.normalizePath(n)}return r.path===null&&(r.path=f.alwaysNormalize?D.normalizePath(d.path):d.path),D.buildURLFromParts(r)},parseURL:function(I){var g=U.exec(I);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(I){for(I=I.split("").reverse().join("").replace(H,"");I.length!==(I=I.replace(F,"")).length;);return I.split("").reverse().join("")},buildURLFromParts:function(I){return I.scheme+I.netLoc+I.path+I.params+I.query+I.fragment}};q.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(q,V,M){function z(f){var u={};function d(l){if(u[l])return u[l].exports;var r=u[l]={i:l,l:!1,exports:{}};return f[l].call(r.exports,r,r.exports,d),r.l=!0,r.exports}d.m=f,d.c=u,d.i=function(l){return l},d.d=function(l,r,a){d.o(l,r)||Object.defineProperty(l,r,{configurable:!1,enumerable:!0,get:a})},d.r=function(l){Object.defineProperty(l,"__esModule",{value:!0})},d.n=function(l){var r=l&&l.__esModule?function(){return l.default}:function(){return l};return d.d(r,"a",r),r},d.o=function(l,r){return Object.prototype.hasOwnProperty.call(l,r)},d.p="/",d.oe=function(l){throw console.error(l),l};var s=d(d.s=ENTRY_MODULE);return s.default||s}var U="[\\.|\\-|\\+|\\w|/|@]+",L="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function H(f){return(f+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(f){return!isNaN(1*f)}function D(f,u,d){var s={};s[d]=[];var l=u.toString(),r=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!r)return s;for(var a=r[1],n=new RegExp("(\\\\n|\\W)"+H(a)+L,"g"),h;h=n.exec(l);){if(h[3]==="dll-reference")continue;s[d].push(h[3])}for(n=new RegExp("\\("+H(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+L,"g");h=n.exec(l);)f[h[2]]||(s[d].push(h[1]),f[h[2]]=M(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var O=Object.keys(s),S=0;S<O.length;S++)for(var x=0;x<s[O[S]].length;x++)F(s[O[S]][x])&&(s[O[S]][x]=1*s[O[S]][x]);return s}function I(f){var u=Object.keys(f);return u.reduce(function(d,s){return d||f[s].length>0},!1)}function g(f,u){for(var d={main:[u]},s={main:[]},l={main:{}};I(d);)for(var r=Object.keys(d),a=0;a<r.length;a++){var n=r[a],h=d[n],O=h.pop();if(l[n]=l[n]||{},l[n][O]||!f[n][O])continue;l[n][O]=!0,s[n]=s[n]||[],s[n].push(O);for(var S=D(f,f[n][O],n),x=Object.keys(S),A=0;A<x.length;A++)d[x[A]]=d[x[A]]||[],d[x[A]]=d[x[A]].concat(S[x[A]])}return s}q.exports=function(f,u){u=u||{};var d={main:M.m},s=u.all?{main:Object.keys(d.main)}:g(d,f),l="";Object.keys(s).filter(function(O){return O!=="main"}).forEach(function(O){for(var S=0;s[O][S];)S++;s[O].push(S),d[O][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+O+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+s[O].map(function(x){return""+JSON.stringify(x)+": "+d[O][x].toString()}).join(",")+`});
|
|
`}),l=l+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+s.main.map(function(O){return""+JSON.stringify(O)+": "+d.main[O].toString()}).join(",")+"}))(self);";var r=new window.Blob([l],{type:"text/javascript"});if(u.bare)return r;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,n=a.createObjectURL(r),h=new window.Worker(n);return h.objectURL=n,h}},"./src/config.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"hlsDefaultConfig",function(){return A}),M.d(V,"mergeConfig",function(){return b}),M.d(V,"enableStreamingMode",function(){return v});var z=M("./src/controller/abr-controller.ts"),U=M("./src/controller/audio-stream-controller.ts"),L=M("./src/controller/audio-track-controller.ts"),H=M("./src/controller/subtitle-stream-controller.ts"),F=M("./src/controller/subtitle-track-controller.ts"),D=M("./src/controller/buffer-controller.ts"),I=M("./src/controller/timeline-controller.ts"),g=M("./src/controller/cap-level-controller.ts"),f=M("./src/controller/fps-controller.ts"),u=M("./src/controller/eme-controller.ts"),d=M("./src/controller/cmcd-controller.ts"),s=M("./src/utils/xhr-loader.ts"),l=M("./src/utils/fetch-loader.ts"),r=M("./src/utils/cues.ts"),a=M("./src/utils/mediakeys-helper.ts"),n=M("./src/utils/logger.ts");function h(){return h=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var E=arguments[c];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(p[y]=E[y])}return p},h.apply(this,arguments)}function O(p,c){var E=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);c&&(y=y.filter(function(_){return Object.getOwnPropertyDescriptor(p,_).enumerable})),E.push.apply(E,y)}return E}function S(p){for(var c=1;c<arguments.length;c++){var E=arguments[c]!=null?arguments[c]:{};c%2?O(Object(E),!0).forEach(function(y){x(p,y,E[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(E)):O(Object(E)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(E,y))})}return p}function x(p,c,E){return c in p?Object.defineProperty(p,c,{value:E,enumerable:!0,configurable:!0,writable:!0}):p[c]=E,p}var A=S(S({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:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:D.default,capLevelController:g.default,fpsController:f.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},C()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:F.default,timelineController:I.TimelineController,audioStreamController:U.default,audioTrackController:L.default,emeController:u.default,cmcdController:d.default});function C(){return{cueHandler:r.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 b(p,c){if((c.liveSyncDurationCount||c.liveMaxLatencyDurationCount)&&(c.liveSyncDuration||c.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(c.liveMaxLatencyDurationCount!==void 0&&(c.liveSyncDurationCount===void 0||c.liveMaxLatencyDurationCount<=c.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(c.liveMaxLatencyDuration!==void 0&&(c.liveSyncDuration===void 0||c.liveMaxLatencyDuration<=c.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},p,c)}function v(p){var c=p.loader;if(c!==l.default&&c!==s.default)n.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),p.progressive=!1;else{var E=Object(l.fetchSupported)();E&&(p.loader=l.default,p.progressive=!0,p.enableSoftwareAES=!0,n.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/polyfills/number.ts"),U=M("./src/utils/ewma-bandwidth-estimator.ts"),L=M("./src/events.ts"),H=M("./src/utils/buffer-helper.ts"),F=M("./src/errors.ts"),D=M("./src/types/loader.ts"),I=M("./src/utils/logger.ts");function g(d,s){for(var l=0;l<s.length;l++){var r=s[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(d,r.key,r)}}function f(d,s,l){return s&&g(d.prototype,s),l&&g(d,l),d}var u=function(){function d(l){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=l;var r=l.config;this.bwEstimator=new U.default(r.abrEwmaSlowVoD,r.abrEwmaFastVoD,r.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var r=this.hls;r.on(L.Events.FRAG_LOADING,this.onFragLoading,this),r.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),r.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),r.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(L.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var r=this.hls;r.off(L.Events.FRAG_LOADING,this.onFragLoading,this),r.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),r.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(L.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(r,a){var n=a.frag;if(n.type===D.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=n,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},s.onLevelLoaded=function(r,a){var n=this.hls.config;a.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var r=this.fragCurrent,a=this.partCurrent,n=this.hls,h=n.autoLevelEnabled,O=n.config,S=n.media;if(!r||!S)return;var x=a?a.stats:r.stats,A=a?a.duration:r.duration;if(x.aborted){I.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||S.paused||!S.playbackRate||!S.readyState)return;var C=performance.now()-x.loading.start,b=Math.abs(S.playbackRate);if(C<=500*A/b)return;var v=n.levels,p=n.minAutoLevel,c=v[r.level],E=x.total||Math.max(x.loaded,Math.round(A*c.maxBitrate/8)),y=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/C),_=(E-x.loaded)/y,P=S.currentTime,N=(H.BufferHelper.bufferInfo(S,P,O.maxBufferHole).end-P)/b;if(N>=2*A/b||_<=N)return;var K=Number.POSITIVE_INFINITY,$;for($=r.level-1;$>p;$--){var B=v[$].maxBitrate;if(K=A*B/(8*.8*y),K<N)break}if(K>=_)return;var R=this.bwEstimator.getEstimate();I.logger.warn("Fragment "+r.sn+(a?" part "+a.index:"")+" of level "+r.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+$+`
|
|
Current BW estimate: `+(Object(z.isFiniteNumber)(R)?(R/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+_.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+K.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),n.nextLoadLevel=$,this.bwEstimator.sample(C,x.loaded),this.clearTimer(),r.loader&&(this.fragCurrent=this.partCurrent=null,r.loader.abort()),n.trigger(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:a,stats:x})},s.onFragLoaded=function(r,a){var n=a.frag,h=a.part;if(n.type===D.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(n.sn)){var O=h?h.stats:n.stats,S=h?h.duration:n.duration;if(this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[n.level],A=(x.loaded?x.loaded.bytes:0)+O.loaded,C=(x.loaded?x.loaded.duration:0)+S;x.loaded={bytes:A,duration:C},x.realBitrate=Math.round(8*A/C)}if(n.bitrateTest){var b={stats:O,frag:n,part:h,id:n.type};this.onFragBuffered(L.Events.FRAG_BUFFERED,b),n.bitrateTest=!1}}},s.onFragBuffered=function(r,a){var n=a.frag,h=a.part,O=h?h.stats:n.stats;if(O.aborted)return;if(n.type!==D.PlaylistLevelType.MAIN||n.sn==="initSegment")return;var S=O.parsing.end-O.loading.start;this.bwEstimator.sample(S,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},s.onError=function(r,a){switch(a.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var r=this.fragCurrent,a=this.partCurrent,n=this.hls,h=n.maxAutoLevel,O=n.config,S=n.minAutoLevel,x=n.media,A=a?a.duration:r?r.duration:0,C=x?x.currentTime:0,b=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,v=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,p=(H.BufferHelper.bufferInfo(x,C,O.maxBufferHole).end-C)/b,c=this.findBestLevel(v,S,h,p,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(c>=0)return c;I.logger.trace((p?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=A?Math.min(A,O.maxStarvationDelay):O.maxStarvationDelay,y=O.abrBandWidthFactor,_=O.abrBandWidthUpFactor;if(!p){var P=this.bitrateTestDelay;if(P){var N=A?Math.min(A,O.maxLoadingDelay):O.maxLoadingDelay;E=N-P,I.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),y=_=1}}return c=this.findBestLevel(v,S,h,p+E,y,_),Math.max(c,0)},s.findBestLevel=function(r,a,n,h,O,S){for(var x,A=this.fragCurrent,C=this.partCurrent,b=this.lastLoadedFragLevel,v=this.hls.levels,p=v[b],c=!!(p!=null&&(x=p.details)!==null&&x!==void 0&&x.live),E=p==null?void 0:p.codecSet,y=C?C.duration:A?A.duration:0,_=n;_>=a;_--){var P=v[_];if(!P||E&&P.codecSet!==E)continue;var N=P.details,K=(C?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||y,$=void 0;_<=b?$=O*r:$=S*r;var B=v[_].maxBitrate,R=B*K/$;if(I.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round($)+"/"+B+"/"+K+"/"+h+"/"+R),$>B&&(!R||c&&!this.bitrateTestDelay||R<h))return _}return-1},f(d,[{key:"nextAutoLevel",get:function(){var r=this._nextAutoLevel,a=this.bwEstimator;if(r!==-1&&(!a||!a.canEstimate()))return r;var n=this.getNextABRAutoLevel();return r!==-1&&(n=Math.min(r,n)),n},set:function(r){this._nextAutoLevel=r}}]),d}();V.default=u},"./src/controller/audio-stream-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/polyfills/number.ts"),U=M("./src/controller/base-stream-controller.ts"),L=M("./src/events.ts"),H=M("./src/utils/buffer-helper.ts"),F=M("./src/controller/fragment-tracker.ts"),D=M("./src/types/level.ts"),I=M("./src/types/loader.ts"),g=M("./src/loader/fragment.ts"),f=M("./src/demux/chunk-cache.ts"),u=M("./src/demux/transmuxer-interface.ts"),d=M("./src/types/transmuxer.ts"),s=M("./src/controller/fragment-finders.ts"),l=M("./src/utils/discontinuities.ts"),r=M("./src/errors.ts"),a=M("./src/utils/logger.ts");function n(){return n=Object.assign||function(A){for(var C=1;C<arguments.length;C++){var b=arguments[C];for(var v in b)Object.prototype.hasOwnProperty.call(b,v)&&(A[v]=b[v])}return A},n.apply(this,arguments)}function h(A,C){A.prototype=Object.create(C.prototype),A.prototype.constructor=A,O(A,C)}function O(A,C){return O=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},O(A,C)}var S=100,x=function(A){h(C,A);function C(v,p){var c;return c=A.call(this,v,p,"[audio-stream-controller]")||this,c.videoBuffer=null,c.videoTrackCC=-1,c.waitingVideoCC=-1,c.audioSwitch=!1,c.trackId=-1,c.waitingData=null,c.mainDetails=null,c.bufferFlushed=!1,c._registerListeners(),c}var b=C.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var p=this.hls;p.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),p.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.on(L.Events.ERROR,this.onError,this),p.on(L.Events.BUFFER_RESET,this.onBufferReset,this),p.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),p.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var p=this.hls;p.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),p.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.off(L.Events.ERROR,this.onError,this),p.off(L.Events.BUFFER_RESET,this.onBufferReset,this),p.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),p.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onInitPtsFound=function(p,c){var E=c.frag,y=c.id,_=c.initPTS;if(y==="main"){var P=E.cc;this.initPTS[E.cc]=_,this.log("InitPTS for cc: "+P+" found from main: "+_),this.videoTrackCC=P,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},b.startLoad=function(p){if(!this.levels){this.startPosition=p,this.state=U.State.STOPPED;return}var c=this.lastCurrentTime;this.stopLoad(),this.setInterval(S),this.fragLoadError=0,c>0&&p===-1?(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()},b.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var p,c=this.levels,E=this.trackId,y=c==null||((p=c[E])===null||p===void 0)?void 0:p.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var _,P=performance.now(),N=this.retryDate;(!N||P>=N||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var $=K.frag,B=K.part,R=K.cache,G=K.complete;if(this.initPTS[$.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var Q=R.flush(),ne={frag:$,part:B,payload:Q,networkDetails:null};this._handleFragmentLoadProgress(ne),G&&A.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+$.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var le=this.getLoadPosition(),_e=H.BufferHelper.bufferInfo(this.mediaBuffer,le,this.config.maxBufferHole),pe=Object(s.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,$);pe<0&&(a.logger.log("Waiting fragment cc ("+$.cc+") @ "+$.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},b.clearWaitingFragment=function(){var p=this.waitingData;p&&(this.fragmentTracker.removeFragment(p.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},b.onTickEnd=function(){var p=this.media;if(!p||!p.readyState)return;var c=this.mediaBuffer?this.mediaBuffer:p,E=c.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=p.currentTime},b.doTickIdle=function(){var p,c,E=this.hls,y=this.levels,_=this.media,P=this.trackId,N=E.config;if(!y||!y[P])return;if(!_&&(this.startFragRequested||!N.startFragPrefetch))return;var K=y[P],$=K.details;if(!$||$.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn($)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,I.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,I.PlaylistLevelType.AUDIO);if(B===null)return;var R=B.len,G=this.getMaxBufferLength(),Q=this.audioSwitch;if(R>=G&&!Q)return;if(!Q&&this._streamEnded(B,$)){E.trigger(L.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ne=$.fragments,le=ne[0].start,_e=B.end;if(Q){var pe=this.getLoadPosition();_e=pe,$.PTSKnown&&pe<le&&((B.end>le||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=le+.05))}var Ee=this.getNextFragment(_e,$);if(!Ee){this.bufferFlushed=!0;return}((p=Ee.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((c=Ee.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(Ee,$):this.loadFragment(Ee,$,_e)},b.getMaxBufferLength=function(){var p=A.prototype.getMaxBufferLength.call(this),c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,I.PlaylistLevelType.MAIN);return c===null?p:Math.max(p,c.len)},b.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(p,c){var E=c.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(y){return new D.Level(y)})},b.onAudioTrackSwitching=function(p,c){var E=!!c.url;this.trackId=c.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(S):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},b.onLevelLoaded=function(p,c){this.mainDetails=c.details},b.onAudioTrackLoaded=function(p,c){var E,y=this.levels,_=c.details,P=c.id;if(!y){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var N=y[P],K=0;if(_.live||(E=N.details)!==null&&E!==void 0&&E.live){var $=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!$)return;!N.details&&_.hasProgramDateTime&&$.hasProgramDateTime?(Object(l.alignMediaPlaylistByPDT)(_,$),K=_.fragments[0].start):K=this.alignPlaylists(_,N.details)}N.details=_,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(N.details,K),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=U.State.IDLE),this.tick()},b._handleFragmentLoadProgress=function(p){var c,E=p.frag,y=p.part,_=p.payload,P=this.config,N=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var $=K[N];console.assert($,"Audio track is defined on fragment load progress");var B=$.details;console.assert(B,"Audio track details are defined on fragment load progress");var R=P.defaultAudioCodec||$.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new u.default(this.hls,I.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Q=this.initPTS[E.cc],ne=(c=E.initSegment)===null||c===void 0?void 0:c.data;if(Q!==void 0){var le=!1,_e=y?y.index:-1,pe=_e!==-1,Ee=new d.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,_.byteLength,_e,pe);G.push(_,ne,R,"",E,y,B.totalduration,le,Ee,Q)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+N);var Oe=this.waitingData=this.waitingData||{frag:E,part:y,cache:new f.default,complete:!1},we=Oe.cache;we.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},b._handleFragmentLoadComplete=function(p){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,p)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(p,c){var E=c.tracks.audio;E&&(this.mediaBuffer=E.buffer),c.tracks.video&&(this.videoBuffer=c.tracks.video.buffer)},b.onFragBuffered=function(p,c){var E=c.frag,y=c.part;if(E.type!==I.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(y?" p: "+y.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,y)},b.onError=function(p,c){switch(c.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.AUDIO,c);break;case r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=c.fatal?U.State.ERROR:U.State.IDLE,this.warn(c.details+" while loading frag, switching to "+this.state+" state"));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var E=!0,y=this.getFwdBufferInfo(this.mediaBuffer,I.PlaylistLevelType.AUDIO);y&&y.len>.5&&(E=!this.reduceMaxBufferLength(y.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},b.onBufferFlushed=function(p,c){var E=c.type;E===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},b._handleTransmuxComplete=function(p){var c,E="audio",y=this.hls,_=p.remuxResult,P=p.chunkMeta,N=this.getCurrentContext(P);if(!N){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var K=N.frag,$=N.part,B=_.audio,R=_.text,G=_.id3,Q=_.initSegment;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),Q!=null&&Q.tracks&&(this._bufferInitSegment(Q.tracks,K,P),y.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:E,tracks:Q.tracks})),B){var ne=B.startPTS,le=B.endPTS,_e=B.startDTS,pe=B.endDTS;$&&($.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:le,startDTS:_e,endDTS:pe}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ne,le,_e,pe),this.bufferFragmentData(B,K,$,P)}if(G!=null&&(c=G.samples)!==null&&c!==void 0&&c.length){var Ee=n({frag:K,id:E},G);y.trigger(L.Events.FRAG_PARSING_METADATA,Ee)}if(R){var Oe=n({frag:K,id:E},R);y.trigger(L.Events.FRAG_PARSING_USERDATA,Oe)}},b._bufferInitSegment=function(p,c,E){if(this.state!==U.State.PARSING)return;p.video&&delete p.video;var y=p.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,p);var _=y.initSegment;if(_!=null&&_.byteLength){var P={type:"audio",frag:c,part:null,chunkMeta:E,parent:c.type,data:_};this.hls.trigger(L.Events.BUFFER_APPENDING,P)}this.tick()},b.loadFragment=function(p,c,E){var y=this.fragmentTracker.getState(p);this.fragCurrent=p,(this.audioSwitch||y===F.FragmentState.NOT_LOADED||y===F.FragmentState.PARTIAL)&&(p.sn==="initSegment"?this._loadInitSegment(p):c.live&&!Object(z.isFiniteNumber)(this.initPTS[p.cc])?(this.log("Waiting for video PTS in continuity counter "+p.cc+" of live stream before loading audio fragment "+p.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,p,c,E)))},b.completeAudioSwitch=function(){var p=this.hls,c=this.media,E=this.trackId;c&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,p.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:E})},C}(U.default);V.default=x},"./src/controller/audio-track-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts"),U=M("./src/errors.ts"),L=M("./src/controller/base-playlist-controller.ts"),H=M("./src/types/loader.ts");function F(u,d){for(var s=0;s<d.length;s++){var l=d[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,l.key,l)}}function D(u,d,s){return d&&F(u.prototype,d),s&&F(u,s),u}function I(u,d){u.prototype=Object.create(d.prototype),u.prototype.constructor=u,g(u,d)}function g(u,d){return g=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},g(u,d)}var f=function(u){I(d,u);function d(l){var r;return r=u.call(this,l,"[audio-track-controller]")||this,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.trackName="",r.selectDefaultTrack=!0,r.registerListeners(),r}var s=d.prototype;return s.registerListeners=function(){var r=this.hls;r.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.on(z.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var r=this.hls;r.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.off(z.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,u.prototype.destroy.call(this)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},s.onManifestParsed=function(r,a){this.tracks=a.audioTracks||[]},s.onAudioTrackLoaded=function(r,a){var n=a.id,h=a.details,O=this.tracksInGroup[n];if(!O){this.warn("Invalid audio track id "+n);return}var S=O.details;O.details=a.details,this.log("audioTrack "+n+" loaded ["+h.startSN+"-"+h.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,a,S))},s.onLevelLoading=function(r,a){this.switchLevel(a.level)},s.onLevelSwitching=function(r,a){this.switchLevel(a.level)},s.switchLevel=function(r){var a=this.hls.levels[r];if(!(a!=null&&a.audioGroupIds))return;var n=a.audioGroupIds[a.urlId];if(this.groupId!==n){this.groupId=n;var h=this.tracks.filter(function(S){return!n||S.groupId===n});this.selectDefaultTrack&&!h.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var O={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,O),this.selectInitialTrack()}},s.onError=function(r,a){if(u.prototype.onError.call(this,r,a),a.fatal||!a.context)return;a.context.type===H.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},s.setAudioTrack=function(r){var a=this.tracksInGroup;if(r<0||r>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var n=a[this.trackId];this.log("Now switching to audio-track index "+r);var h=a[r],O=h.id,S=h.groupId,x=S===void 0?"":S,A=h.name,C=h.type,b=h.url;if(this.trackId=r,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:x,name:A,type:C,url:b}),h.details&&!h.details.live)return;var v=this.switchParams(h.url,n==null?void 0:n.details);this.loadPlaylist(v)},s.selectInitialTrack=function(){var r=this.tracksInGroup;console.assert(r.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,n=this.findTrackId(a)||this.findTrackId();n!==-1?this.setAudioTrack(n):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(r){for(var a=this.tracksInGroup,n=0;n<a.length;n++){var h=a[n];if((!this.selectDefaultTrack||h.default)&&(!r||r===h.name))return h.id}return-1},s.loadPlaylist=function(r){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var n=a.id,h=a.groupId,O=a.url;if(r)try{O=r.addDirectives(O)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+n),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:O,id:n,groupId:h,deliveryDirectives:r||null})}},D(d,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1,this.setAudioTrack(r)}}]),d}(L.default);V.default=f},"./src/controller/base-playlist-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return D});var z=M("./src/polyfills/number.ts"),U=M("./src/types/level.ts"),L=M("./src/controller/level-helper.ts"),H=M("./src/utils/logger.ts"),F=M("./src/errors.ts"),D=function(){function I(f,u){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,u+":"),this.warn=H.logger.warn.bind(H.logger,u+":"),this.hls=f}var g=I.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(u,d){d.fatal&&d.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(u,d){var s=d==null?void 0:d.renditionReports;if(s)for(var l=0;l<s.length;l++){var r=s[l],a=""+r.URI;if(a===u.substr(-a.length)){var n=parseInt(r["LAST-MSN"]),h=parseInt(r["LAST-PART"]);if(d&&this.hls.config.lowLatencyMode){var O=Math.min(d.age-d.partTarget,d.targetduration);h!==void 0&&O>d.partTarget&&(h+=1)}if(Object(z.isFiniteNumber)(n))return new U.HlsUrlParameters(n,Object(z.isFiniteNumber)(h)?h:void 0,U.HlsSkip.No)}}},g.loadPlaylist=function(u){},g.shouldLoadTrack=function(u){return this.canLoad&&u&&!!u.url&&(!u.details||u.details.live)},g.playlistLoaded=function(u,d,s){var l=this,r=d.details,a=d.stats,n=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(r.advancedDateTime=Date.now()-n,r.live||s!=null&&s.live){if(r.reloaded(s),s&&this.log("live playlist "+u+" "+(r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:"MISSED")),s&&r.fragments.length>0&&Object(L.mergeDetails)(s,r),!this.canLoad||!r.live)return;var h,O=void 0,S=void 0;if(r.canBlockReload&&r.endSN&&r.advanced){var x=this.hls.config.lowLatencyMode,A=r.lastPartSn,C=r.endSN,b=r.lastPartIndex,v=b!==-1,p=A===C,c=x?0:b;v?(O=p?C+1:A,S=p?c:b+1):O=C+1;var E=r.age,y=E+r.ageHeader,_=Math.min(y-r.partTarget,r.targetduration*1.5);if(_>0){if(s&&_>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+_+" with playlist age: "+r.age),_=0;else{var P=Math.floor(_/r.targetduration);if(O+=P,S!==void 0){var N=Math.round(_%r.targetduration/r.partTarget);S+=N}this.log("CDN Tune-in age: "+r.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+_+" skip sn "+P+" to part "+S)}r.tuneInGoal=_}if(h=this.getDeliveryDirectives(r,d.deliveryDirectives,O,S),x||!p){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(r,d.deliveryDirectives,O,S);var K=Object(L.computeReloadInterval)(r,a);O!==void 0&&r.canBlockReload&&(K-=r.partTarget||1),this.log("reload live playlist "+u+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return l.loadPlaylist(h)},K)}else this.clearTimer()},g.getDeliveryDirectives=function(u,d,s,l){var r=Object(U.getSkipValue)(u,s);return d!=null&&d.skip&&u.deltaUpdateFailed&&(s=d.msn,l=d.part,r=U.HlsSkip.No),new U.HlsUrlParameters(s,l,r)},g.retryLoadingOrFail=function(u){var d=this,s=this.hls.config,l=this.retryCount<s.levelLoadingMaxRetry;if(l){var r;if(this.retryCount++,u.details.indexOf("LoadTimeOut")>-1&&(r=u.context)!==null&&r!==void 0&&r.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+u.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return d.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+u.details+'"')}}else this.warn('cannot recover from error "'+u.details+'"'),this.clearTimer(),u.fatal=!0;return l},I}()},"./src/controller/base-stream-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"State",function(){return C}),M.d(V,"default",function(){return b});var z=M("./src/polyfills/number.ts"),U=M("./src/task-loop.ts"),L=M("./src/controller/fragment-tracker.ts"),H=M("./src/utils/buffer-helper.ts"),F=M("./src/utils/logger.ts"),D=M("./src/events.ts"),I=M("./src/errors.ts"),g=M("./src/types/transmuxer.ts"),f=M("./src/utils/mp4-tools.ts"),u=M("./src/utils/discontinuities.ts"),d=M("./src/controller/fragment-finders.ts"),s=M("./src/controller/level-helper.ts"),l=M("./src/loader/fragment-loader.ts"),r=M("./src/crypt/decrypter.ts"),a=M("./src/utils/time-ranges.ts"),n=M("./src/types/loader.ts");function h(v,p){for(var c=0;c<p.length;c++){var E=p[c];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(v,E.key,E)}}function O(v,p,c){return p&&h(v.prototype,p),c&&h(v,c),v}function S(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function x(v,p){v.prototype=Object.create(p.prototype),v.prototype.constructor=v,A(v,p)}function A(v,p){return A=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},A(v,p)}var C={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"},b=function(v){x(p,v);function p(E,y,_){var P;return P=v.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=C.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=_,P.log=F.logger.log.bind(F.logger,_+":"),P.warn=F.logger.warn.bind(F.logger,_+":"),P.hls=E,P.fragmentLoader=new l.default(E.config),P.fragmentTracker=y,P.config=E.config,P.decrypter=new r.default(E,E.config),E.on(D.Events.KEY_LOADED,P.onKeyLoaded,S(P)),P}var c=p.prototype;return c.doTick=function(){this.onTickEnd()},c.onTickEnd=function(){},c.startLoad=function(y){},c.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED},c._streamEnded=function(y,_){var P=this.fragCurrent,N=this.fragmentTracker;if(!_.live&&P&&P.sn===_.endSN&&!y.nextStart){var K=N.getState(P);return K===L.FragmentState.PARTIAL||K===L.FragmentState.OK}return!1},c.onMediaAttached=function(y,_){var P=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(N.startPosition)},c.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},c.onMediaSeeking=function(){var y=this.config,_=this.fragCurrent,P=this.media,N=this.mediaBuffer,K=this.state,$=P?P.currentTime:0,B=H.BufferHelper.bufferInfo(N||P,$,y.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)($)?$.toFixed(3):$)+", state: "+K),K===C.ENDED)this.resetLoadingState();else if(_&&!B.len){var R=y.maxFragLookUpTolerance,G=_.start-R,Q=_.start+_.duration+R,ne=$>Q;($<G||ne)&&(ne&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=$),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=$),this.tickImmediate()},c.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},c.onKeyLoaded=function(y,_){if(this.state!==C.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=C.IDLE;var P=this.levels[_.frag.level].details;P&&this.loadFragment(_.frag,P,_.frag.start)},c.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},c.onHandlerDestroyed=function(){this.state=C.STOPPED,this.hls.off(D.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,v.prototype.onHandlerDestroyed.call(this)},c.loadKey=function(y,_){this.log("Loading key for "+y.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=C.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(D.Events.KEY_LOADING,{frag:y})},c.loadFragment=function(y,_,P){this._loadFragForPlayback(y,_,P)},c._loadFragForPlayback=function(y,_,P){var N=this,K=function(B){if(N.fragContextChanged(y)){N.warn("Fragment "+y.sn+(B.part?" p: "+B.part.index:"")+" of level "+y.level+" was dropped during download."),N.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,N._handleFragmentLoadProgress(B)};this._doFragLoad(y,_,P,K).then(function($){if(!$)return;N.fragLoadError=0;var B=N.state;if(N.fragContextChanged(y)){(B===C.FRAG_LOADING||B===C.BACKTRACKING||!N.fragCurrent&&B===C.PARSING)&&(N.fragmentTracker.removeFragment(y),N.state=C.IDLE);return}if("payload"in $&&(N.log("Loaded fragment "+y.sn+" of level "+y.level),N.hls.trigger(D.Events.FRAG_LOADED,$),N.state===C.BACKTRACKING)){N.fragmentTracker.backtrack(y,$),N.resetFragmentLoading(y);return}N._handleFragmentLoadComplete($)}).catch(function($){N.warn($),N.resetFragmentLoading(y)})},c.flushMainBuffer=function(y,_,P){if(P===void 0&&(P=null),!(y-_))return;var N={startOffset:y,endOffset:_,type:P};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,N)},c._loadInitSegment=function(y){var _=this;this._doFragLoad(y).then(function(P){if(!P||_.fragContextChanged(y)||!_.levels)throw new Error("init load aborted");return P}).then(function(P){var N=_.hls,K=P.payload,$=y.decryptdata;if(K&&K.byteLength>0&&$&&$.key&&$.iv&&$.method==="AES-128"){var B=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(K),$.key.buffer,$.iv.buffer).then(function(R){var G=self.performance.now();return N.trigger(D.Events.FRAG_DECRYPTED,{frag:y,payload:R,stats:{tstart:B,tdecrypt:G}}),P.payload=R,P})}return P}).then(function(P){var N=_.fragCurrent,K=_.hls,$=_.levels;if(!$)throw new Error("init load aborted, missing levels");var B=$[y.level].details;console.assert(B,"Level details are defined when init segment is loaded");var R=y.stats;_.state=C.IDLE,_.fragLoadError=0,y.data=new Uint8Array(P.payload),R.parsing.start=R.buffering.start=self.performance.now(),R.parsing.end=R.buffering.end=self.performance.now(),P.frag===N&&K.trigger(D.Events.FRAG_BUFFERED,{stats:R,frag:N,part:null,id:y.type}),_.tick()}).catch(function(P){_.warn(P),_.resetFragmentLoading(y)})},c.fragContextChanged=function(y){var _=this.fragCurrent;return!y||!_||y.level!==_.level||y.sn!==_.sn||y.urlId!==_.urlId},c.fragBufferedComplete=function(y,_){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(H.BufferHelper.getBuffered(P))),this.state=C.IDLE,this.tick()},c._handleFragmentLoadComplete=function(y){var _=this.transmuxer;if(!_)return;var P=y.frag,N=y.part,K=y.partsLoaded,$=!K||K.length===0||K.some(function(R){return!R}),B=new g.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,N?N.index:-1,!$);_.flush(B)},c._handleFragmentLoadProgress=function(y){},c._doFragLoad=function(y,_,P,N){var K=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(y.start,P||0),this.config.lowLatencyMode&&_){var $=_.partList;if($&&N){P>y.end&&_.fragmentHint&&(y=_.fragmentHint);var B=this.getNextPart($,y,P);if(B>-1){var R=$[B];return this.log("Loading part sn: "+y.sn+" p: "+R.index+" cc: "+y.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+B+"-"+($.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=R.start+R.duration,this.state=C.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:y,part:$[B],targetBufferTime:P}),this.doFragPartsLoad(y,$,B,N).catch(function(G){return K.handleFragLoadError(G)})}else if(!y.url||this.loadedEndOfParts($,P))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(P.toFixed(3))),Object(z.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=C.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:y,targetBufferTime:P}),this.fragmentLoader.load(y,N).catch(function(G){return K.handleFragLoadError(G)})},c.doFragPartsLoad=function(y,_,P,N){var K=this;return new Promise(function($,B){var R=[],G=function Q(ne){var le=_[ne];K.fragmentLoader.loadPart(y,le,N).then(function(_e){R[le.index]=_e;var pe=_e.part;K.hls.trigger(D.Events.FRAG_LOADED,_e);var Ee=_[ne+1];if(Ee&&Ee.fragment===y)Q(ne+1);else return $({frag:y,part:pe,partsLoaded:R})}).catch(B)};G(P)})},c.handleFragLoadError=function(y){var _=y.data;return _&&_.details===I.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(D.Events.ERROR,_),null},c._handleTransmuxerFlush=function(y){var _=this.getCurrentContext(y);if(!_||this.state!==C.PARSING){this.fragCurrent||(this.state=C.IDLE);return}var P=_.frag,N=_.part,K=_.level,$=self.performance.now();P.stats.parsing.end=$,N&&(N.stats.parsing.end=$),this.updateLevelTiming(P,N,K,y.partial)},c.getCurrentContext=function(y){var _=this.levels,P=y.level,N=y.sn,K=y.part;if(!_||!_[P])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+P+". The current chunk will not be buffered."),null;var $=_[P],B=K>-1?Object(s.getPartWith)($,N,K):null,R=B?B.fragment:Object(s.getFragmentWithSN)($,N,this.fragCurrent);return R?{frag:R,part:B,level:$}:null},c.bufferFragmentData=function(y,_,P,N){if(!y||this.state!==C.PARSING)return;var K=y.data1,$=y.data2,B=K;if(K&&$&&(B=Object(f.appendUint8Array)(K,$)),!B||!B.length)return;var R={type:y.type,frag:_,part:P,chunkMeta:N,parent:_.type,data:B};this.hls.trigger(D.Events.BUFFER_APPENDING,R),y.dropped&&y.independent&&!P&&this.flushBufferGap(_)},c.flushBufferGap=function(y){var _=this.media;if(!_)return;if(!H.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,y.start);return}var P=_.currentTime,N=H.BufferHelper.bufferInfo(_,P,0),K=y.duration,$=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),B=Math.max(Math.min(y.start-$,N.end-$),P+$);y.start-B>$&&this.flushMainBuffer(B,y.start)},c.getFwdBufferInfo=function(y,_){var P=this.config,N=this.getLoadPosition();if(!Object(z.isFiniteNumber)(N))return null;var K=H.BufferHelper.bufferInfo(y,N,P.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var $=this.fragmentTracker.getBufferedFrag(N,_);if($&&K.nextStart<$.end)return H.BufferHelper.bufferInfo(y,N,Math.max(K.nextStart,P.maxBufferHole))}return K},c.getMaxBufferLength=function(y){var _=this.config,P;return y?P=Math.max(8*_.maxBufferSize/y,_.maxBufferLength):P=_.maxBufferLength,Math.min(P,_.maxMaxBufferLength)},c.reduceMaxBufferLength=function(y){var _=this.config,P=y||_.maxBufferLength;return _.maxMaxBufferLength>=P?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},c.getNextFragment=function(y,_){var P,N,K=_.fragments,$=K.length;if(!$)return null;var B=this.config,R=K[0].start,G;if(_.live){var Q=B.initialLiveManifestSize;if($<Q)return this.warn("Not enough fragments to start playback (have: "+$+", need: "+Q+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(_,K),this.startPosition=G?this.hls.liveSyncPosition||G.start:y)}else y<=R&&(G=K[0]);if(!G){var ne=B.lowLatencyMode?_.partEnd:_.fragmentEnd;G=this.getFragmentAtPosition(y,ne,_)}return(P=G)!==null&&P!==void 0&&P.initSegment&&!((N=G)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},c.getNextPart=function(y,_,P){for(var N=-1,K=!1,$=!0,B=0,R=y.length;B<R;B++){var G=y[B];if($=$&&!G.independent,N>-1&&P<G.start)break;var Q=G.loaded;!Q&&(K||G.independent||$)&&G.fragment===_&&(N=B),K=Q}return N},c.loadedEndOfParts=function(y,_){var P=y[y.length-1];return P&&_>P.start&&P.loaded},c.getInitialLiveFragment=function(y,_){var P=this.fragPrevious,N=null;if(P){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),N=Object(d.findFragmentByPDT)(_,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var K=P.sn+1;if(K>=y.startSN&&K<=y.endSN){var $=_[K-y.startSN];P.cc===$.cc&&(N=$,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(d.findFragWithCC)(_,P.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?y.fragmentEnd:y.edge,y))}return N},c.getFragmentAtPosition=function(y,_,P){var N=this.config,K=this.fragPrevious,$=P.fragments,B=P.endSN,R=P.fragmentHint,G=N.maxFragLookUpTolerance,Q=!!(N.lowLatencyMode&&P.partList&&R);Q&&R&&!this.bitrateTest&&($=$.concat(R),B=R.sn);var ne;if(y<_){var le=y>_-G?0:G;ne=Object(d.findFragmentByPTS)(K,$,y,le)}else ne=$[$.length-1];if(ne){var _e=ne.sn-P.startSN,pe=K&&ne.level===K.level,Ee=$[_e+1],Oe=this.fragmentTracker.getState(ne);if(Oe===L.FragmentState.BACKTRACKED){ne=null;for(var we=_e;$[we]&&this.fragmentTracker.getState($[we])===L.FragmentState.BACKTRACKED;)K?ne=$[we--]:ne=$[--we];ne||(ne=Ee)}else K&&ne.sn===K.sn&&!Q&&(pe&&(ne.sn<B&&this.fragmentTracker.getState(Ee)!==L.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+Ee.sn),ne=Ee):ne=null))}return ne},c.synchronizeToLiveEdge=function(y){var _=this.config,P=this.media;if(!P)return;var N=this.hls.liveSyncPosition,K=P.currentTime,$=y.fragments[0].start,B=y.edge,R=K>=$-_.maxFragLookUpTolerance&&K<=B;if(N!==null&&P.duration>N&&(K<N||!R)){var G=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*y.targetduration;(!R&&P.readyState<4||K<B-G)&&(this.loadedmetadata||(this.nextLoadPosition=N),P.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+N.toFixed(3)),P.currentTime=N))}},c.alignPlaylists=function(y,_){var P=this.levels,N=this.levelLastLoaded,K=this.fragPrevious,$=N!==null?P[N]:null,B=y.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var R=y.fragments[0].start,G=!_,Q=y.alignedSliding&&Object(z.isFiniteNumber)(R);if(G||!Q&&!R){Object(u.alignStream)(K,$,y);var ne=y.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+y.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+B),ne}return R},c.waitForCdnTuneIn=function(y){var _=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*_)},c.setStartPosition=function(y,_){var P=this.startPosition;if(P<_&&(P=-1),P===-1||this.lastCurrentTime===-1){var N=y.startTimeOffset;Object(z.isFiniteNumber)(N)?(P=_+N,N<0&&(P+=y.totalduration),P=Math.min(Math.max(_,P),_+y.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+P),this.startPosition=P):y.live?P=this.hls.liveSyncPosition||_:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},c.getLoadPosition=function(){var y=this.media,_=0;return this.loadedmetadata&&y?_=y.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},c.handleFragLoadAborted=function(y,_){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(_?" part"+_.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},c.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=C.IDLE)},c.onFragmentOrKeyLoadError=function(y,_){if(_.fatal)return;var P=_.frag;if(!P||P.type!==y)return;var N=this.fragCurrent;console.assert(N&&P.sn===N.sn&&P.level===N.level&&P.urlId===N.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var $=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+y+" "+P.level+" failed to load, retrying in "+$+"ms"),this.retryDate=self.performance.now()+$,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(y===n.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(F.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)},c.afterBufferFlushed=function(y,_,P){if(!y)return;var N=H.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(_,N,P),this.state===C.ENDED&&this.resetLoadingState()},c.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.IDLE},c.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[y].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},c.updateLevelTiming=function(y,_,P,N){var K=this,$=P.details;console.assert(!!$,"level.details must be defined");var B=Object.keys(y.elementaryStreams).reduce(function(R,G){var Q=y.elementaryStreams[G];if(Q){var ne=Q.endPTS-Q.startPTS;if(ne<=0)return K.warn("Could not parse fragment "+y.sn+" "+G+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),R||!1;var le=N?0:Object(s.updateFragPTSDTS)($,y,Q.startPTS,Q.endPTS,Q.startDTS,Q.endDTS);return K.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:$,level:P,drift:le,type:G,frag:y,start:Q.startPTS,end:Q.endPTS}),!0}return R},!1);B?(this.state=C.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:y,part:_})):this.resetLoadingState()},c.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},O(p,[{key:"state",get:function(){return this._state},set:function(y){var _=this._state;_!==y&&(this._state=y,this.log(_+"->"+y))}}]),p}(U.default)},"./src/controller/buffer-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return d});var z=M("./src/polyfills/number.ts"),U=M("./src/events.ts"),L=M("./src/utils/logger.ts"),H=M("./src/errors.ts"),F=M("./src/utils/buffer-helper.ts"),D=M("./src/utils/mediasource-helper.ts"),I=M("./src/loader/fragment.ts"),g=M("./src/controller/buffer-operation-queue.ts"),f=Object(D.getMediaSource)(),u=/([ha]vc.)(?:\.[^.,]+)+/,d=function(){function s(r){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var n=a.hls,h=a.media,O=a.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),n.trigger(U.Events.MEDIA_ATTACHED,{media:h})),O&&O.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){L.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){L.logger.log("[buffer-controller]: Media source ended")},this.hls=r,this._initSourceBuffer(),this.registerListeners()}var l=s.prototype;return l.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},l.destroy=function(){this.unregisterListeners(),this.details=null},l.registerListeners=function(){var a=this.hls;a.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(U.Events.BUFFER_RESET,this.onBufferReset,this),a.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(U.Events.BUFFER_EOS,this.onBufferEos,this),a.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(U.Events.FRAG_PARSED,this.onFragParsed,this),a.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},l.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(U.Events.BUFFER_RESET,this.onBufferReset,this),a.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(U.Events.BUFFER_EOS,this.onBufferEos,this),a.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(U.Events.FRAG_PARSED,this.onFragParsed,this),a.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},l._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},l.onManifestParsed=function(a,n){var h=2;(n.audio&&!n.video||!n.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},l.onMediaAttaching=function(a,n){var h=this.media=n.media;if(h&&f){var O=this.mediaSource=new f;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(O),this._objectUrl=h.src}},l.onMediaDetaching=function(){var a=this.media,n=this.mediaSource,h=this._objectUrl;if(n){if(L.logger.log("[buffer-controller]: media source detaching"),n.readyState==="open")try{n.endOfStream()}catch(O){L.logger.warn("[buffer-controller]: onMediaDetaching: "+O.message+" while calling endOfStream")}this.onBufferReset(),n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):L.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(U.Events.MEDIA_DETACHED,void 0)},l.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(n){var h=a.sourceBuffer[n];try{h&&(a.removeBufferListeners(n),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[n]=void 0)}catch(O){L.logger.warn("[buffer-controller]: Failed to reset the "+n+" buffer",O)}}),this._initSourceBuffer()},l.onBufferCodecs=function(a,n){var h=this,O=this.getSourceBufferTypes().length;if(Object.keys(n).forEach(function(S){if(O){var x=h.tracks[S];if(x&&typeof x.buffer.changeType=="function"){var A=n[S],C=A.codec,b=A.levelCodec,v=A.container,p=(x.levelCodec||x.codec).replace(u,"$1"),c=(b||C).replace(u,"$1");if(p!==c){var E=v+";codecs="+(b||C);h.appendChangeType(S,E)}}}else h.pendingTracks[S]=n[S]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},l.appendChangeType=function(a,n){var h=this,O=this.operationQueue,S={execute:function(){var A=h.sourceBuffer[a];A&&(L.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+n),A.changeType(n)),O.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){L.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};O.append(S,a)},l.onBufferAppending=function(a,n){var h=this,O=this.hls,S=this.operationQueue,x=this.tracks,A=n.data,C=n.type,b=n.frag,v=n.part,p=n.chunkMeta,c=p.buffering[C],E=self.performance.now();c.start=E;var y=b.stats.buffering,_=v?v.stats.buffering:null;y.start===0&&(y.start=E),_&&_.start===0&&(_.start=E);var P=x.audio,N=C==="audio"&&p.id===1&&(P==null?void 0:P.container)==="audio/mpeg",K={execute:function(){if(c.executeStart=self.performance.now(),N){var B=h.sourceBuffer[C];if(B){var R=b.start-B.timestampOffset;Math.abs(R)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+b.start+" (delta: "+R+") sn: "+b.sn+")"),B.timestampOffset=b.start)}}h.appendExecutor(A,C)},onStart:function(){},onComplete:function(){var B=self.performance.now();c.executeEnd=c.end=B,y.first===0&&(y.first=B),_&&_.first===0&&(_.first=B);var R=h.sourceBuffer,G={};for(var Q in R)G[Q]=F.BufferHelper.getBuffered(R[Q]);h.appendError=0,h.hls.trigger(U.Events.BUFFER_APPENDED,{type:C,frag:b,part:v,chunkMeta:p,parent:b.type,timeRanges:G})},onError:function(B){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+C+" SourceBuffer",B);var R={type:H.ErrorTypes.MEDIA_ERROR,parent:b.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?R.details=H.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,R.details=H.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>O.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),R.fatal=!0)),O.trigger(U.Events.ERROR,R)}};S.append(K,C)},l.onBufferFlushing=function(a,n){var h=this,O=this.operationQueue,S=function(A){return{execute:h.removeExecutor.bind(h,A,n.startOffset,n.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(U.Events.BUFFER_FLUSHED,{type:A})},onError:function(b){L.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",b)}}};n.type?O.append(S(n.type),n.type):this.getSourceBufferTypes().forEach(function(x){O.append(S(x),x)})},l.onFragParsed=function(a,n){var h=this,O=n.frag,S=n.part,x=[],A=S?S.elementaryStreams:O.elementaryStreams;A[I.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(A[I.ElementaryStreamTypes.AUDIO]&&x.push("audio"),A[I.ElementaryStreamTypes.VIDEO]&&x.push("video"));var C=function(){var v=self.performance.now();O.stats.buffering.end=v,S&&(S.stats.buffering.end=v);var p=S?S.stats:O.stats;h.hls.trigger(U.Events.FRAG_BUFFERED,{frag:O,part:S,stats:p,id:O.type})};x.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(C,x)},l.onFragChanged=function(a,n){this.flushBackBuffer()},l.onBufferEos=function(a,n){var h=this,O=this.getSourceBufferTypes().reduce(function(S,x){var A=h.sourceBuffer[x];return(!n.type||n.type===x)&&(A&&!A.ended&&(A.ended=!0,L.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),S&&!!(!A||A.ended)},!0);O&&this.blockBuffers(function(){var S=h.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},l.onLevelUpdated=function(a,n){var h=n.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},l.flushBackBuffer=function(){var a=this.hls,n=this.details,h=this.media,O=this.sourceBuffer;if(!h||n===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var x=n.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(x)||x<0)return;var A=h.currentTime,C=n.levelTargetDuration,b=Math.max(x,C),v=Math.floor(A/C)*C-b;S.forEach(function(p){var c=O[p];if(c){var E=F.BufferHelper.getBuffered(c);E.length>0&&v>E.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:v}),n.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:v}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:v,type:p}))}})},l.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,n=this.hls,h=this.media,O=this.mediaSource,S=a.fragments[0].start+a.totalduration,x=h.duration,A=Object(z.isFiniteNumber)(O.duration)?O.duration:0;a.live&&n.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(a)):(S>A&&S>x||!Object(z.isFiniteNumber)(x))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),O.duration=S)},l.updateSeekableRange=function(a){var n=this.mediaSource,h=a.fragments,O=h.length;if(O&&a.live&&n!==null&&n!==void 0&&n.setLiveSeekableRange){var S=Math.max(0,h[0].start),x=Math.max(S,S+a.totalduration);n.setLiveSeekableRange(S,x)}},l.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,n=this.operationQueue,h=this.pendingTracks,O=Object.keys(h).length;if(O&&!a||O===2){this.createSourceBuffers(h),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}S.forEach(function(x){n.executeNext(x)})}},l.createSourceBuffers=function(a){var n=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var S in a)if(!n[S]){var x=a[S];if(!x)throw Error("source buffer exists for track "+S+", however track does not");var A=x.levelCodec||x.codec,C=x.container+";codecs="+A;L.logger.log("[buffer-controller]: creating sourceBuffer("+C+")");try{var b=n[S]=h.addSourceBuffer(C),v=S;this.addBufferListener(v,"updatestart",this._onSBUpdateStart),this.addBufferListener(v,"updateend",this._onSBUpdateEnd),this.addBufferListener(v,"error",this._onSBUpdateError),this.tracks[S]={buffer:b,codec:A,container:x.container,levelCodec:x.levelCodec,id:x.id},O++}catch(p){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:C})}}O&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},l._onSBUpdateStart=function(a){var n=this.operationQueue,h=n.current(a);h.onStart()},l._onSBUpdateEnd=function(a){var n=this.operationQueue,h=n.current(a);h.onComplete(),n.shiftAndExecuteNext(a)},l._onSBUpdateError=function(a,n){L.logger.error("[buffer-controller]: "+a+" SourceBuffer error",n),this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(n)},l.removeExecutor=function(a,n,h){var O=this.media,S=this.mediaSource,x=this.operationQueue,A=this.sourceBuffer,C=A[a];if(!O||!S||!C){L.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(a);return}var b=Object(z.isFiniteNumber)(O.duration)?O.duration:Infinity,v=Object(z.isFiniteNumber)(S.duration)?S.duration:Infinity,p=Math.max(0,n),c=Math.min(h,b,v);c>p?(L.logger.log("[buffer-controller]: Removing ["+p+","+c+"] from the "+a+" SourceBuffer"),console.assert(!C.updating,a+" sourceBuffer must not be updating"),C.remove(p,c)):x.shiftAndExecuteNext(a)},l.appendExecutor=function(a,n){var h=this.operationQueue,O=this.sourceBuffer,S=O[n];if(!S){L.logger.warn("[buffer-controller]: Attempting to append to the "+n+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(n);return}S.ended=!1,console.assert(!S.updating,n+" sourceBuffer must not be updating"),S.appendBuffer(a)},l.blockBuffers=function(a,n){var h=this;if(n===void 0&&(n=this.getSourceBufferTypes()),!n.length){L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var O=this.operationQueue,S=n.map(function(x){return O.appendBlocker(x)});Promise.all(S).then(function(){a(),n.forEach(function(x){var A=h.sourceBuffer[x];(!A||!A.updating)&&O.shiftAndExecuteNext(x)})})},l.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},l.addBufferListener=function(a,n,h){var O=this.sourceBuffer[a];if(!O)return;var S=h.bind(this,a);this.listeners[a].push({event:n,listener:S}),O.addEventListener(n,S)},l.removeBufferListeners=function(a){var n=this.sourceBuffer[a];if(!n)return;this.listeners[a].forEach(function(h){n.removeEventListener(h.event,h.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return U});var z=M("./src/utils/logger.ts"),U=function(){function L(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var H=L.prototype;return H.append=function(D,I){var g=this.queues[I];g.push(D),g.length===1&&this.buffers[I]&&this.executeNext(I)},H.insertAbort=function(D,I){var g=this.queues[I];g.unshift(D),this.executeNext(I)},H.appendBlocker=function(D){var I,g=new Promise(function(u){I=u}),f={execute:I,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(f,D),g},H.executeNext=function(D){var I=this.buffers,g=this.queues,f=I[D],u=g[D];if(u.length){var d=u[0];try{d.execute()}catch(s){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(s),(!f||!f.updating)&&(u.shift(),this.executeNext(D))}}},H.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},H.current=function(D){return this.queues[D][0]},L}()},"./src/controller/cap-level-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts");function U(F,D){for(var I=0;I<D.length;I++){var g=D[I];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(F,g.key,g)}}function L(F,D,I){return D&&U(F.prototype,D),I&&U(F,I),F}var H=function(){function F(I){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=I,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=F.prototype;return D.setStreamController=function(g){this.streamController=g},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var g=this.hls;g.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var g=this.hls;g.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(g,f){F.isLevelAllowed(f.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(f.droppedLevel)},D.onMediaAttaching=function(g,f){this.media=f.media instanceof HTMLVideoElement?f.media:null},D.onManifestParsed=function(g,f){var u=this.hls;this.restrictedLevels=[],this.firstLevel=f.firstLevel,u.config.capLevelToPlayerSize&&f.video&&this.startCapping()},D.onBufferCodecs=function(g,f){var u=this.hls;u.config.capLevelToPlayerSize&&f.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var f=this.hls;f.autoLevelCapping=this.getMaxLevel(g.length-1),f.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=f.autoLevelCapping}}},D.getMaxLevel=function(g){var f=this,u=this.hls.levels;if(!u.length)return-1;var d=u.filter(function(s,l){return F.isLevelAllowed(l,f.restrictedLevels)&&l<=g});return this.clientRect=null,F.getMaxLevelByMediaSize(d,this.mediaWidth,this.mediaHeight)},D.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()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,f={width:0,height:0};if(g){var u=g.getBoundingClientRect();f.width=u.width,f.height=u.height,!f.width&&!f.height&&(f.width=u.right-u.left||g.width||0,f.height=u.bottom-u.top||g.height||0)}return this.clientRect=f,f},F.isLevelAllowed=function(g,f){return f===void 0&&(f=[]),f.indexOf(g)===-1},F.getMaxLevelByMediaSize=function(g,f,u){if(!g||!g.length)return-1;for(var d=function(n,h){return h?n.width!==h.width||n.height!==h.height:!0},s=g.length-1,l=0;l<g.length;l+=1){var r=g[l];if((r.width>=f||r.height>=u)&&d(r,g[l+1])){s=l;break}}return s},L(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(f){}return g}}]),F}();V.default=H},"./src/controller/cmcd-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return d});var z=M("./src/events.ts"),U=M("./src/types/cmcd.ts"),L=M("./src/utils/buffer-helper.ts"),H=M("./src/utils/logger.ts");function F(s,l){for(var r=0;r<l.length;r++){var a=l[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function D(s,l,r){return l&&F(s.prototype,l),r&&F(s,r),s}function I(s,l){var r=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(r)return(r=r.call(s)).next.bind(r);if(Array.isArray(s)||(r=g(s))||l&&s&&typeof s.length=="number"){r&&(s=r);var a=0;return function(){return a>=s.length?{done:!0}:{done:!1,value:s[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(s,l){if(!s)return;if(typeof s=="string")return f(s,l);var r=Object.prototype.toString.call(s).slice(8,-1);if(r==="Object"&&s.constructor&&(r=s.constructor.name),r==="Map"||r==="Set")return Array.from(s);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(s,l)}function f(s,l){(l==null||l>s.length)&&(l=s.length);for(var r=0,a=new Array(l);r<l;r++)a[r]=s[r];return a}function u(){return u=Object.assign||function(s){for(var l=1;l<arguments.length;l++){var r=arguments[l];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=r[a])}return s},u.apply(this,arguments)}var d=function(){function s(r){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(O){try{a.apply(O,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(S){H.logger.warn("Could not generate manifest CMCD data.",S)}},this.applyFragmentData=function(O){try{var S=O.frag,x=a.hls.levels[S.level],A=a.getObjectType(S),C={d:S.duration*1e3,ot:A};(A===U.CMCDObjectType.VIDEO||A===U.CMCDObjectType.AUDIO||A==U.CMCDObjectType.MUXED)&&(C.br=x.bitrate/1e3,C.tb=a.getTopBandwidth(A),C.bl=a.getBufferLength(A)),a.apply(O,C)}catch(b){H.logger.warn("Could not generate segment CMCD data.",b)}},this.hls=r;var n=this.config=r.config,h=n.cmcd;h!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||s.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var l=s.prototype;return l.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},l.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},l.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},l.onMediaAttached=function(a,n){this.media=n.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},l.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},l.onBufferCreated=function(a,n){var h,O;this.audioBuffer=(h=n.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(O=n.tracks.video)===null||O===void 0?void 0:O.buffer},l.createData=function(){var a;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},l.apply=function(a,n){n===void 0&&(n={}),u(n,this.createData());var h=n.ot===U.CMCDObjectType.INIT||n.ot===U.CMCDObjectType.VIDEO||n.ot===U.CMCDObjectType.MUXED;if(this.starved&&h&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering),this.useHeaders){var O=s.toHeaders(n);if(!Object.keys(O).length)return;a.headers||(a.headers={}),u(a.headers,O)}else{var S=s.toQuery(n);if(!S)return;a.url=s.appendQueryToUri(a.url,S)}},l.getObjectType=function(a){var n=a.type;return n==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:n==="audio"?U.CMCDObjectType.AUDIO:n==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},l.getTopBandwidth=function(a){for(var n=0,h=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,O=I(h),S;!(S=O()).done;){var x=S.value;x.bitrate>n&&(n=x.bitrate)}return n>0?n:NaN},l.getBufferLength=function(a){var n=this.hls.media,h=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!n)return NaN;var O=L.BufferHelper.bufferInfo(h,n.currentTime,this.config.maxBufferHole);return O.len*1e3},l.createPlaylistLoader=function(){var a=this.config.pLoader,n=this.applyPlaylistData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var S=O.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(A,C,b){n(A),this.loader.load(A,C,b)},D(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},l.createFragmentLoader=function(){var a=this.config.fLoader,n=this.applyFragmentData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var S=O.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(A,C,b){n(A),this.loader.load(A,C,b)},D(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},s.uuid=function(){var a=URL.createObjectURL(new Blob),n=a.toString();return URL.revokeObjectURL(a),n.substr(n.lastIndexOf("/")+1)},s.serialize=function(a){for(var n=[],h=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},O=function(N){return Math.round(N)},S=function(N){return O(N/100)*100},x=function(N){return encodeURIComponent(N)},A={br:O,d:O,bl:S,dl:S,mtp:S,nor:x,rtp:S,tb:O},C=Object.keys(a||{}).sort(),b=I(C),v;!(v=b()).done;){var p=v.value,c=a[p];if(!h(c))continue;if(p==="v"&&c===1)continue;if(p=="pr"&&c===1)continue;var E=A[p];E&&(c=E(c));var y=typeof c,_=void 0;p==="ot"||p==="sf"||p==="st"?_=p+"="+c:y==="boolean"?_=p:y==="number"?_=p+"="+c:_=p+"="+JSON.stringify(c),n.push(_)}return n.join(",")},s.toHeaders=function(a){for(var n=Object.keys(a),h={},O=["Object","Request","Session","Status"],S=[{},{},{},{}],x={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,C=n;A<C.length;A++){var b=C[A],v=x[b]!=null?x[b]:1;S[v][b]=a[b]}for(var p=0;p<S.length;p++){var c=s.serialize(S[p]);c&&(h["CMCD-"+O[p]]=c)}return h},s.toQuery=function(a){return"CMCD="+encodeURIComponent(s.serialize(a))},s.appendQueryToUri=function(a,n){if(!n)return a;var h=a.includes("?")?"&":"?";return""+a+h+n},s}()},"./src/controller/eme-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts"),U=M("./src/errors.ts"),L=M("./src/utils/logger.ts"),H=M("./src/utils/mediakeys-helper.ts");function F(d,s){for(var l=0;l<s.length;l++){var r=s[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(d,r.key,r)}}function D(d,s,l){return s&&F(d.prototype,s),l&&F(d,l),d}var I=3,g=function(s,l,r){var a={audioCapabilities:[],videoCapabilities:[]};return s.forEach(function(n){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+n+'"',robustness:r.audioRobustness||""})}),l.forEach(function(n){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+n+'"',robustness:r.videoRobustness||""})}),[a]},f=function(s,l,r,a){switch(s){case H.KeySystems.WIDEVINE:return g(l,r,a);default:throw new Error("Unknown key-system: "+s)}},u=function(){function d(l){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=l,this._config=l.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 s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},s._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s.getLicenseServerUrl=function(r){switch(r){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+r+'"')},s._attemptKeySystemAccess=function(r,a,n){var h=this,O=f(r,a,n,this._drmSystemOptions);L.logger.log("Requesting encrypted media key-system access");var S=this.requestMediaKeySystemAccess(r,O);this.mediaKeysPromise=S.then(function(x){return h._onMediaKeySystemAccessObtained(r,x)}),S.catch(function(x){L.logger.error('Failed to obtain key-system "'+r+'" access:',x)})},s._onMediaKeySystemAccessObtained=function(r,a){var n=this;L.logger.log('Access for key-system "'+r+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:r};this._mediaKeysList.push(h);var O=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(S){return h.mediaKeys=S,L.logger.log('Media-keys created for key-system "'+r+'"'),n._onMediaKeysCreated(),S});return O.catch(function(S){L.logger.error("Failed to create media-keys:",S)}),O},s._onMediaKeysCreated=function(){var r=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),r._onNewMediaKeySession(a.mediaKeysSession))})},s._onNewMediaKeySession=function(r){var a=this;L.logger.log("New key-system session "+r.sessionId),r.addEventListener("message",function(n){a._onKeySessionMessage(r,n.message)},!1)},s._onKeySessionMessage=function(r,a){L.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(n){L.logger.log("Received license data (length: "+(n&&n.byteLength)+"), updating key-session"),r.update(n)})},s.onMediaEncrypted=function(r){var a=this;if(L.logger.log('Media is encrypted using "'+r.initDataType+'" init data type'),!this.mediaKeysPromise){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var n=function(O){if(!a._media)return;a._attemptSetMediaKeys(O),a._generateRequestWithPreferredKeySession(r.initDataType,r.initData)};this.mediaKeysPromise.then(n).catch(n)},s._attemptSetMediaKeys=function(r){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}L.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},s._generateRequestWithPreferredKeySession=function(r,a){var n=this,h=this._mediaKeysList[0];if(!h){L.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){L.logger.warn("Key-Session already initialized but requested again");return}var O=h.mediaKeysSession;if(!O){L.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){L.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}L.logger.log('Generating key-session request for "'+r+'" init data type'),h.mediaKeysSessionInitialized=!0,O.generateRequest(r,a).then(function(){L.logger.debug("Key-session generation succeeded")}).catch(function(S){L.logger.error("Error generating key-session request:",S),n.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},s._createLicenseXhr=function(r,a,n){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,r,a,n);var O=this._licenseXhrSetup;if(O)try{O.call(this.hls,h,r),O=void 0}catch(S){L.logger.error(S)}try{h.readyState||h.open("POST",r,!0),O&&O.call(this.hls,h,r)}catch(S){throw new Error("issue setting up KeySystem license XHR "+S)}return h},s._onLicenseRequestReadyStageChange=function(r,a,n,h){switch(r.readyState){case 4:if(r.status===200){this._requestLicenseFailureCount=0,L.logger.log("License request succeeded");var O=r.response,S=this._licenseResponseCallback;if(S)try{O=S.call(this.hls,r,a)}catch(A){L.logger.error(A)}h(O)}else{if(L.logger.error("License Request XHR failed ("+a+"). Status: "+r.status+" ("+r.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>I){this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=I-this._requestLicenseFailureCount+1;L.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(n,h)}break}},s._generateLicenseRequestChallenge=function(r,a){switch(r.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+r.mediaKeySystemDomain)},s._requestLicense=function(r,a){L.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n){L.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(n.mediaKeySystemDomain),O=this._createLicenseXhr(h,r,a);L.logger.log("Sending license request to URL: "+h);var S=this._generateLicenseRequestChallenge(n,r);O.send(S)}catch(x){L.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(r,a){if(!this._emeEnabled)return;var n=a.media;this._media=n,n.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var r=this._media,a=this._mediaKeysList;if(!r)return;r.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(n){if(n.mediaKeysSession)return n.mediaKeysSession.close().catch(function(){})})).then(function(){return r.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(r,a){if(!this._emeEnabled)return;var n=a.levels.map(function(O){return O.audioCodec}).filter(function(O){return!!O}),h=a.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,n,h)},D(d,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),d}();V.default=u},"./src/controller/fps-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts"),U=M("./src/utils/logger.ts"),L=function(){function H(D){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=D,this.registerListeners()}var F=H.prototype;return F.setStreamController=function(I){this.streamController=I},F.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(I,g){var f=this.hls.config;if(f.capLevelOnFPSDrop){var u=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=u,u&&typeof u.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),f.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(I,g,f){var u=performance.now();if(g){if(this.lastTime){var d=u-this.lastTime,s=f-this.lastDroppedFrames,l=g-this.lastDecodedFrames,r=1e3*s/d,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:s,currentDecoded:l,totalDroppedFrames:f}),r>0&&s>a.config.fpsDroppedMonitoringThreshold*l){var n=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+n),n>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=n)&&(n=n-1,a.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:n,droppedLevel:a.currentLevel}),a.autoLevelCapping=n,this.streamController.nextLevelSwitch())}}this.lastTime=u,this.lastDroppedFrames=f,this.lastDecodedFrames=g}},F.checkFPSInterval=function(){var I=this.media;if(I)if(this.isVideoPlaybackQualityAvailable){var g=I.getVideoPlaybackQuality();this.checkFPS(I,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(I,I.webkitDecodedFrameCount,I.webkitDroppedFrameCount)},H}();V.default=L},"./src/controller/fragment-finders.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"findFragmentByPDT",function(){return L}),M.d(V,"findFragmentByPTS",function(){return H}),M.d(V,"fragmentWithinToleranceTest",function(){return F}),M.d(V,"pdtWithinToleranceTest",function(){return D}),M.d(V,"findFragWithCC",function(){return I});var z=M("./src/polyfills/number.ts"),U=M("./src/utils/binary-search.ts");function L(g,f,u){if(f===null||!Array.isArray(g)||!g.length||!Object(z.isFiniteNumber)(f))return null;var d=g[0].programDateTime;if(f<(d||0))return null;var s=g[g.length-1].endProgramDateTime;if(f>=(s||0))return null;u=u||0;for(var l=0;l<g.length;++l){var r=g[l];if(D(f,u,r))return r}return null}function H(g,f,u,d){u===void 0&&(u=0),d===void 0&&(d=0);var s=null;if(g?s=f[g.sn-f[0].sn+1]||null:u===0&&f[0].start===0&&(s=f[0]),s&&F(u,d,s)===0)return s;var l=U.default.search(f,F.bind(null,u,d));return l||s}function F(g,f,u){g===void 0&&(g=0),f===void 0&&(f=0);var d=Math.min(f,u.duration+(u.deltaPTS?u.deltaPTS:0));return u.start+u.duration-d<=g?1:u.start-d>g&&u.start?-1:0}function D(g,f,u){var d=Math.min(f,u.duration+(u.deltaPTS?u.deltaPTS:0))*1e3,s=u.endProgramDateTime||0;return s-d>g}function I(g,f){return U.default.search(g,function(u){return u.cc<f?1:u.cc>f?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"FragmentState",function(){return L}),M.d(V,"FragmentTracker",function(){return H});var z=M("./src/events.ts"),U=M("./src/types/loader.ts"),L;(function(I){I.NOT_LOADED="NOT_LOADED",I.BACKTRACKED="BACKTRACKED",I.APPENDING="APPENDING",I.PARTIAL="PARTIAL",I.OK="OK"})(L||(L={}));var H=function(){function I(f){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=f,this._registerListeners()}var g=I.prototype;return g._registerListeners=function(){var u=this.hls;u.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),u.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var u=this.hls;u.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),u.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(u,d){if(d===U.PlaylistLevelType.MAIN){var s=this.activeFragment,l=this.activeParts;if(!s)return null;if(l)for(var r=l.length;r--;){var a=l[r],n=a?a.end:s.appendedPTS;if(a.start<=u&&n!==void 0&&u<=n)return r>9&&(this.activeParts=l.slice(r-9)),a}else if(s.start<=u&&s.appendedPTS!==void 0&&u<=s.appendedPTS)return s}return this.getBufferedFrag(u,d)},g.getBufferedFrag=function(u,d){for(var s=this.fragments,l=Object.keys(s),r=l.length;r--;){var a=s[l[r]];if((a==null?void 0:a.body.type)===d&&a.buffered){var n=a.body;if(n.start<=u&&u<=n.end)return n}}return null},g.detectEvictedFragments=function(u,d,s){var l=this;Object.keys(this.fragments).forEach(function(r){var a=l.fragments[r];if(!a)return;if(!a.buffered){a.body.type===s&&l.removeFragment(a.body);return}var n=a.range[u];if(!n)return;n.time.some(function(h){var O=!l.isTimeBuffered(h.startPTS,h.endPTS,d);return O&&l.removeFragment(a.body),O})})},g.detectPartialFragments=function(u){var d=this,s=this.timeRanges,l=u.frag,r=u.part;if(!s||l.sn==="initSegment")return;var a=D(l),n=this.fragments[a];if(!n)return;Object.keys(s).forEach(function(h){var O=l.elementaryStreams[h];if(!O)return;var S=s[h],x=r!==null||O.partial===!0;n.range[h]=d.getBufferedTimes(l,r,x,S)}),n.backtrack=n.loaded=null,Object.keys(n.range).length?n.buffered=!0:this.removeFragment(n.body)},g.fragBuffered=function(u){var d=D(u),s=this.fragments[d];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},g.getBufferedTimes=function(u,d,s,l){for(var r={time:[],partial:s},a=d?d.start:u.start,n=d?d.end:u.end,h=u.minEndPTS||n,O=u.maxStartPTS||a,S=0;S<l.length;S++){var x=l.start(S)-this.bufferPadding,A=l.end(S)+this.bufferPadding;if(O>=x&&h<=A){r.time.push({startPTS:Math.max(a,l.start(S)),endPTS:Math.min(n,l.end(S))});break}else if(a<A&&n>x)r.partial=!0,r.time.push({startPTS:Math.max(a,l.start(S)),endPTS:Math.min(n,l.end(S))});else if(n<=x)break}return r},g.getPartialFragment=function(u){var d=null,s,l,r,a=0,n=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(O){var S=h[O];if(!S)return;F(S)&&(l=S.body.start-n,r=S.body.end+n,u>=l&&u<=r&&(s=Math.min(u-l,r-u),a<=s&&(d=S.body,a=s)))}),d},g.getState=function(u){var d=D(u),s=this.fragments[d];return s?s.buffered?F(s)?L.PARTIAL:L.OK:s.backtrack?L.BACKTRACKED:L.APPENDING:L.NOT_LOADED},g.backtrack=function(u,d){var s=D(u),l=this.fragments[s];if(!l||l.backtrack)return null;var r=l.backtrack=d||l.loaded;return l.loaded=null,r},g.getBacktrackData=function(u){var d=D(u),s=this.fragments[d];if(s){var l,r=s.backtrack;if(r!=null&&(l=r.payload)!==null&&l!==void 0&&l.byteLength)return r;this.removeFragment(u)}return null},g.isTimeBuffered=function(u,d,s){for(var l,r,a=0;a<s.length;a++){if(l=s.start(a)-this.bufferPadding,r=s.end(a)+this.bufferPadding,u>=l&&d<=r)return!0;if(d<=l)return!1}return!1},g.onFragLoaded=function(u,d){var s=d.frag,l=d.part;if(s.sn==="initSegment"||s.bitrateTest||l)return;var r=D(s);this.fragments[r]={body:s,loaded:d,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(u,d){var s=this,l=d.frag,r=d.part,a=d.timeRanges;if(l.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=l,r){var n=this.activeParts;n||(this.activeParts=n=[]),n.push(r)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var O=a[h];if(s.detectEvictedFragments(h,O),!r)for(var S=0;S<O.length;S++)l.appendedPTS=Math.max(O.end(S),l.appendedPTS||0)})},g.onFragBuffered=function(u,d){this.detectPartialFragments(d)},g.hasFragment=function(u){var d=D(u);return!!this.fragments[d]},g.removeFragmentsInRange=function(u,d,s){var l=this;Object.keys(this.fragments).forEach(function(r){var a=l.fragments[r];if(!a)return;if(a.buffered){var n=a.body;n.type===s&&n.start<d&&n.end>u&&l.removeFragment(n)}})},g.removeFragment=function(u){var d=D(u);u.stats.loaded=0,u.clearElementaryStreamInfo(),delete this.fragments[d]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},I}();function F(I){var g,f;return I.buffered&&(((g=I.range.video)===null||g===void 0?void 0:g.partial)||((f=I.range.audio)===null||f===void 0?void 0:f.partial))}function D(I){return I.type+"_"+I.level+"_"+I.urlId+"_"+I.sn}},"./src/controller/gap-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"STALL_MINIMUM_DURATION_MS",function(){return F}),M.d(V,"MAX_START_GAP_JUMP",function(){return D}),M.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return I}),M.d(V,"SKIP_BUFFER_RANGE_START",function(){return g}),M.d(V,"default",function(){return f});var z=M("./src/utils/buffer-helper.ts"),U=M("./src/errors.ts"),L=M("./src/events.ts"),H=M("./src/utils/logger.ts"),F=250,D=2,I=.1,g=.05,f=function(){function u(s,l,r,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=s,this.media=l,this.fragmentTracker=r,this.hls=a}var d=u.prototype;return d.destroy=function(){this.hls=this.fragmentTracker=this.media=null},d.poll=function(l){var r=this.config,a=this.media,n=this.stalled,h=a.currentTime,O=a.seeking,S=this.seeking&&!O,x=!this.seeking&&O;if(this.seeking=O,h!==l){if(this.moved=!0,n!==null){if(this.stallReported){var A=self.performance.now()-n;H.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||S)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var C=z.BufferHelper.bufferInfo(a,h,0),b=C.len>0,v=C.nextStart||0;if(!b&&!v)return;if(O){var p=C.len>D,c=!v||v-h>D&&!this.fragmentTracker.getPartialFragment(h);if(p||c)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,y=Math.max(v,C.start||0)-h,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=_==null||((E=_.details)===null||E===void 0)?void 0:E.live,N=P?_.details.targetduration*2:D;if(y>0&&y<=N){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(n===null){this.stalled=K;return}var $=K-n;!O&&$>=F&&this._reportStall(C.len);var B=z.BufferHelper.bufferInfo(a,h,r.maxBufferHole);this._tryFixBufferStall(B,$)},d._tryFixBufferStall=function(l,r){var a=this.config,n=this.fragmentTracker,h=this.media,O=h.currentTime,S=n.getPartialFragment(O);if(S){var x=this._trySkipBufferHole(S);if(x)return}l.len>a.maxBufferHole&&r>a.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},d._reportStall=function(l){var r=this.hls,a=this.media,n=this.stallReported;n||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+l+")"),r.trigger(L.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:l}))},d._trySkipBufferHole=function(l){for(var r=this.config,a=this.hls,n=this.media,h=n.currentTime,O=0,S=z.BufferHelper.getBuffered(n),x=0;x<S.length;x++){var A=S.start(x);if(h+r.maxBufferHole>=O&&h<A){var C=Math.max(A+g,n.currentTime+I);return H.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+C),this.moved=!0,this.stalled=null,n.currentTime=C,l&&a.trigger(L.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+C,frag:l}),C}O=S.end(x)}return 0},d._tryNudgeBuffer=function(){var l=this.config,r=this.hls,a=this.media,n=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<l.nudgeMaxRetry){var O=n+h*l.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+n+" to "+O),a.currentTime=O,r.trigger(L.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+n+" after "+l.nudgeMaxRetry+" nudges"),r.trigger(L.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},u}()},"./src/controller/id3-track-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts"),U=M("./src/utils/texttrack-utils.ts"),L=M("./src/demux/id3.ts"),H=.25,F=function(){function D(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var I=D.prototype;return I.destroy=function(){this._unregisterListeners()},I._registerListeners=function(){var f=this.hls;f.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I._unregisterListeners=function(){var f=this.hls;f.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),f.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I.onMediaAttached=function(f,u){this.media=u.media},I.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},I.getID3Track=function(f){if(!this.media)return;for(var u=0;u<f.length;u++){var d=f[u];if(d.kind==="metadata"&&d.label==="id3")return Object(U.sendAddTrackEvent)(d,this.media),d}return this.media.addTextTrack("metadata","id3")},I.onFragParsingMetadata=function(f,u){if(!this.media)return;var d=u.frag,s=u.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var l=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,r=0;r<s.length;r++){var a=L.getID3Frames(s[r].data);if(a){var n=s[r].pts,h=r<s.length-1?s[r+1].pts:d.end,O=h-n;O<=0&&(h=n+H);for(var S=0;S<a.length;S++){var x=a[S];if(!L.isTimeStampFrame(x)){var A=new l(n,h,"");A.value=x,this.id3Track.addCue(A)}}}}},I.onBufferFlushing=function(f,u){var d=u.startOffset,s=u.endOffset,l=u.type;if(!l||l==="audio"){var r=this.id3Track;r&&Object(U.removeCuesInRange)(r,d,s)}},D}();V.default=F},"./src/controller/latency-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return D});var z=M("./src/errors.ts"),U=M("./src/events.ts"),L=M("./src/utils/logger.ts");function H(I,g){for(var f=0;f<g.length;f++){var u=g[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(I,u.key,u)}}function F(I,g,f){return g&&H(I.prototype,g),f&&H(I,f),I}var D=function(){function I(f){var u=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 u.timeupdate()},this.hls=f,this.config=f.config,this.registerListeners()}var g=I.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},g.onMediaAttached=function(u,d){this.media=d.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(u,d){var s=d.details;this.levelDetails=s,s.advanced&&this.timeupdate(),!s.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(u,d){if(d.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var u=this.media,d=this.levelDetails;if(!u||!d)return;this.currentTime=u.currentTime;var s=this.computeLatency();if(s===null)return;this._latency=s;var l=this.config,r=l.lowLatencyMode,a=l.maxLiveSyncPlaybackRate;if(!r||a===1)return;var n=this.targetLatency;if(n===null)return;var h=s-n,O=Math.min(this.maxLatency,n+d.targetduration),S=h<O;if(d.live&&S&&h>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;u.playbackRate=Math.min(x,Math.max(1,A))}else u.playbackRate!==1&&u.playbackRate!==0&&(u.playbackRate=1)},g.estimateLiveEdge=function(){var u=this.levelDetails;return u===null?null:u.edge+u.age},g.computeLatency=function(){var u=this.estimateLiveEdge();return u===null?null:u-this.currentTime},F(I,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var u=this.config,d=this.levelDetails;return u.liveMaxLatencyDuration!==void 0?u.liveMaxLatencyDuration:d?u.liveMaxLatencyDurationCount*d.targetduration:0}},{key:"targetLatency",get:function(){var u=this.levelDetails;if(u===null)return null;var d=u.holdBack,s=u.partHoldBack,l=u.targetduration,r=this.config,a=r.liveSyncDuration,n=r.liveSyncDurationCount,h=r.lowLatencyMode,O=this.hls.userConfig,S=h&&s||d;(O.liveSyncDuration||O.liveSyncDurationCount||S===0)&&(S=a!==void 0?a:n*l);var x=l,A=1;return S+Math.min(this.stallCount*A,x)}},{key:"liveSyncPosition",get:function(){var u=this.estimateLiveEdge(),d=this.targetLatency,s=this.levelDetails;if(u===null||d===null||s===null)return null;var l=s.edge,r=u-d-this.edgeStalled,a=l-s.totalduration,n=l-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,r),n)}},{key:"drift",get:function(){var u=this.levelDetails;return u===null?1:u.drift}},{key:"edgeStalled",get:function(){var u=this.levelDetails;if(u===null)return 0;var d=(this.config.lowLatencyMode&&u.partTarget||u.targetduration)*3;return Math.max(u.age-d,0)}},{key:"forwardBufferLength",get:function(){var u=this.media,d=this.levelDetails;if(!u||!d)return 0;var s=u.buffered.length;return s?u.buffered.end(s-1):d.edge-this.currentTime}}]),I}()},"./src/controller/level-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return r});var z=M("./src/types/level.ts"),U=M("./src/events.ts"),L=M("./src/errors.ts"),H=M("./src/utils/codecs.ts"),F=M("./src/controller/level-helper.ts"),D=M("./src/controller/base-playlist-controller.ts"),I=M("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var n=1;n<arguments.length;n++){var h=arguments[n];for(var O in h)Object.prototype.hasOwnProperty.call(h,O)&&(a[O]=h[O])}return a},g.apply(this,arguments)}function f(a,n){for(var h=0;h<n.length;h++){var O=n[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function u(a,n,h){return n&&f(a.prototype,n),h&&f(a,h),a}function d(a,n){a.prototype=Object.create(n.prototype),a.prototype.constructor=a,s(a,n)}function s(a,n){return s=Object.setPrototypeOf||function(O,S){return O.__proto__=S,O},s(a,n)}var l=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),r=function(a){d(n,a);function n(O){var S;return S=a.call(this,O,"[level-controller]")||this,S._levels=[],S._firstLevel=-1,S._startLevel=void 0,S.currentLevelIndex=-1,S.manualLevelIndex=-1,S.onParsedComplete=void 0,S._registerListeners(),S}var h=n.prototype;return h._registerListeners=function(){var S=this.hls;S.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),S.on(U.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var S=this.hls;S.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),S.off(U.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var S=this._levels;S.forEach(function(x){x.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(S,x){var A=[],C=[],b=[],v,p={},c,E=!1,y=!1,_=!1;if(x.levels.forEach(function($){var B=$.attrs;E=E||!!($.width&&$.height),y=y||!!$.videoCodec,_=_||!!$.audioCodec,l&&$.audioCodec&&$.audioCodec.indexOf("mp4a.40.34")!==-1&&($.audioCodec=void 0);var R=$.bitrate+"-"+$.attrs.RESOLUTION+"-"+$.attrs.CODECS;c=p[R],c?c.url.push($.url):(c=new z.Level($),p[R]=c,A.push(c)),B&&(B.AUDIO&&Object(F.addGroupId)(c,"audio",B.AUDIO),B.SUBTITLES&&Object(F.addGroupId)(c,"text",B.SUBTITLES))}),(E||y)&&_&&(A=A.filter(function($){var B=$.videoCodec,R=$.width,G=$.height;return!!B||!!(R&&G)})),A=A.filter(function($){var B=$.audioCodec,R=$.videoCodec;return(!B||Object(H.isCodecSupportedInMp4)(B,"audio"))&&(!R||Object(H.isCodecSupportedInMp4)(R,"video"))}),x.audioTracks&&(C=x.audioTracks.filter(function($){return!$.audioCodec||Object(H.isCodecSupportedInMp4)($.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(C)),x.subtitles&&(b=x.subtitles,Object(F.assignTrackIdsByGroup)(b)),A.length>0){v=A[0].bitrate,A.sort(function($,B){return $.bitrate-B.bitrate}),this._levels=A;for(var P=0;P<A.length;P++)if(A[P].bitrate===v){this._firstLevel=P,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+v);break}var N=_&&!y,K={levels:A,audioTracks:C,subtitleTracks:b,firstLevel:this._firstLevel,stats:x.stats,audio:_,video:y,altAudio:!N&&C.some(function($){return!!$.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(S,x){if(a.prototype.onError.call(this,S,x),x.fatal)return;var A=x.context,C=this._levels[this.currentLevelIndex];if(A&&(A.type===I.PlaylistContextType.AUDIO_TRACK&&C.audioGroupIds&&A.groupId===C.audioGroupIds[C.urlId]||A.type===I.PlaylistContextType.SUBTITLE_TRACK&&C.textGroupIds&&A.groupId===C.textGroupIds[C.urlId])){this.redundantFailover(this.currentLevelIndex);return}var b=!1,v=!0,p;switch(x.details){case L.ErrorDetails.FRAG_LOAD_ERROR:case L.ErrorDetails.FRAG_LOAD_TIMEOUT:case L.ErrorDetails.KEY_LOAD_ERROR:case L.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var c=this._levels[x.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(p=x.frag.level)):p=x.frag.level}break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(v=!1),p=A.level),b=!0;break;case L.ErrorDetails.REMUX_ALLOC_ERROR:p=x.level,b=!0;break}p!==void 0&&this.recoverLevel(x,p,b,v)},h.recoverLevel=function(S,x,A,C){var b=S.details,v=this._levels[x];if(v.loadError++,A){var p=this.retryLoadingOrFail(S);if(p)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(C){var c=v.url.length;if(c>1&&v.loadError<c)S.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var E=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(b+": switch to "+E),S.levelRetry=!0,this.hls.nextAutoLevel=E)}}},h.redundantFailover=function(S){var x=this._levels[S],A=x.url.length;if(A>1){var C=(x.urlId+1)%A;this.warn("Switching to redundant URL-id "+C),this._levels.forEach(function(b){b.urlId=C}),this.level=S}},h.onFragLoaded=function(S,x){var A=x.frag;if(A!==void 0&&A.type===I.PlaylistLevelType.MAIN){var C=this._levels[A.level];C!==void 0&&(C.fragmentError=0,C.loadError=0)}},h.onLevelLoaded=function(S,x){var A,C=x.level,b=x.details,v=this._levels[C];if(!v){var p;this.warn("Invalid level index "+C),(p=x.deliveryDirectives)!==null&&p!==void 0&&p.skip&&(b.deltaUpdateFailed=!0);return}C===this.currentLevelIndex?(v.fragmentError===0&&(v.loadError=0,this.retryCount=0),this.playlistLoaded(C,x,v.details)):(A=x.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(b.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(S,x){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var C=-1,b=this.hls.audioTracks[x.id].groupId,v=0;v<A.audioGroupIds.length;v++)if(A.audioGroupIds[v]===b){C=v;break}C!==A.urlId&&(A.urlId=C,this.startLoad())}},h.loadPlaylist=function(S){var x=this.currentLevelIndex,A=this._levels[x];if(this.canLoad&&A&&A.url.length>0){var C=A.urlId,b=A.url[C];if(S)try{b=S.addDirectives(b)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+x+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+C+" "+b),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:b,level:x,id:C,deliveryDirectives:S||null})}},h.removeLevel=function(S,x){var A=function(v,p){return p!==x},C=this._levels.filter(function(b,v){return v!==S?!0:b.url.length>1&&x!==void 0?(b.url=b.url.filter(A),b.audioGroupIds&&(b.audioGroupIds=b.audioGroupIds.filter(A)),b.textGroupIds&&(b.textGroupIds=b.textGroupIds.filter(A)),b.urlId=0,!0):!1}).map(function(b,v){var p=b.details;return p!=null&&p.fragments&&p.fragments.forEach(function(c){c.level=v}),b});this._levels=C,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:C})},u(n,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var x,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===S&&(x=A[S])!==null&&x!==void 0&&x.details)return;if(S<0||S>=A.length){var C=S<0;if(this.hls.trigger(U.Events.ERROR,{type:L.ErrorTypes.OTHER_ERROR,details:L.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:C,reason:"invalid level idx"}),C)return;S=Math.min(S,A.length-1)}this.clearTimer();var b=this.currentLevelIndex,v=A[b],p=A[S];this.log("switching to level "+S+" from "+b),this.currentLevelIndex=S;var c=g({},p,{level:S,maxBitrate:p.maxBitrate,uri:p.uri,urlId:p.urlId});delete c._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,c);var E=p.details;if(!E||E.live){var y=this.switchParams(p.uri,v==null?void 0:v.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(S){this.manualLevelIndex=S,this._startLevel===void 0&&(this._startLevel=S),S!==-1&&(this.level=S)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(S){this._firstLevel=S}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var S=this.hls.config.startLevel;return S!==void 0?S:this._firstLevel}else return this._startLevel},set:function(S){this._startLevel=S}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(S){this.level=S,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=S)}}]),n}(D.default)},"./src/controller/level-helper.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"addGroupId",function(){return L}),M.d(V,"assignTrackIdsByGroup",function(){return H}),M.d(V,"updatePTS",function(){return F}),M.d(V,"updateFragPTSDTS",function(){return I}),M.d(V,"mergeDetails",function(){return g}),M.d(V,"mapPartIntersection",function(){return f}),M.d(V,"mapFragmentIntersection",function(){return u}),M.d(V,"adjustSliding",function(){return d}),M.d(V,"addSliding",function(){return s}),M.d(V,"computeReloadInterval",function(){return l}),M.d(V,"getFragmentWithSN",function(){return r}),M.d(V,"getPartWith",function(){return a});var z=M("./src/polyfills/number.ts"),U=M("./src/utils/logger.ts");function L(n,h,O){switch(h){case"audio":n.audioGroupIds||(n.audioGroupIds=[]),n.audioGroupIds.push(O);break;case"text":n.textGroupIds||(n.textGroupIds=[]),n.textGroupIds.push(O);break}}function H(n){var h={};n.forEach(function(O){var S=O.groupId||"";O.id=h[S]=h[S]||0,h[S]++})}function F(n,h,O){var S=n[h],x=n[O];D(S,x)}function D(n,h){var O=h.startPTS;if(Object(z.isFiniteNumber)(O)){var S=0,x;h.sn>n.sn?(S=O-n.start,x=n):(S=n.start-O,x=h),x.duration!==S&&(x.duration=S)}else if(h.sn>n.sn){var A=n.cc===h.cc;A&&n.minEndPTS?h.start=n.start+(n.minEndPTS-n.start):h.start=n.start+n.duration}else h.start=Math.max(n.start-h.duration,0)}function I(n,h,O,S,x,A){var C=S-O;C<=0&&(U.logger.warn("Fragment should have a positive duration",h),S=O+h.duration,A=x+h.duration);var b=O,v=S,p=h.startPTS,c=h.endPTS;if(Object(z.isFiniteNumber)(p)){var E=Math.abs(p-O);Object(z.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(E,h.deltaPTS):h.deltaPTS=E,b=Math.max(O,p),O=Math.min(O,p),x=Math.min(x,h.startDTS),v=Math.min(S,c),S=Math.max(S,c),A=Math.max(A,h.endDTS)}h.duration=S-O;var y=O-h.start;h.appendedPTS=S,h.start=h.startPTS=O,h.maxStartPTS=b,h.startDTS=x,h.endPTS=S,h.minEndPTS=v,h.endDTS=A;var _=h.sn;if(!n||_<n.startSN||_>n.endSN)return 0;var P,N=_-n.startSN,K=n.fragments;for(K[N]=h,P=N;P>0;P--)D(K[P],K[P-1]);for(P=N;P<K.length-1;P++)D(K[P],K[P+1]);return n.fragmentHint&&D(K[K.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,y}function g(n,h){for(var O=null,S=n.fragments,x=S.length-1;x>=0;x--){var A=S[x].initSegment;if(A){O=A;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;var C=0,b;if(u(n,h,function(P,N){P.relurl&&(C=P.cc-N.cc),Object(z.isFiniteNumber)(P.startPTS)&&Object(z.isFiniteNumber)(P.endPTS)&&(N.start=N.startPTS=P.startPTS,N.startDTS=P.startDTS,N.appendedPTS=P.appendedPTS,N.maxStartPTS=P.maxStartPTS,N.endPTS=P.endPTS,N.endDTS=P.endDTS,N.minEndPTS=P.minEndPTS,N.duration=P.endPTS-P.startPTS,N.duration&&(b=N),h.PTSKnown=h.alignedSliding=!0),N.elementaryStreams=P.elementaryStreams,N.loader=P.loader,N.stats=P.stats,N.urlId=P.urlId,P.initSegment&&(N.initSegment=P.initSegment,O=P.initSegment)}),O){var v=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;v.forEach(function(P){var N;(!P.initSegment||P.initSegment.relurl===((N=O)===null||N===void 0?void 0:N.relurl))&&(P.initSegment=O)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(P){return!P}),h.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=h.skippedSegments;p--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var c=h.fragments;if(C){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<c.length;E++)c[E].cc+=C}h.skippedSegments&&(h.startCC=h.fragments[0].cc),f(n.partList,h.partList,function(P,N){N.elementaryStreams=P.elementaryStreams,N.stats=P.stats}),b?I(h,b,b.startPTS,b.endPTS,b.startDTS,b.endDTS):d(n,h),c.length&&(h.totalduration=h.edge-c[0].start),h.driftStartTime=n.driftStartTime,h.driftStart=n.driftStart;var y=h.advancedDateTime;if(h.advanced&&y){var _=h.edge;h.driftStart||(h.driftStartTime=y,h.driftStart=_),h.driftEndTime=y,h.driftEnd=_}else h.driftEndTime=n.driftEndTime,h.driftEnd=n.driftEnd,h.advancedDateTime=n.advancedDateTime}function f(n,h,O){if(n&&h)for(var S=0,x=0,A=n.length;x<=A;x++){var C=n[x],b=h[x+S];C&&b&&C.index===b.index&&C.fragment.sn===b.fragment.sn?O(C,b):S--}}function u(n,h,O){for(var S=h.skippedSegments,x=Math.max(n.startSN,h.startSN)-h.startSN,A=(n.fragmentHint?1:0)+(S?h.endSN:Math.min(n.endSN,h.endSN))-h.startSN,C=h.startSN-n.startSN,b=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,v=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,p=x;p<=A;p++){var c=v[C+p],E=b[p];S&&!E&&p<S&&(E=h.fragments[p]=c),c&&E&&O(c,E)}}function d(n,h){var O=h.startSN+h.skippedSegments-n.startSN,S=n.fragments;if(O<0||O>=S.length)return;s(h,S[O].start)}function s(n,h){if(h){for(var O=n.fragments,S=n.skippedSegments;S<O.length;S++)O[S].start+=h;n.fragmentHint&&(n.fragmentHint.start+=h)}}function l(n,h){var O=1e3*n.levelTargetDuration,S=O/2,x=n.age,A=x>0&&x<O*3,C=h.loading.end-h.loading.start,b,v=n.availabilityDelay;if(n.updated===!1)if(A){var p=333*n.misses;b=Math.max(Math.min(S,C*2),p),n.availabilityDelay=(n.availabilityDelay||0)+b}else b=S;else A?(v=Math.min(v||O/2,x),n.availabilityDelay=v,b=v+O-x):b=O-C;return Math.round(b)}function r(n,h,O){if(!n||!n.details)return null;var S=n.details,x=S.fragments[h-S.startSN];return x||(x=S.fragmentHint,x&&x.sn===h?x:h<S.startSN&&O&&O.sn===h?O:null)}function a(n,h,O){if(!n||!n.details)return null;var S=n.details.partList;if(S)for(var x=S.length;x--;){var A=S[x];if(A.index===O&&A.fragment.sn===h)return A}return null}},"./src/controller/stream-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return S});var z=M("./src/polyfills/number.ts"),U=M("./src/controller/base-stream-controller.ts"),L=M("./src/is-supported.ts"),H=M("./src/events.ts"),F=M("./src/utils/buffer-helper.ts"),D=M("./src/controller/fragment-tracker.ts"),I=M("./src/types/loader.ts"),g=M("./src/loader/fragment.ts"),f=M("./src/demux/transmuxer-interface.ts"),u=M("./src/types/transmuxer.ts"),d=M("./src/controller/gap-controller.ts"),s=M("./src/errors.ts"),l=M("./src/utils/logger.ts");function r(x,A){for(var C=0;C<A.length;C++){var b=A[C];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(x,b.key,b)}}function a(x,A,C){return A&&r(x.prototype,A),C&&r(x,C),x}function n(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,h(x,A)}function h(x,A){return h=Object.setPrototypeOf||function(b,v){return b.__proto__=v,b},h(x,A)}var O=100,S=function(x){n(A,x);function A(b,v){var p;return p=x.call(this,b,v,"[stream-controller]")||this,p.audioCodecSwap=!1,p.gapController=null,p.level=-1,p._forceStartLoad=!1,p.altAudio=!1,p.audioOnly=!1,p.fragPlaying=null,p.onvplaying=null,p.onvseeked=null,p.fragLastKbps=0,p.stalled=!1,p.couldBacktrack=!1,p.audioCodecSwitch=!1,p.videoBuffer=null,p._registerListeners(),p}var C=A.prototype;return C._registerListeners=function(){var v=this.hls;v.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),v.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.on(H.Events.ERROR,this.onError,this),v.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),v.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var v=this.hls;v.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.off(H.Events.ERROR,this.onError,this),v.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),v.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(v){if(this.levels){var p=this.lastCurrentTime,c=this.hls;if(this.stopLoad(),this.setInterval(O),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=c.startLevel;E===-1&&(c.config.testBandwidth?(E=0,this.bitrateTest=!0):E=c.nextAutoLevel),this.level=c.nextLoadLevel=E,this.loadedmetadata=!1}p>0&&v===-1&&(this.log("Override startPosition with lastCurrentTime @"+p.toFixed(3)),v=p),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=v,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var v,p=this.levels,c=this.level,E=p==null||((v=p[c])===null||v===void 0)?void 0:v.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var y,_=self.performance.now(),P=this.retryDate;(!P||_>=P||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},C.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var v,p,c=this.hls,E=this.levelLastLoaded,y=this.levels,_=this.media,P=c.config,N=c.nextLoadLevel;if(E===null||!_&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[N])return;var K=y[N];this.level=c.nextLoadLevel=N;var $=K.details;if(!$||this.state===U.State.WAITING_LEVEL||$.live&&this.levelLastLoaded!==N){this.state=U.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,I.PlaylistLevelType.MAIN);if(B===null)return;var R=B.len,G=this.getMaxBufferLength(K.maxBitrate);if(R>=G)return;if(this._streamEnded(B,$)){var Q={};this.altAudio&&(Q.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,Q),this.state=U.State.ENDED;return}var ne=B.end,le=this.getNextFragment(ne,$);if(this.couldBacktrack&&!this.fragPrevious&&le&&le.sn!=="initSegment"){var _e=le.sn-$.startSN;_e>1&&(le=$.fragments[_e-1],this.fragmentTracker.removeFragment(le))}if(le&&this.fragmentTracker.getState(le)===D.FragmentState.OK&&this.nextLoadPosition>ne){var pe=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,pe,I.PlaylistLevelType.MAIN),le=this.getNextFragment(this.nextLoadPosition,$)}if(!le)return;le.initSegment&&!le.initSegment.data&&!this.bitrateTest&&(le=le.initSegment),((v=le.decryptdata)===null||v===void 0?void 0:v.keyFormat)==="identity"&&!((p=le.decryptdata)!==null&&p!==void 0&&p.key)?this.loadKey(le,$):this.loadFragment(le,$,ne)},C.loadFragment=function(v,p,c){var E,y=this.fragmentTracker.getState(v);if(this.fragCurrent=v,y===D.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(v);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else y=D.FragmentState.NOT_LOADED}y===D.FragmentState.NOT_LOADED||y===D.FragmentState.PARTIAL?v.sn==="initSegment"?this._loadInitSegment(v):this.bitrateTest?(v.bitrateTest=!0,this.log("Fragment "+v.sn+" of level "+v.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(v)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,v,p,c)):y===D.FragmentState.APPENDING?this.reduceMaxBufferLength(v.duration)&&this.fragmentTracker.removeFragment(v):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(v){var p=this.fragmentTracker.getAppendedFrag(v,I.PlaylistLevelType.MAIN);return p&&"fragment"in p?p.fragment:p},C.getBufferedFrag=function(v){return this.fragmentTracker.getBufferedFrag(v,I.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(v){return v?this.getBufferedFrag(v.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var v=this.levels,p=this.media;if(p!=null&&p.readyState){var c,E=this.getAppendedFrag(p.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!p.paused&&v){var y=this.hls.nextLoadLevel,_=v[y],P=this.fragLastKbps;P&&this.fragCurrent?c=this.fragCurrent.duration*_.maxBitrate/(1e3*P)+1:c=0}else c=0;var N=this.getBufferedFrag(p.currentTime+c);if(N){var K=this.followingBufferedFrag(N);if(K){this.abortCurrentFrag();var $=K.maxStartPTS?K.maxStartPTS:K.start,B=K.duration,R=Math.max(N.end,$+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(R,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var v=this.fragCurrent;this.fragCurrent=null,v!=null&&v.loader&&v.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(v,p){x.prototype.flushMainBuffer.call(this,v,p,this.altAudio?"video":null)},C.onMediaAttached=function(v,p){x.prototype.onMediaAttached.call(this,v,p);var c=p.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),c.addEventListener("playing",this.onvplaying),c.addEventListener("seeked",this.onvseeked),this.gapController=new d.default(this.config,c,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var v=this.media;v&&(v.removeEventListener("playing",this.onvplaying),v.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var v=this.media,p=v?v.currentTime:null;Object(z.isFiniteNumber)(p)&&this.log("Media seeked to "+p.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},C.onManifestParsed=function(v,p){var c=!1,E=!1,y;p.levels.forEach(function(_){y=_.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(c=!0),y.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=c&&E&&!Object(L.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=p.levels,this.startFragRequested=!1},C.onLevelLoading=function(v,p){var c=this.levels;if(!c||this.state!==U.State.IDLE)return;var E=c[p.level];(!E.details||E.details.live&&this.levelLastLoaded!==p.level||this.waitForCdnTuneIn(E.details))&&(this.state=U.State.WAITING_LEVEL)},C.onLevelLoaded=function(v,p){var c,E=this.levels,y=p.level,_=p.details,P=_.totalduration;if(!E){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+P);var N=this.fragCurrent;N&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==p.level&&N.loader&&(this.state=U.State.IDLE,N.loader.abort()));var K=E[y],$=0;if(_.live||(c=K.details)!==null&&c!==void 0&&c.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;$=this.alignPlaylists(_,K.details)}if(K.details=_,this.levelLastLoaded=y,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:_,level:y}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=U.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,$),this.tick()},C._handleFragmentLoadProgress=function(v){var p,c=v.frag,E=v.part,y=v.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered");return}var P=_[c.level],N=P.details;if(!N){this.warn("Dropping fragment "+c.sn+" of level "+c.level+" after level details were reset");return}var K=P.videoCodec,$=N.PTSKnown||!N.live,B=(p=c.initSegment)===null||p===void 0?void 0:p.data,R=this._getAudioCodec(P),G=this.transmuxer=this.transmuxer||new f.default(this.hls,I.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Q=E?E.index:-1,ne=Q!==-1,le=new u.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,y.byteLength,Q,ne),_e=this.initPTS[c.cc];G.push(y,B,R,K,c,E,N.totalduration,$,le,_e)},C.onAudioTrackSwitching=function(v,p){var c=this.altAudio,E=!!p.url,y=p.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;c&&P.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:y})}},C.onAudioTrackSwitched=function(v,p){var c=p.id,E=!!this.hls.audioTracks[c].url;if(E){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=E,this.tick()},C.onBufferCreated=function(v,p){var c=p.tracks,E,y,_=!1;for(var P in c){var N=c[P];if(N.id==="main"){if(y=P,E=N,P==="video"){var K=c[P];K&&(this.videoBuffer=K.buffer)}}else _=!0}_&&E?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(v,p){var c=p.frag,E=p.part;if(c&&c.type!==I.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(c)){this.warn("Fragment "+c.sn+(E?" p: "+E.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var y=E?E.stats:c.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),c.sn!=="initSegment"&&(this.fragPrevious=c),this.fragBufferedComplete(c,E)},C.onError=function(v,p){switch(p.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.MAIN,p);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(p.fatal?(this.warn(""+p.details),this.state=U.State.ERROR):!p.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(p.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var c=!0,E=this.getFwdBufferInfo(this.media,I.PlaylistLevelType.MAIN);E&&E.len>.5&&(c=!this.reduceMaxBufferLength(E.len)),c&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var v=this.media,p=this.gapController;if(!v||!p||!v.readyState)return;var c=F.BufferHelper.getBuffered(v);!this.loadedmetadata&&c.length?(this.loadedmetadata=!0,this.seekToStartPos()):p.poll(this.lastCurrentTime),this.lastCurrentTime=v.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(v,p){var c=p.type;if(c!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(c===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,c,I.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(v,p){this.levels=p.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var v=this.media,p=v.currentTime,c=this.startPosition;if(c>=0&&p<c){if(v.seeking){l.logger.log("could not seek to "+c+", already seeking at "+p);return}var E=F.BufferHelper.getBuffered(v),y=E.length?E.start(0):0,_=y-c;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(l.logger.log("adjusting start position by "+_+" to match buffer start"),c+=_,this.startPosition=c),this.log("seek to target start position "+c+" from current time "+p),v.currentTime=c}},C._getAudioCodec=function(v){var p=this.config.defaultAudioCodec||v.audioCodec;return this.audioCodecSwap&&p&&(this.log("Swapping audio codec"),p.indexOf("mp4a.40.5")!==-1?p="mp4a.40.2":p="mp4a.40.5"),p},C._loadBitrateTestFrag=function(v){var p=this;this._doFragLoad(v).then(function(c){var E=p.hls;if(!c||E.nextLoadLevel||p.fragContextChanged(v))return;p.fragLoadError=0,p.state=U.State.IDLE,p.startFragRequested=!1,p.bitrateTest=!1;var y=v.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),E.trigger(H.Events.FRAG_LOADED,c)})},C._handleTransmuxComplete=function(v){var p,c="main",E=this.hls,y=v.remuxResult,_=v.chunkMeta,P=this.getCurrentContext(_);if(!P){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var N=P.frag,K=P.part,$=P.level,B=y.video,R=y.text,G=y.id3,Q=y.initSegment,ne=this.altAudio?void 0:y.audio;if(this.fragContextChanged(N))return;if(this.state=U.State.PARSING,Q){Q.tracks&&(this._bufferInitSegment($,Q.tracks,N,_),E.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:c,tracks:Q.tracks}));var le=Q.initPTS,_e=Q.timescale;Object(z.isFiniteNumber)(le)&&(this.initPTS[N.cc]=le,E.trigger(H.Events.INIT_PTS_FOUND,{frag:N,id:c,initPTS:le,timescale:_e}))}if(B&&y.independent!==!1){if($.details){var pe=B.startPTS,Ee=B.endPTS,Oe=B.startDTS,we=B.endDTS;if(K)K.elementaryStreams[B.type]={startPTS:pe,endPTS:Ee,startDTS:Oe,endDTS:we};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var he=this.getLoadPosition()+this.config.maxBufferHole;if(he<pe){this.backtrack(N);return}N.setElementaryStreamInfo(B.type,N.start,Ee,N.start,we,!0)}N.setElementaryStreamInfo(B.type,pe,Ee,Oe,we),this.bufferFragmentData(B,N,K,_)}}else if(y.independent===!1){this.backtrack(N);return}if(ne){var oe=ne.startPTS,Le=ne.endPTS,Ye=ne.startDTS,nt=ne.endDTS;K&&(K.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:Le,startDTS:Ye,endDTS:nt}),N.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,oe,Le,Ye,nt),this.bufferFragmentData(ne,N,K,_)}if(G!=null&&(p=G.samples)!==null&&p!==void 0&&p.length){var qe={frag:N,id:c,samples:G.samples};E.trigger(H.Events.FRAG_PARSING_METADATA,qe)}if(R){var it={frag:N,id:c,samples:R.samples};E.trigger(H.Events.FRAG_PARSING_USERDATA,it)}},C._bufferInitSegment=function(v,p,c,E){var y=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!p.audio&&!p.video,this.altAudio&&!this.audioOnly&&delete p.audio;var _=p.audio,P=p.video,N=p.audiovideo;if(_){var K=v.audioCodec,$=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),_.metadata.channelCount!==1&&$.indexOf("firefox")===-1&&(K="mp4a.40.5")),$.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),v.audioCodec&&v.audioCodec!==K&&this.log('Swapping manifest audio codec "'+v.audioCodec+'" for "'+K+'"'),_.levelCodec=K,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(v.audioCodec||"")+"/"+_.codec+"]")}P&&(P.levelCodec=v.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(v.videoCodec||"")+"/"+P.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(v.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,p),Object.keys(p).forEach(function(B){var R=p[B],G=R.initSegment;G!=null&&G.byteLength&&y.hls.trigger(H.Events.BUFFER_APPENDING,{type:B,data:G,frag:c,part:null,chunkMeta:E,parent:c.type})}),this.tick()},C.backtrack=function(v){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(v);var p=this.fragmentTracker.backtrack(v);this.fragPrevious=null,this.nextLoadPosition=v.start,p?this.resetFragmentLoading(v):this.state=U.State.BACKTRACKING},C.checkFragmentChanged=function(){var v=this.media,p=null;if(v&&v.readyState>1&&v.seeking===!1){var c=v.currentTime;if(F.BufferHelper.isBuffered(v,c)?p=this.getAppendedFrag(c):F.BufferHelper.isBuffered(v,c+.1)&&(p=this.getAppendedFrag(c+.1)),p){var E=this.fragPlaying,y=p.level;(!E||p.sn!==E.sn||E.level!==y||p.urlId!==E.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:p}),(!E||E.level!==y)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=p)}}},a(A,[{key:"nextLevel",get:function(){var v=this.nextBufferedFrag;return v?v.level:-1}},{key:"currentLevel",get:function(){var v=this.media;if(v){var p=this.getAppendedFrag(v.currentTime);if(p)return p.level}return-1}},{key:"nextBufferedFrag",get:function(){var v=this.media;if(v){var p=this.getAppendedFrag(v.currentTime);return this.followingBufferedFrag(p)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"SubtitleStreamController",function(){return n});var z=M("./src/events.ts"),U=M("./src/utils/logger.ts"),L=M("./src/utils/buffer-helper.ts"),H=M("./src/controller/fragment-finders.ts"),F=M("./src/utils/discontinuities.ts"),D=M("./src/controller/level-helper.ts"),I=M("./src/controller/fragment-tracker.ts"),g=M("./src/controller/base-stream-controller.ts"),f=M("./src/types/loader.ts"),u=M("./src/types/level.ts");function d(h,O){for(var S=0;S<O.length;S++){var x=O[S];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(h,x.key,x)}}function s(h,O,S){return O&&d(h.prototype,O),S&&d(h,S),h}function l(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,r(h,O)}function r(h,O){return r=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},r(h,O)}var a=500,n=function(h){l(O,h);function O(x,A){var C;return C=h.call(this,x,A,"[subtitle-stream-controller]")||this,C.levels=[],C.currentTrackId=-1,C.tracksBuffered=[],C.mainDetails=null,C._registerListeners(),C}var S=O.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var A=this.hls;A.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(z.Events.ERROR,this.onError,this),A.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var A=this.hls;A.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(z.Events.ERROR,this.onError,this),A.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},S.onLevelLoaded=function(A,C){this.mainDetails=C.details},S.onSubtitleFragProcessed=function(A,C){var b=C.frag,v=C.success;if(this.fragPrevious=b,this.state=g.State.IDLE,!v)return;var p=this.tracksBuffered[this.currentTrackId];if(!p)return;for(var c,E=b.start,y=0;y<p.length;y++)if(E>=p[y].start&&E<=p[y].end){c=p[y];break}var _=b.start+b.duration;c?c.end=_:(c={start:E,end:_},p.push(c)),this.fragmentTracker.fragBuffered(b)},S.onBufferFlushing=function(A,C){var b=C.startOffset,v=C.endOffset;if(b===0&&v!==Number.POSITIVE_INFINITY){var p=this.currentTrackId,c=this.levels;if(!c.length||!c[p]||!c[p].details)return;var E=c[p].details,y=E.targetduration,_=v-y;if(_<=0)return;C.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(P){for(var N=0;N<P.length;){if(P[N].end<=_){P.shift();continue}else if(P[N].start<_)P[N].start=_;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(b,_,f.PlaylistLevelType.SUBTITLE)}},S.onError=function(A,C){var b,v=C.frag;if(!v||v.type!==f.PlaylistLevelType.SUBTITLE)return;(b=this.fragCurrent)!==null&&b!==void 0&&b.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},S.onSubtitleTracksUpdated=function(A,C){var b=this,v=C.subtitleTracks;this.tracksBuffered=[],this.levels=v.map(function(p){return new u.Level(p)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(p){b.tracksBuffered[p.id]=[]}),this.mediaBuffer=null},S.onSubtitleTrackSwitch=function(A,C){if(this.currentTrackId=C.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var b=this.levels[this.currentTrackId];b!=null&&b.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,b&&this.setInterval(a)},S.onSubtitleTrackLoaded=function(A,C){var b,v=C.details,p=C.id,c=this.currentTrackId,E=this.levels;if(!E.length)return;var y=E[c];if(p>=E.length||p!==c||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,v.live||(b=y.details)!==null&&b!==void 0&&b.live){var _=this.mainDetails;if(v.deltaUpdateFailed||!_)return;var P=_.fragments[0];if(!y.details)v.hasProgramDateTime&&_.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(v,_):P&&Object(D.addSliding)(v,P.start);else{var N=this.alignPlaylists(v,y.details);N===0&&P&&Object(D.addSliding)(v,P.start)}}if(y.details=v,this.levelLastLoaded=p,this.tick(),v.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var K=Object(H.findFragmentByPTS)(null,v.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},S._handleFragmentLoadComplete=function(A){var C=A.frag,b=A.payload,v=C.decryptdata,p=this.hls;if(this.fragContextChanged(C))return;if(b&&b.byteLength>0&&v&&v.key&&v.iv&&v.method==="AES-128"){var c=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(b),v.key.buffer,v.iv.buffer).then(function(E){var y=performance.now();p.trigger(z.Events.FRAG_DECRYPTED,{frag:C,payload:E,stats:{tstart:c,tdecrypt:y}})})}},S.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var A,C=this.currentTrackId,b=this.levels;if(!b.length||!b[C]||!b[C].details)return;var v=b[C].details,p=v.targetduration,c=this.config,E=this.media,y=L.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-p,c.maxBufferHole),_=y.end,P=y.len,N=this.getMaxBufferLength()+p;if(P>N)return;console.assert(v,"Subtitle track details are defined on idle subtitle stream controller tick");var K=v.fragments,$=K.length,B=v.edge,R,G=this.fragPrevious;if(_<B){var Q=c.maxFragLookUpTolerance;G&&v.hasProgramDateTime&&(R=Object(H.findFragmentByPDT)(K,G.endProgramDateTime,Q)),R||(R=Object(H.findFragmentByPTS)(G,K,_,Q),!R&&G&&G.start<K[0].start&&(R=K[0]))}else R=K[$-1];(A=R)!==null&&A!==void 0&&A.encrypted?(U.logger.log("Loading key for "+R.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:R})):R&&this.fragmentTracker.getState(R)===I.FragmentState.NOT_LOADED&&this.loadFragment(R,v,_)}},S.loadFragment=function(A,C,b){this.fragCurrent=A,h.prototype.loadFragment.call(this,A,C,b)},s(O,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),O}(g.default)},"./src/controller/subtitle-track-controller.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/events.ts"),U=M("./src/utils/texttrack-utils.ts"),L=M("./src/controller/base-playlist-controller.ts"),H=M("./src/types/loader.ts");function F(d,s){for(var l=0;l<s.length;l++){var r=s[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(d,r.key,r)}}function D(d,s,l){return s&&F(d.prototype,s),l&&F(d,l),d}function I(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,g(d,s)}function g(d,s){return g=Object.setPrototypeOf||function(r,a){return r.__proto__=a,r},g(d,s)}var f=function(d){I(s,d);function s(r){var a;return a=d.call(this,r,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var l=s.prototype;return l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},l.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(z.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(z.Events.ERROR,this.onError,this)},l.onMediaAttached=function(a,n){if(this.media=n.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)},l.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},l.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=u(this.media.textTracks);a.forEach(function(n){Object(U.clearCurrentCues)(n)}),this.subtitleTrack=-1,this.media=null},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},l.onManifestParsed=function(a,n){this.tracks=n.subtitleTracks},l.onSubtitleTrackLoaded=function(a,n){var h=n.id,O=n.details,S=this.trackId,x=this.tracksInGroup[S];if(!x){this.warn("Invalid subtitle track id "+h);return}var A=x.details;x.details=n.details,this.log("subtitle track "+h+" loaded ["+O.startSN+"-"+O.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,n,A))},l.onLevelLoading=function(a,n){this.switchLevel(n.level)},l.onLevelSwitching=function(a,n){this.switchLevel(n.level)},l.switchLevel=function(a){var n=this.hls.levels[a];if(!(n!=null&&n.textGroupIds))return;var h=n.textGroupIds[n.urlId];if(this.groupId!==h){var O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(C){return!h||C.groupId===h});this.tracksInGroup=S;var x=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=h;var A={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,A),x!==-1&&this.setSubtitleTrack(x,O)}},l.findTrackId=function(a){for(var n=this.tracksInGroup,h=0;h<n.length;h++){var O=n[h];if((!this.selectDefaultTrack||O.default)&&(!a||a===O.name))return O.id}return-1},l.onError=function(a,n){if(d.prototype.onError.call(this,a,n),n.fatal||!n.context)return;n.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},l.loadPlaylist=function(a){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var h=n.id,O=n.groupId,S=n.url;if(a)try{S=a.addDirectives(S)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:S,id:h,groupId:O,deliveryDirectives:a||null})}},l.toggleTrackModes=function(a){var n=this,h=this.media,O=this.subtitleDisplay,S=this.trackId;if(!h)return;var x=u(h.textTracks),A=x.filter(function(v){return v.groupId===n.groupId});if(a===-1)[].slice.call(x).forEach(function(v){v.mode="disabled"});else{var C=A[S];C&&(C.mode="disabled")}var b=A[a];b&&(b.mode=O?"showing":"hidden")},l.setSubtitleTrack=function(a,n){var h,O=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=O[a])!==null&&h!==void 0&&h.details)||a<-1||a>=O.length)return;this.clearTimer();var S=O[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,S){var x=S.id,A=S.groupId,C=A===void 0?"":A,b=S.name,v=S.type,p=S.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:C,name:b,type:v,url:p});var c=this.switchParams(S.url,n==null?void 0:n.details);this.loadPlaylist(c)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},l.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,n=u(this.media.textTracks),h=0;h<n.length;h++)if(n[h].mode==="hidden")a=h;else if(n[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},D(s,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,n)}}]),s}(L.default);function u(d){for(var s=[],l=0;l<d.length;l++){var r=d[l];r.kind==="subtitles"&&r.label&&s.push(d[l])}return s}V.default=f},"./src/controller/timeline-controller.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"TimelineController",function(){return u});var z=M("./src/polyfills/number.ts"),U=M("./src/events.ts"),L=M("./src/utils/cea-608-parser.ts"),H=M("./src/utils/output-filter.ts"),F=M("./src/utils/webvtt-parser.ts"),D=M("./src/utils/texttrack-utils.ts"),I=M("./src/utils/imsc1-ttml-parser.ts"),g=M("./src/types/loader.ts"),f=M("./src/utils/logger.ts"),u=function(){function r(n){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=l(),this.captionsProperties=void 0,this.hls=n,this.config=n.config,this.Cues=n.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 h=new H.default(this,"textTrack1"),O=new H.default(this,"textTrack2"),S=new H.default(this,"textTrack3"),x=new H.default(this,"textTrack4");this.cea608Parser1=new L.default(1,h,O),this.cea608Parser2=new L.default(3,S,x)}n.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(U.Events.FRAG_LOADING,this.onFragLoading,this),n.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=r.prototype;return a.destroy=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(U.Events.FRAG_LOADING,this.onFragLoading,this),h.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,O,S,x,A){for(var C=!1,b=A.length;b--;){var v=A[b],p=s(v[0],v[1],O,S);if(p>=0&&(v[0]=Math.min(v[0],O),v[1]=Math.max(v[1],S),C=!0,p/(S-O)>.5))return}if(C||A.push([O,S]),this.config.renderTextTracksNatively){var c=this.captionsTracks[h];this.Cues.newCue(c,O,S,x)}else{var E=this.Cues.newCue(null,O,S,x);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:E,track:h})}},a.onInitPtsFound=function(h,O){var S=this,x=O.frag,A=O.id,C=O.initPTS,b=O.timescale,v=this.unparsedVttFrags;A==="main"&&(this.initPTS[x.cc]=C,this.timescale[x.cc]=b),v.length&&(this.unparsedVttFrags=[],v.forEach(function(p){S.onFragLoaded(U.Events.FRAG_LOADED,p)}))},a.getExistingTrack=function(h){var O=this.media;if(O)for(var S=0;S<O.textTracks.length;S++){var x=O.textTracks[S];if(x[h])return x}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var O=this.captionsProperties,S=this.captionsTracks,x=this.media,A=O[h],C=A.label,b=A.languageCode,v=this.getExistingTrack(h);if(v)S[h]=v,Object(D.clearCurrentCues)(S[h]),Object(D.sendAddTrackEvent)(S[h],x);else{var p=this.createTextTrack("captions",C,b);p&&(p[h]=!0,S[h]=p)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var O=this.captionsProperties[h];if(!O)return;var S=O.label,x={_id:h,label:S,kind:"captions",default:O.media?!!O.media.default:!1,closedCaptions:O.media};this.nonNativeCaptionsTracks[h]=x,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},a.createTextTrack=function(h,O,S){var x=this.media;return x?x.addTextTrack(h,O,S):void 0},a.onMediaAttaching=function(h,O){this.media=O.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(O){Object(D.clearCurrentCues)(h[O]),delete h[O]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=l(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var h=this.media;if(!h)return;var O=h.textTracks;if(O)for(var S=0;S<O.length;S++)Object(D.clearCurrentCues)(O[S])},a.onSubtitleTracksUpdated=function(h,O){var S=this;this.textTracks=[];var x=O.subtitleTracks||[],A=x.some(function(p){return p.textCodec===I.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var C=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var b=this.media?this.media.textTracks:[];this.tracks.forEach(function(p,c){var E;if(c<b.length){for(var y=null,_=0;_<b.length;_++)if(d(b[_],p)){y=b[_];break}y&&(E=y)}E?Object(D.clearCurrentCues)(E):(E=S.createTextTrack("subtitles",p.name,p.lang),E&&(E.mode="disabled")),E&&(E.groupId=p.groupId,S.textTracks.push(E))})}else if(!C&&this.tracks&&this.tracks.length){var v=this.tracks.map(function(p){return{label:p.name,kind:p.type.toLowerCase(),default:p.default,subtitleTrack:p}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:v})}}},a.onManifestLoaded=function(h,O){var S=this;this.config.enableCEA708Captions&&O.captions&&O.captions.forEach(function(x){var A=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!A)return;var C="textTrack"+A[1],b=S.captionsProperties[C];if(!b)return;b.label=x.name,x.lang&&(b.languageCode=x.lang),b.media=x})},a.onFragLoading=function(h,O){var S=this.cea608Parser1,x=this.cea608Parser2,A=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(S&&x))return;if(O.frag.type===g.PlaylistLevelType.MAIN){var b,v,p=O.frag.sn,c=(b=O==null||((v=O.part)===null||v===void 0)?void 0:v.index)!=null?b:-1;p===A+1||p===A&&c===C+1||(S.reset(),x.reset()),this.lastSn=p,this.lastPartIndex=c}},a.onFragLoaded=function(h,O){var S=O.frag,x=O.payload,A=this.initPTS,C=this.unparsedVttFrags;if(S.type===g.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(z.isFiniteNumber)(A[S.cc])){C.push(O),A.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Missing initial subtitle PTS")});return}var b=S.decryptdata;if(b==null||b.key==null||b.method!=="AES-128"){var v=this.tracks[S.level],p=this.vttCCs;p[S.cc]||(p[S.cc]={start:S.start,prevCC:this.prevCC,new:!0},this.prevCC=S.cc),v&&v.textCodec===I.IMSC1_CODEC?this._parseIMSC1(S,x):this._parseVTTs(S,x,p)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,O){var S=this,x=this.hls;Object(I.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(A){S._appendCues(A,h.level),x.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(A){f.logger.log("Failed to parse IMSC1: "+A),x.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:A})})},a._parseVTTs=function(h,O,S){var x=this,A=this.hls;Object(F.parseWebVTT)(O,this.initPTS[h.cc],this.timescale[h.cc],S,h.cc,h.start,function(C){x._appendCues(C,h.level),A.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(C){x._fallbackToIMSC1(h,O),f.logger.log("Failed to parse VTT cue: "+C),A.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:C})})},a._fallbackToIMSC1=function(h,O){var S=this,x=this.tracks[h.level];x.textCodec||Object(I.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(){x.textCodec=I.IMSC1_CODEC,S._parseIMSC1(h,O)},function(){x.textCodec="wvtt"})},a._appendCues=function(h,O){var S=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[O];if(x.mode==="disabled")return;h.forEach(function(b){return Object(D.addCueToTrack)(x,b)})}else{var A=this.tracks[O],C=A.default?"default":"subtitles"+O;S.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:h,track:C})}},a.onFragDecrypted=function(h,O){var S=O.frag;if(S.type===g.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[S.cc])){this.unparsedVttFrags.push(O);return}this.onFragLoaded(U.Events.FRAG_LOADED,O)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,O){var S=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(S&&x))return;for(var A=0;A<O.samples.length;A++){var C=O.samples[A].bytes;if(C){var b=this.extractCea608Data(C);S.addData(O.samples[A].pts,b[0]),x.addData(O.samples[A].pts,b[1])}}},a.onBufferFlushing=function(h,O){var S=O.startOffset,x=O.endOffset,A=O.endOffsetSubtitles,C=O.type,b=this.media;if(!b||b.currentTime<x)return;if(!C||C==="video"){var v=this.captionsTracks;Object.keys(v).forEach(function(c){return Object(D.removeCuesInRange)(v[c],S,x)})}if(this.config.renderTextTracksNatively&&(S===0&&A!==void 0)){var p=this.textTracks;Object.keys(p).forEach(function(c){return Object(D.removeCuesInRange)(p[c],S,A)})}},a.extractCea608Data=function(h){for(var O=h[0]&31,S=2,x=[[],[]],A=0;A<O;A++){var C=h[S++],b=127&h[S++],v=127&h[S++],p=(4&C)!==0,c=3&C;if(b===0&&v===0)continue;p&&((c===0||c===1)&&(x[c].push(b),x[c].push(v)))}return x},r}();function d(r,a){return r&&r.label===a.name&&!(r.textTrack1||r.textTrack2)}function s(r,a,n,h){return Math.min(a,h)-Math.max(r,n)}function l(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return z});var z=function(){function U(H,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=F}var L=U.prototype;return L.decrypt=function(F,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,F)},U}()},"./src/crypt/aes-decryptor.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"removePadding",function(){return U}),M.d(V,"default",function(){return L});var z=M("./src/utils/typed-array.ts");function U(H){var F=H.byteLength,D=F&&new DataView(H.buffer).getUint8(F-1);return D?Object(z.sliceUint8)(H,0,F-D):H}var L=function(){function H(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var F=H.prototype;return F.uint8ArrayToUint32Array_=function(I){for(var g=new DataView(I),f=new Uint32Array(4),u=0;u<4;u++)f[u]=g.getUint32(u*4);return f},F.initTable=function(){var I=this.sBox,g=this.invSBox,f=this.subMix,u=f[0],d=f[1],s=f[2],l=f[3],r=this.invSubMix,a=r[0],n=r[1],h=r[2],O=r[3],S=new Uint32Array(256),x=0,A=0,C=0;for(C=0;C<256;C++)C<128?S[C]=C<<1:S[C]=C<<1^283;for(C=0;C<256;C++){var b=A^A<<1^A<<2^A<<3^A<<4;b=b>>>8^b&255^99,I[x]=b,g[b]=x;var v=S[x],p=S[v],c=S[p],E=S[b]*257^b*16843008;u[x]=E<<24|E>>>8,d[x]=E<<16|E>>>16,s[x]=E<<8|E>>>24,l[x]=E,E=c*16843009^p*65537^v*257^x*16843008,a[b]=E<<24|E>>>8,n[b]=E<<16|E>>>16,h[b]=E<<8|E>>>24,O[b]=E,x?(x=v^S[S[S[c^v]]],A^=S[S[A]]):x=A=1}},F.expandKey=function(I){for(var g=this.uint8ArrayToUint32Array_(I),f=!0,u=0;u<g.length&&f;)f=g[u]===this.key[u],u++;if(f)return;this.key=g;var d=this.keySize=g.length;if(d!==4&&d!==6&&d!==8)throw new Error("Invalid aes key size="+d);var s=this.ksRows=(d+6+1)*4,l,r,a=this.keySchedule=new Uint32Array(s),n=this.invKeySchedule=new Uint32Array(s),h=this.sBox,O=this.rcon,S=this.invSubMix,x=S[0],A=S[1],C=S[2],b=S[3],v,p;for(l=0;l<s;l++){if(l<d){v=a[l]=g[l];continue}p=v,l%d===0?(p=p<<8|p>>>24,p=h[p>>>24]<<24|h[p>>>16&255]<<16|h[p>>>8&255]<<8|h[p&255],p^=O[l/d|0]<<24):d>6&&l%d===4&&(p=h[p>>>24]<<24|h[p>>>16&255]<<16|h[p>>>8&255]<<8|h[p&255]),a[l]=v=(a[l-d]^p)>>>0}for(r=0;r<s;r++)l=s-r,r&3?p=a[l]:p=a[l-4],r<4||l<=4?n[r]=p:n[r]=x[h[p>>>24]]^A[h[p>>>16&255]]^C[h[p>>>8&255]]^b[h[p&255]],n[r]=n[r]>>>0},F.networkToHostOrderSwap=function(I){return I<<24|(I&65280)<<8|(I&16711680)>>8|I>>>24},F.decrypt=function(I,g,f){for(var u=this.keySize+6,d=this.invKeySchedule,s=this.invSBox,l=this.invSubMix,r=l[0],a=l[1],n=l[2],h=l[3],O=this.uint8ArrayToUint32Array_(f),S=O[0],x=O[1],A=O[2],C=O[3],b=new Int32Array(I),v=new Int32Array(b.length),p,c,E,y,_,P,N,K,$,B,R,G,Q,ne,le=this.networkToHostOrderSwap;g<b.length;){for($=le(b[g]),B=le(b[g+1]),R=le(b[g+2]),G=le(b[g+3]),_=$^d[0],P=G^d[1],N=R^d[2],K=B^d[3],Q=4,ne=1;ne<u;ne++)p=r[_>>>24]^a[P>>16&255]^n[N>>8&255]^h[K&255]^d[Q],c=r[P>>>24]^a[N>>16&255]^n[K>>8&255]^h[_&255]^d[Q+1],E=r[N>>>24]^a[K>>16&255]^n[_>>8&255]^h[P&255]^d[Q+2],y=r[K>>>24]^a[_>>16&255]^n[P>>8&255]^h[N&255]^d[Q+3],_=p,P=c,N=E,K=y,Q=Q+4;p=s[_>>>24]<<24^s[P>>16&255]<<16^s[N>>8&255]<<8^s[K&255]^d[Q],c=s[P>>>24]<<24^s[N>>16&255]<<16^s[K>>8&255]<<8^s[_&255]^d[Q+1],E=s[N>>>24]<<24^s[K>>16&255]<<16^s[_>>8&255]<<8^s[P&255]^d[Q+2],y=s[K>>>24]<<24^s[_>>16&255]<<16^s[P>>8&255]<<8^s[N&255]^d[Q+3],v[g]=le(p^S),v[g+1]=le(y^x),v[g+2]=le(E^A),v[g+3]=le(c^C),S=$,x=B,A=R,C=G,g=g+4}return v.buffer},H}()},"./src/crypt/decrypter.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return g});var z=M("./src/crypt/aes-crypto.ts"),U=M("./src/crypt/fast-aes-key.ts"),L=M("./src/crypt/aes-decryptor.ts"),H=M("./src/utils/logger.ts"),F=M("./src/utils/mp4-tools.ts"),D=M("./src/utils/typed-array.ts"),I=16,g=function(){function f(d,s,l){var r=l===void 0?{}:l,a=r.removePKCS7Padding,n=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=d,this.config=s,this.removePKCS7Padding=n,n)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(O){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var u=f.prototype;return u.destroy=function(){this.observer=null},u.isSync=function(){return this.config.enableSoftwareAES},u.flush=function(){var s=this.currentResult;if(!s){this.reset();return}var l=new Uint8Array(s);return this.reset(),this.removePKCS7Padding?Object(L.removePadding)(l):l},u.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},u.decrypt=function(s,l,r,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(s),l,r);var n=this.flush();n&&a(n.buffer)}else this.webCryptoDecrypt(new Uint8Array(s),l,r).then(a)},u.softwareDecrypt=function(s,l,r){var a=this.currentIV,n=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(s=Object(F.appendUint8Array)(h,s),this.remainderData=null);var O=this.getValidChunk(s);if(!O.length)return null;a&&(r=a);var S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new L.default),S.expandKey(l);var x=n;return this.currentResult=S.decrypt(O.buffer,0,r),this.currentIV=Object(D.sliceUint8)(O,-16).buffer,x||null},u.webCryptoDecrypt=function(s,l,r){var a=this,n=this.subtle;return(this.key!==l||!this.fastAesKey)&&(this.key=l,this.fastAesKey=new U.default(n,l)),this.fastAesKey.expandKey().then(function(h){if(!n)return Promise.reject(new Error("web crypto not initialized"));var O=new z.default(n,r);return O.decrypt(s.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,s,l,r)})},u.onWebCryptoError=function(s,l,r,a){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",s),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(l,r,a)},u.getValidChunk=function(s){var l=s,r=s.length-s.length%I;return r!==s.length&&(l=Object(D.sliceUint8)(s,0,r),this.remainderData=Object(D.sliceUint8)(s,r)),l},u.logOnce=function(s){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+s),this.logEnabled=!1},f}()},"./src/crypt/fast-aes-key.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return z});var z=function(){function U(H,F){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=F}var L=U.prototype;return L.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/demux/base-audio-demuxer.ts"),U=M("./src/demux/adts.ts"),L=M("./src/utils/logger.ts"),H=M("./src/demux/id3.ts");function F(g,f){g.prototype=Object.create(f.prototype),g.prototype.constructor=g,D(g,f)}function D(g,f){return D=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},D(g,f)}var I=function(g){F(f,g);function f(d,s){var l;return l=g.call(this)||this,l.observer=void 0,l.config=void 0,l.observer=d,l.config=s,l}var u=f.prototype;return u.resetInitSegment=function(s,l,r){g.prototype.resetInitSegment.call(this,s,l,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:s,duration:r,inputTimeScale:9e4,dropped:0}},f.probe=function(s){if(!s)return!1;for(var l=H.getID3Data(s,0)||[],r=l.length,a=s.length;r<a;r++)if(U.probe(s,r))return L.logger.log("ADTS sync word found !"),!0;return!1},u.canParse=function(s,l){return U.canParse(s,l)},u.appendFrame=function(s,l,r){U.initTrackConfig(s,this.observer,l,r,s.manifestCodec);var a=U.appendFrame(s,l,r,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},f}(z.default);I.minProbeByteLength=9,V.default=I},"./src/demux/adts.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"getAudioConfig",function(){return H}),M.d(V,"isHeaderPattern",function(){return F}),M.d(V,"getHeaderLength",function(){return D}),M.d(V,"getFullFrameLength",function(){return I}),M.d(V,"canGetFrameLength",function(){return g}),M.d(V,"isHeader",function(){return f}),M.d(V,"canParse",function(){return u}),M.d(V,"probe",function(){return d}),M.d(V,"initTrackConfig",function(){return s}),M.d(V,"getFrameDuration",function(){return l}),M.d(V,"parseFrameHeader",function(){return r}),M.d(V,"appendFrame",function(){return a});var z=M("./src/utils/logger.ts"),U=M("./src/errors.ts"),L=M("./src/events.ts");function H(n,h,O,S){var x,A,C,b,v=navigator.userAgent.toLowerCase(),p=S,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((h[O+2]&192)>>>6)+1;var E=(h[O+2]&60)>>>2;if(E>c.length-1){n.trigger(L.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return C=(h[O+2]&1)<<2,C|=(h[O+3]&192)>>>6,z.logger.log("manifest codec:"+S+", ADTS type:"+x+", samplingIndex:"+E),/firefox/i.test(v)?E>=6?(x=5,b=new Array(4),A=E-3):(x=2,b=new Array(2),A=E):v.indexOf("android")!==-1?(x=2,b=new Array(2),A=E):(x=5,b=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&E>=6?A=E-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(E>=6&&C===1||/vivaldi/i.test(v))||!S&&C===1)&&(x=2,b=new Array(2)),A=E)),b[0]=x<<3,b[0]|=(E&14)>>1,b[1]|=(E&1)<<7,b[1]|=C<<3,x===5&&(b[1]|=(A&14)>>1,b[2]=(A&1)<<7,b[2]|=2<<2,b[3]=0),{config:b,samplerate:c[E],channelCount:C,codec:"mp4a.40."+x,manifestCodec:p}}function F(n,h){return n[h]===255&&(n[h+1]&246)===240}function D(n,h){return n[h+1]&1?7:9}function I(n,h){return(n[h+3]&3)<<11|n[h+4]<<3|(n[h+5]&224)>>>5}function g(n,h){return h+5<n.length}function f(n,h){return h+1<n.length&&F(n,h)}function u(n,h){return g(n,h)&&F(n,h)&&I(n,h)<=n.length-h}function d(n,h){if(f(n,h)){var O=D(n,h);if(h+O>=n.length)return!1;var S=I(n,h);if(S<=O)return!1;var x=h+S;return x===n.length||f(n,x)}return!1}function s(n,h,O,S,x){if(!n.samplerate){var A=H(h,O,S,x);if(!A)return;n.config=A.config,n.samplerate=A.samplerate,n.channelCount=A.channelCount,n.codec=A.codec,n.manifestCodec=A.manifestCodec,z.logger.log("parsed codec:"+n.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function l(n){return 1024*9e4/n}function r(n,h,O,S,x){var A=D(n,h),C=I(n,h);if(C-=A,C>0){var b=O+S*x;return{headerLength:A,frameLength:C,stamp:b}}}function a(n,h,O,S,x){var A=l(n.samplerate),C=r(h,O,S,x,A);if(C){var b=C.frameLength,v=C.headerLength,p=C.stamp,c=v+b,E=Math.max(0,O+c-h.length),y;E?(y=new Uint8Array(c-v),y.set(h.subarray(O+v,h.length),0)):y=h.subarray(O+v,O+c);var _={unit:y,pts:p};return E||n.samples.push(_),{sample:_,length:c,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"initPTSFn",function(){return I});var z=M("./src/polyfills/number.ts"),U=M("./src/demux/id3.ts"),L=M("./src/demux/dummy-demuxed-track.ts"),H=M("./src/utils/mp4-tools.ts"),F=M("./src/utils/typed-array.ts"),D=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var f=g.prototype;return f.resetInitSegment=function(d,s,l){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},f.resetTimeStamp=function(){},f.resetContiguity=function(){},f.canParse=function(d,s){return!1},f.appendFrame=function(d,s,l){},f.demux=function(d,s){this.cachedData&&(d=Object(H.appendUint8Array)(this.cachedData,d),this.cachedData=null);var l=U.getID3Data(d,0),r=l?l.length:0,a,n,h=this._audioTrack,O=this._id3Track,S=l?U.getTimeStamp(l):void 0,x=d.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=I(S,s)),l&&l.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),n=this.initPTS;r<x;){if(this.canParse(d,r)){var A=this.appendFrame(h,d,r);A?(this.frameIndex++,n=A.sample.pts,r+=A.length,a=r):r=x}else U.canParse(d,r)?(l=U.getID3Data(d,r),O.samples.push({pts:n,dts:n,data:l}),r+=l.length,a=r):r++;if(r===x&&a!==x){var C=Object(F.sliceUint8)(d,a);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:h,avcTrack:Object(L.dummyTrack)(),id3Track:O,textTrack:Object(L.dummyTrack)()}},f.demuxSampleAes=function(d,s,l){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},f.flush=function(d){var s=this.cachedData;return s&&(this.cachedData=null,this.demux(s,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(L.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(L.dummyTrack)()}},f.destroy=function(){},g}(),I=function(f,u){return Object(z.isFiniteNumber)(f)?f*90:u*9e4};V.default=D},"./src/demux/chunk-cache.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return z});var z=function(){function L(){this.chunks=[],this.dataLength=0}var H=L.prototype;return H.push=function(D){this.chunks.push(D),this.dataLength+=D.length},H.flush=function(){var D=this.chunks,I=this.dataLength,g;if(D.length)D.length===1?g=D[0]:g=U(D,I);else return new Uint8Array(0);return this.reset(),g},H.reset=function(){this.chunks.length=0,this.dataLength=0},L}();function U(L,H){for(var F=new Uint8Array(H),D=0,I=0;I<L.length;I++){var g=L[I];F.set(g,D),D+=g.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/utils/logger.ts"),U=function(){function L(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var H=L.prototype;return H.loadWord=function(){var D=this.data,I=this.bytesAvailable,g=D.byteLength-I,f=new Uint8Array(4),u=Math.min(4,I);if(u===0)throw new Error("no bytes available");f.set(D.subarray(g,g+u)),this.word=new DataView(f.buffer).getUint32(0),this.bitsAvailable=u*8,this.bytesAvailable-=u},H.skipBits=function(D){var I;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,I=D>>3,D-=I>>3,this.bytesAvailable-=I,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},H.readBits=function(D){var I=Math.min(this.bitsAvailable,D),g=this.word>>>32-I;return D>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=I,this.bitsAvailable>0?this.word<<=I:this.bytesAvailable>0&&this.loadWord(),I=D-I,I>0&&this.bitsAvailable?g<<I|this.readBits(I):g},H.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},H.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(D){for(var I=8,g=8,f,u=0;u<D;u++)g!==0&&(f=this.readEG(),g=(I+f+256)%256),I=g===0?I:g},H.readSPS=function(){var D=0,I=0,g=0,f=0,u,d,s,l=this.readUByte.bind(this),r=this.readBits.bind(this),a=this.readUEG.bind(this),n=this.readBoolean.bind(this),h=this.skipBits.bind(this),O=this.skipEG.bind(this),S=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);l();var A=l();if(r(5),h(3),l(),S(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var C=a();if(C===3&&h(1),S(),S(),h(1),n())for(d=C!==3?8:12,s=0;s<d;s++)n()&&(s<6?x(16):x(64))}S();var b=a();if(b===0)a();else if(b===1)for(h(1),O(),O(),u=a(),s=0;s<u;s++)O();S(),h(1);var v=a(),p=a(),c=r(1);c===0&&h(1),h(1),n()&&(D=a(),I=a(),g=a(),f=a());var E=[1,1];if(n()&&n()){var y=l();switch(y){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[l()<<8|l(),l()<<8|l()];break}}}return{width:Math.ceil((v+1)*16-D*2-I*2),height:(2-c)*(p+1)*16-(c?2:4)*(g+f),pixelRatio:E}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},L}();V.default=U},"./src/demux/id3.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"isHeader",function(){return z}),M.d(V,"isFooter",function(){return U}),M.d(V,"getID3Data",function(){return L}),M.d(V,"canParse",function(){return F}),M.d(V,"getTimeStamp",function(){return D}),M.d(V,"isTimeStampFrame",function(){return I}),M.d(V,"getID3Frames",function(){return f}),M.d(V,"decodeFrame",function(){return u}),M.d(V,"utf8ArrayToStr",function(){return a}),M.d(V,"testables",function(){return n});var z=function(x,A){return A+10<=x.length&&(x[A]===73&&x[A+1]===68&&x[A+2]===51&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},U=function(x,A){return A+10<=x.length&&(x[A]===51&&x[A+1]===68&&x[A+2]===73&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},L=function(x,A){for(var C=A,b=0;z(x,A);){b+=10;var v=H(x,A+6);b+=v,U(x,A+10)&&(b+=10),A+=b}return b>0?x.subarray(C,C+b):void 0},H=function(x,A){var C=0;return C=(x[A]&127)<<21,C|=(x[A+1]&127)<<14,C|=(x[A+2]&127)<<7,C|=x[A+3]&127,C},F=function(x,A){return z(x,A)&&H(x,A+6)+10<=x.length-A},D=function(x){for(var A=f(x),C=0;C<A.length;C++){var b=A[C];if(I(b))return r(b)}return},I=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},g=function(x){var A=String.fromCharCode(x[0],x[1],x[2],x[3]),C=H(x,4),b=10;return{type:A,size:C,data:x.subarray(b,b+C)}},f=function(x){for(var A=0,C=[];z(x,A);){var b=H(x,A+6);A+=10;for(var v=A+b;A+8<v;){var p=g(x.subarray(A)),c=u(p);c&&C.push(c),A+=p.size+10}U(x,A)&&(A+=10)}return C},u=function(x){return x.type==="PRIV"?d(x):x.type[0]==="W"?l(x):s(x)},d=function(x){if(x.size<2)return;var A=a(x.data,!0),C=new Uint8Array(x.data.subarray(A.length+1));return{key:x.type,info:A,data:C.buffer}},s=function(x){if(x.size<2)return;if(x.type==="TXXX"){var A=1,C=a(x.data.subarray(A),!0);A+=C.length+1;var b=a(x.data.subarray(A));return{key:x.type,info:C,data:b}}var v=a(x.data.subarray(1));return{key:x.type,data:v}},l=function(x){if(x.type==="WXXX"){if(x.size<2)return;var A=1,C=a(x.data.subarray(A),!0);A+=C.length+1;var b=a(x.data.subarray(A));return{key:x.type,info:C,data:b}}var v=a(x.data);return{key:x.type,data:v}},r=function(x){if(x.data.byteLength===8){var A=new Uint8Array(x.data),C=A[3]&1,b=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return b/=45,C&&(b+=4772185884e-2),Math.round(b)}return},a=function(x,A){A===void 0&&(A=!1);var C=O();if(C){var b=C.decode(x);if(A){var v=b.indexOf("\0");return v!==-1?b.substring(0,v):b}return b.replace(/\0/g,"")}for(var p=x.length,c,E,y,_="",P=0;P<p;){if(c=x[P++],c===0&&A)return _;if(c===0||c===3)continue;switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(c);break;case 12:case 13:E=x[P++],_+=String.fromCharCode((c&31)<<6|E&63);break;case 14:E=x[P++],y=x[P++],_+=String.fromCharCode((c&15)<<12|(E&63)<<6|(y&63)<<0);break;default:}}return _},n={decodeTextFrame:s},h;function O(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/demux/base-audio-demuxer.ts"),U=M("./src/demux/id3.ts"),L=M("./src/utils/logger.ts"),H=M("./src/demux/mpegaudio.ts");function F(g,f){g.prototype=Object.create(f.prototype),g.prototype.constructor=g,D(g,f)}function D(g,f){return D=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},D(g,f)}var I=function(g){F(f,g);function f(){return g.apply(this,arguments)||this}var u=f.prototype;return u.resetInitSegment=function(s,l,r){g.prototype.resetInitSegment.call(this,s,l,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:r,inputTimeScale:9e4,dropped:0}},f.probe=function(s){if(!s)return!1;for(var l=U.getID3Data(s,0)||[],r=l.length,a=s.length;r<a;r++)if(H.probe(s,r))return L.logger.log("MPEG Audio sync word found !"),!0;return!1},u.canParse=function(s,l){return H.canParse(s,l)},u.appendFrame=function(s,l,r){return this.initPTS===null?void 0:H.appendFrame(s,l,r,this.initPTS,this.frameIndex)},f}(z.default);I.minProbeByteLength=4,V.default=I},"./src/demux/mp4demuxer.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/utils/mp4-tools.ts"),U=M("./src/demux/dummy-demuxed-track.ts"),L=function(){function H(D,I){this.remainderData=null,this.config=void 0,this.config=I}var F=H.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},H.probe=function(I){return Object(z.findBox)({data:I,start:0,end:Math.min(I.length,16384)},["moof"]).length>0},F.demux=function(I){var g=I,f=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(z.appendUint8Array)(this.remainderData,I));var u=Object(z.segmentValidRange)(g);this.remainderData=u.remainder,f.samples=u.valid||new Uint8Array}else f.samples=g;return{audioTrack:Object(U.dummyTrack)(),avcTrack:f,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},F.flush=function(){var I=Object(U.dummyTrack)();return I.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:I,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},F.demuxSampleAes=function(I,g,f){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},H}();L.minProbeByteLength=1024,V.default=L},"./src/demux/mpegaudio.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"appendFrame",function(){return D}),M.d(V,"parseHeader",function(){return I}),M.d(V,"isHeaderPattern",function(){return g}),M.d(V,"isHeader",function(){return f}),M.d(V,"canParse",function(){return u}),M.d(V,"probe",function(){return d});var z=null,U=[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],L=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function D(s,l,r,a,n){if(r+24>l.length)return;var h=I(l,r);if(h&&r+h.frameLength<=l.length){var O=h.samplesPerFrame*9e4/h.sampleRate,S=a+n*O,x={unit:l.subarray(r,r+h.frameLength),pts:S,dts:S};return s.config=[],s.channelCount=h.channelCount,s.samplerate=h.sampleRate,s.samples.push(x),{sample:x,length:h.frameLength,missing:0}}}function I(s,l){var r=s[l+1]>>3&3,a=s[l+1]>>1&3,n=s[l+2]>>4&15,h=s[l+2]>>2&3;if(r!==1&&n!==0&&n!==15&&h!==3){var O=s[l+2]>>1&1,S=s[l+3]>>6,x=r===3?3-a:a===3?3:4,A=U[x*14+n-1]*1e3,C=r===3?0:r===2?1:2,b=L[C*3+h],v=S===3?1:2,p=H[r][a],c=F[a],E=p*8*c,y=Math.floor(p*A/b+O)*c;if(z===null){var _=navigator.userAgent||"",P=_.match(/Chrome\/(\d+)/i);z=P?parseInt(P[1]):0}var N=!!z&&z<=87;return N&&a===2&&A>=224e3&&S===0&&(s[l+3]=s[l+3]|128),{sampleRate:b,channelCount:v,frameLength:y,samplesPerFrame:E}}}function g(s,l){return s[l]===255&&(s[l+1]&224)===224&&(s[l+1]&6)!==0}function f(s,l){return l+1<s.length&&g(s,l)}function u(s,l){var r=4;return g(s,l)&&r<=s.length-l}function d(s,l){if(l+1<s.length&&g(s,l)){var r=4,a=I(s,l),n=r;a!=null&&a.frameLength&&(n=a.frameLength);var h=l+n;return h===s.length||f(s,h)}return!1}},"./src/demux/sample-aes.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/crypt/decrypter.ts"),U=M("./src/demux/tsdemuxer.ts"),L=function(){function H(D,I,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new z.default(D,I,{removePKCS7Padding:!1})}var F=H.prototype;return F.decryptBuffer=function(I,g){this.decrypter.decrypt(I,this.keyData.key.buffer,this.keyData.iv.buffer,g)},F.decryptAacSample=function(I,g,f,u){var d=I[g].unit,s=d.subarray(16,d.length-d.length%16),l=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),r=this;this.decryptBuffer(l,function(a){var n=new Uint8Array(a);d.set(n,16),u||r.decryptAacSamples(I,g+1,f)})},F.decryptAacSamples=function(I,g,f){for(;;g++){if(g>=I.length){f();return}if(I[g].unit.length<32)continue;var u=this.decrypter.isSync();if(this.decryptAacSample(I,g,f,u),!u)return}},F.getAvcEncryptedData=function(I){for(var g=Math.floor((I.length-48)/160)*16+16,f=new Int8Array(g),u=0,d=32;d<=I.length-16;d+=160,u+=16)f.set(I.subarray(d,d+16),u);return f},F.getAvcDecryptedUnit=function(I,g){for(var f=new Uint8Array(g),u=0,d=32;d<=I.length-16;d+=160,u+=16)I.set(f.subarray(u,u+16),d);return I},F.decryptAvcSample=function(I,g,f,u,d,s){var l=Object(U.discardEPB)(d.data),r=this.getAvcEncryptedData(l),a=this;this.decryptBuffer(r.buffer,function(n){d.data=a.getAvcDecryptedUnit(l,n),s||a.decryptAvcSamples(I,g,f+1,u)})},F.decryptAvcSamples=function(I,g,f,u){if(I instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,f=0){if(g>=I.length){u();return}for(var d=I[g].units;!(f>=d.length);f++){var s=d[f];if(s.data.length<=48||s.type!==1&&s.type!==5)continue;var l=this.decrypter.isSync();if(this.decryptAvcSample(I,g,f,u,s,l),!l)return}}},H}();V.default=L},"./src/demux/transmuxer-interface.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return d});var z=M("./node_modules/webworkify-webpack/index.js"),U=M.n(z),L=M("./src/events.ts"),H=M("./src/demux/transmuxer.ts"),F=M("./src/utils/logger.ts"),D=M("./src/errors.ts"),I=M("./src/utils/mediasource-helper.ts"),g=M("./node_modules/eventemitter3/index.js"),f=M.n(g),u=Object(I.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function s(r,a,n,h){var O=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=r,this.id=a,this.onTransmuxComplete=n,this.onFlush=h;var S=r.config,x=function(p,c){c=c||{},c.frag=O.frag,c.id=O.id,r.trigger(p,c)};this.observer=new g.EventEmitter,this.observer.on(L.Events.FRAG_DECRYPTED,x),this.observer.on(L.Events.ERROR,x);var A={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},C=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var b;try{b=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),b.addEventListener("message",this.onwmsg),b.onerror=function(v){r.trigger(L.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(v.message+" ("+v.filename+":"+v.lineno+")")})},b.postMessage({cmd:"init",typeSupported:A,vendor:C,id:a,config:JSON.stringify(S)})}catch(v){F.logger.warn("Error in worker:",v),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),b&&self.URL.revokeObjectURL(b.objectURL),this.transmuxer=new H.default(this.observer,A,S,C,a),this.worker=null}}else this.transmuxer=new H.default(this.observer,A,S,C,a)}var l=s.prototype;return l.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},l.push=function(a,n,h,O,S,x,A,C,b,v){var p=this;b.transmuxing.start=self.performance.now();var c=this.transmuxer,E=this.worker,y=x?x.start:S.start,_=S.decryptdata,P=this.frag,N=!(P&&S.cc===P.cc),K=!(P&&b.level===P.level),$=P?b.sn-P.sn:-1,B=this.part?b.part-this.part.index:1,R=!K&&($===1||$===0&&B===1),G=self.performance.now();(K||$||S.stats.parsing.start===0)&&(S.stats.parsing.start=G),x&&(B||!R)&&(x.stats.parsing.start=G);var Q=new H.TransmuxState(N,R,C,K,y);if(!R||N){F.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+b.sn+" p: "+b.part+" level: "+b.level+" id: "+b.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+R+`
|
|
accurateTimeOffset: `+C+`
|
|
timeOffset: `+y);var ne=new H.TransmuxConfig(h,O,n,A,v);this.configureTransmuxer(ne)}if(this.frag=S,this.part=x,E)E.postMessage({cmd:"demux",data:a,decryptdata:_,chunkMeta:b,state:Q},a instanceof ArrayBuffer?[a]:[]);else if(c){var le=c.push(a,_,b,Q);Object(H.isPromise)(le)?le.then(function(_e){p.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(le)}},l.flush=function(a){var n=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:a});else if(h){var S=h.flush(a);Object(H.isPromise)(S)?S.then(function(x){n.handleFlushResult(x,a)}):this.handleFlushResult(S,a)}},l.handleFlushResult=function(a,n){var h=this;a.forEach(function(O){h.handleTransmuxComplete(O)}),this.onFlush(n)},l.onWorkerMessage=function(a){var n=a.data,h=this.hls;switch(n.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(n.data);break}case"flush":{this.onFlush(n.data);break}default:{n.data=n.data||{},n.data.frag=this.frag,n.data.id=this.id,h.trigger(n.event,n.data);break}}},l.configureTransmuxer=function(a){var n=this.worker,h=this.transmuxer;n?n.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},l.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},s}()},"./src/demux/transmuxer-worker.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return D});var z=M("./src/demux/transmuxer.ts"),U=M("./src/events.ts"),L=M("./src/utils/logger.ts"),H=M("./node_modules/eventemitter3/index.js"),F=M.n(H);function D(d){var s=new H.EventEmitter,l=function(a,n){d.postMessage({event:a,data:n})};s.on(U.Events.FRAG_DECRYPTED,l),s.on(U.Events.ERROR,l),d.addEventListener("message",function(r){var a=r.data;switch(a.cmd){case"init":{var n=JSON.parse(a.config);d.transmuxer=new z.default(s,a.typeSupported,n,a.vendor,a.id),Object(L.enableLogs)(n.debug),l("init",null);break}case"configure":{d.transmuxer.configure(a.config);break}case"demux":{var h=d.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(z.isPromise)(h)?h.then(function(x){I(d,x)}):I(d,h);break}case"flush":{var O=a.chunkMeta,S=d.transmuxer.flush(O);Object(z.isPromise)(S)?S.then(function(x){f(d,x,O)}):f(d,S,O);break}default:break}})}function I(d,s){if(u(s.remuxResult))return;var l=[],r=s.remuxResult,a=r.audio,n=r.video;a&&g(l,a),n&&g(l,n),d.postMessage({event:"transmuxComplete",data:s},l)}function g(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function f(d,s,l){s.forEach(function(r){I(d,r)}),d.postMessage({event:"flush",data:l})}function u(d){return!d.audio&&!d.video&&!d.text&&!d.id3&&!d.initSegment}},"./src/demux/transmuxer.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return n}),M.d(V,"isPromise",function(){return S}),M.d(V,"TransmuxConfig",function(){return x}),M.d(V,"TransmuxState",function(){return A});var z=M("./src/events.ts"),U=M("./src/errors.ts"),L=M("./src/crypt/decrypter.ts"),H=M("./src/demux/aacdemuxer.ts"),F=M("./src/demux/mp4demuxer.ts"),D=M("./src/demux/tsdemuxer.ts"),I=M("./src/demux/mp3demuxer.ts"),g=M("./src/remux/mp4-remuxer.ts"),f=M("./src/remux/passthrough-remuxer.ts"),u=M("./src/demux/chunk-cache.ts"),d=M("./src/utils/mp4-tools.ts"),s=M("./src/utils/logger.ts"),l;try{l=self.performance.now.bind(self.performance)}catch(C){s.logger.debug("Unable to use Performance API on this environment"),l=self.Date.now}var r=[{demux:D.default,remux:g.default},{demux:F.default,remux:f.default},{demux:H.default,remux:g.default},{demux:I.default,remux:g.default}],a=1024;r.forEach(function(C){var b=C.demux;a=Math.max(a,b.minProbeByteLength)});var n=function(){function C(v,p,c,E,y){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new u.default,this.observer=v,this.typeSupported=p,this.config=c,this.vendor=E,this.id=y}var b=C.prototype;return b.configure=function(p){this.transmuxConfig=p,this.decrypter&&this.decrypter.reset()},b.push=function(p,c,E,y){var _=this,P=E.transmuxing;P.executeStart=l();var N=new Uint8Array(p),K=this.cache,$=this.config,B=this.currentTransmuxState,R=this.transmuxConfig;y&&(this.currentTransmuxState=y);var G=h(N,c);if(G&&G.method==="AES-128"){var Q=this.getDecrypter();if($.enableSoftwareAES){var ne=Q.softwareDecrypt(N,G.key.buffer,G.iv.buffer);if(!ne)return P.executeEnd=l(),O(E);N=new Uint8Array(ne)}else return this.decryptionPromise=Q.webCryptoDecrypt(N,G.key.buffer,G.iv.buffer).then(function($e){var Qe=_.push($e,null,E);return _.decryptionPromise=null,Qe}),this.decryptionPromise}var le=y||B,_e=le.contiguous,pe=le.discontinuity,Ee=le.trackSwitch,Oe=le.accurateTimeOffset,we=le.timeOffset,he=R.audioCodec,oe=R.videoCodec,Le=R.defaultInitPts,Ye=R.duration,nt=R.initSegmentData;if((pe||Ee)&&this.resetInitSegment(nt,he,oe,Ye),pe&&this.resetInitialTimestamp(Le),_e||this.resetContiguity(),this.needsProbing(N,pe,Ee)){if(K.dataLength){var qe=K.flush();N=Object(d.appendUint8Array)(qe,N)}this.configureTransmuxer(N,R)}var it=this.transmux(N,G,we,Oe,E),He=this.currentTransmuxState;return He.contiguous=!0,He.discontinuity=!1,He.trackSwitch=!1,P.executeEnd=l(),it},b.flush=function(p){var c=this,E=p.transmuxing;E.executeStart=l();var y=this.decrypter,_=this.cache,P=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return c.flush(p)});var K=[],$=P.timeOffset;if(y){var B=y.flush();B&&K.push(this.push(B,null,p))}var R=_.dataLength;_.reset();var G=this.demuxer,Q=this.remuxer;if(!G||!Q)return R>=a&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=l(),[O(p)];var ne=G.flush($);return S(ne)?ne.then(function(le){return c.flushRemux(K,le,p),K}):(this.flushRemux(K,ne,p),K)},b.flushRemux=function(p,c,E){var y=c.audioTrack,_=c.avcTrack,P=c.id3Track,N=c.textTrack,K=this.currentTransmuxState,$=K.accurateTimeOffset,B=K.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var R=this.remuxer.remux(y,_,P,N,B,$,!0,this.id);p.push({remuxResult:R,chunkMeta:E}),E.transmuxing.executeEnd=l()},b.resetInitialTimestamp=function(p){var c=this.demuxer,E=this.remuxer;if(!c||!E)return;c.resetTimeStamp(p),E.resetTimeStamp(p)},b.resetContiguity=function(){var p=this.demuxer,c=this.remuxer;if(!p||!c)return;p.resetContiguity(),c.resetNextTimestamp()},b.resetInitSegment=function(p,c,E,y){var _=this.demuxer,P=this.remuxer;if(!_||!P)return;_.resetInitSegment(c,E,y),P.resetInitSegment(p,c,E)},b.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},b.transmux=function(p,c,E,y,_){var P;return c&&c.method==="SAMPLE-AES"?P=this.transmuxSampleAes(p,c,E,y,_):P=this.transmuxUnencrypted(p,E,y,_),P},b.transmuxUnencrypted=function(p,c,E,y){var _=this.demuxer.demux(p,c,!1,!this.config.progressive),P=_.audioTrack,N=_.avcTrack,K=_.id3Track,$=_.textTrack,B=this.remuxer.remux(P,N,K,$,c,E,!1,this.id);return{remuxResult:B,chunkMeta:y}},b.transmuxSampleAes=function(p,c,E,y,_){var P=this;return this.demuxer.demuxSampleAes(p,c,E).then(function(N){var K=P.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,E,y,!1,P.id);return{remuxResult:K,chunkMeta:_}})},b.configureTransmuxer=function(p,c){for(var E=this.config,y=this.observer,_=this.typeSupported,P=this.vendor,N=c.audioCodec,K=c.defaultInitPts,$=c.duration,B=c.initSegmentData,R=c.videoCodec,G,Q=0,ne=r.length;Q<ne;Q++)if(r[Q].demux.probe(p)){G=r[Q];break}G||(s.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:F.default,remux:f.default});var le=this.demuxer,_e=this.remuxer,pe=G.remux,Ee=G.demux;(!_e||!(_e instanceof pe))&&(this.remuxer=new pe(y,E,_,P)),(!le||!(le instanceof Ee))&&(this.demuxer=new Ee(y,E,_),this.probe=Ee.probe),this.resetInitSegment(B,N,R,$),this.resetInitialTimestamp(K)},b.needsProbing=function(p,c,E){return!this.demuxer||!this.remuxer||c||E},b.getDecrypter=function(){var p=this.decrypter;return p||(p=this.decrypter=new L.default(this.observer,this.config)),p},C}();function h(C,b){var v=null;return C.byteLength>0&&b!=null&&b.key!=null&&b.iv!==null&&b.method!=null&&(v=b),v}var O=function(b){return{remuxResult:{},chunkMeta:b}};function S(C){return"then"in C&&C.then instanceof Function}var x=function(b,v,p,c,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=b,this.videoCodec=v,this.initSegmentData=p,this.duration=c,this.defaultInitPts=E},A=function(b,v,p,c,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=b,this.contiguous=v,this.accurateTimeOffset=p,this.trackSwitch=c,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"discardEPB",function(){return O});var z=M("./src/demux/adts.ts"),U=M("./src/demux/mpegaudio.ts"),L=M("./src/demux/exp-golomb.ts"),H=M("./src/demux/id3.ts"),F=M("./src/demux/sample-aes.ts"),D=M("./src/events.ts"),I=M("./src/utils/mp4-tools.ts"),g=M("./src/utils/logger.ts"),f=M("./src/errors.ts"),u={video:1,audio:2,id3:3,text:4},d=function(){function S(A,C,b){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=C,this.typeSupported=b}S.probe=function(C){var b=S.syncOffset(C);return b<0?!1:(b&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+b+", junk ahead ?"),!0)},S.syncOffset=function(C){for(var b=Math.min(1e3,C.length-3*188),v=0;v<b;){if(C[v]===71&&C[v+188]===71&&C[v+2*188]===71)return v;v++}return-1},S.createTrack=function(C,b){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:u[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?b:void 0}};var x=S.prototype;return x.resetInitSegment=function(C,b,v){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=S.createTrack("video",v),this._audioTrack=S.createTrack("audio",v),this._id3Track=S.createTrack("id3",v),this._txtTrack=S.createTrack("text",v),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=C,this.videoCodec=b,this._duration=v},x.resetTimeStamp=function(){},x.resetContiguity=function(){var C=this._audioTrack,b=this._avcTrack,v=this._id3Track;C&&(C.pesData=null),b&&(b.pesData=null),v&&(v.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(C,b,v,p){v===void 0&&(v=!1),p===void 0&&(p=!1),v||(this.sampleAes=null);var c,E=this._avcTrack,y=this._audioTrack,_=this._id3Track,P=E.pid,N=E.pesData,K=y.pid,$=_.pid,B=y.pesData,R=_.pesData,G=!1,Q=this.pmtParsed,ne=this._pmtId,le=C.length;if(this.remainderData&&(C=Object(I.appendUint8Array)(this.remainderData,C),le=C.length,this.remainderData=null),le<188&&!p)return this.remainderData=C,{audioTrack:y,avcTrack:E,id3Track:_,textTrack:this._txtTrack};var _e=Math.max(0,S.syncOffset(C));le-=(le+_e)%188,le<C.byteLength&&!p&&(this.remainderData=new Uint8Array(C.buffer,le,C.buffer.byteLength-le));for(var pe=_e;pe<le;pe+=188)if(C[pe]===71){var Ee=!!(C[pe+1]&64),Oe=((C[pe+1]&31)<<8)+C[pe+2],we=(C[pe+3]&48)>>4,he=void 0;if(we>1){if(he=pe+5+C[pe+4],he===pe+188)continue}else he=pe+4;switch(Oe){case P:Ee&&(N&&(c=a(N))&&this.parseAVCPES(c,!1),N={data:[],size:0}),N&&(N.data.push(C.subarray(he,pe+188)),N.size+=pe+188-he);break;case K:Ee&&(B&&(c=a(B))&&(y.isAAC?this.parseAACPES(c):this.parseMPEGPES(c)),B={data:[],size:0}),B&&(B.data.push(C.subarray(he,pe+188)),B.size+=pe+188-he);break;case $:Ee&&(R&&(c=a(R))&&this.parseID3PES(c),R={data:[],size:0}),R&&(R.data.push(C.subarray(he,pe+188)),R.size+=pe+188-he);break;case 0:Ee&&(he+=C[he]+1),ne=this._pmtId=l(C,he);break;case ne:{Ee&&(he+=C[he]+1);var oe=r(C,he,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,v);P=oe.avc,P>0&&(E.pid=P),K=oe.audio,K>0&&(y.pid=K,y.isAAC=oe.isAAC),$=oe.id3,$>0&&(_.pid=$),G&&!Q&&(g.logger.log("reparse from beginning"),G=!1,pe=_e-188),Q=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=N,y.pesData=B,_.pesData=R;var Le={audioTrack:y,avcTrack:E,id3Track:_,textTrack:this._txtTrack};return p&&this.extractRemainingSamples(Le),Le},x.flush=function(){var C=this.remainderData;this.remainderData=null;var b;return C?b=this.demux(C,-1,!1,!0):b={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(b),this.sampleAes?this.decrypt(b,this.sampleAes):b},x.extractRemainingSamples=function(C){var b=C.audioTrack,v=C.avcTrack,p=C.id3Track,c=v.pesData,E=b.pesData,y=p.pesData,_;c&&(_=a(c))?(this.parseAVCPES(_,!0),v.pesData=null):v.pesData=c,E&&(_=a(E))?(b.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),b.pesData=null):(E!=null&&E.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),b.pesData=E),y&&(_=a(y))?(this.parseID3PES(_),p.pesData=null):p.pesData=y},x.demuxSampleAes=function(C,b,v){var p=this.demux(C,v,!0,!this.config.progressive),c=this.sampleAes=new F.default(this.observer,this.config,b);return this.decrypt(p,c)},x.decrypt=function(C,b){return new Promise(function(v){var p=C.audioTrack,c=C.avcTrack;p.samples&&p.isAAC?b.decryptAacSamples(p.samples,0,function(){c.samples?b.decryptAvcSamples(c.samples,0,0,function(){v(C)}):v(C)}):c.samples&&b.decryptAvcSamples(c.samples,0,0,function(){v(C)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(C,b){var v=this,p=this._avcTrack,c=this.parseAVCNALu(C.data),E=!1,y=this.avcSample,_,P=!1;C.data=null,y&&c.length&&!p.audFound&&(n(y,p),y=this.avcSample=s(!1,C.pts,C.dts,"")),c.forEach(function(N){switch(N.type){case 1:{_=!0,y||(y=v.avcSample=s(!0,C.pts,C.dts,"")),E&&(y.debug+="NDR "),y.frame=!0;var K=N.data;if(P&&K.length>4){var $=new L.default(K).readSliceType();($===2||$===4||$===7||$===9)&&(y.key=!0)}break}case 5:_=!0,y||(y=v.avcSample=s(!0,C.pts,C.dts,"")),E&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{_=!0,E&&y&&(y.debug+="SEI ");var B=new L.default(O(N.data));B.readUByte();for(var R=0,G=0,Q=!1,ne=0;!Q&&B.bytesAvailable>1;){R=0;do ne=B.readUByte(),R+=ne;while(ne===255);G=0;do ne=B.readUByte(),G+=ne;while(ne===255);if(R===4&&B.bytesAvailable!==0){Q=!0;var le=B.readUByte();if(le===181){var _e=B.readUShort();if(_e===49){var pe=B.readUInt();if(pe===1195456820){var Ee=B.readUByte();if(Ee===3){for(var Oe=B.readUByte(),we=B.readUByte(),he=31&Oe,oe=[Oe,we],Le=0;Le<he;Le++)oe.push(B.readUByte()),oe.push(B.readUByte()),oe.push(B.readUByte());h(v._txtTrack.samples,{type:3,pts:C.pts,bytes:oe})}}}}}else if(R===5&&B.bytesAvailable!==0){if(Q=!0,G>16){for(var Ye=[],nt=0;nt<16;nt++)Ye.push(B.readUByte().toString(16)),(nt===3||nt===5||nt===7||nt===9)&&Ye.push("-");for(var qe=G-16,it=new Uint8Array(qe),He=0;He<qe;He++)it[He]=B.readUByte();h(v._txtTrack.samples,{pts:C.pts,payloadType:R,uuid:Ye.join(""),userData:Object(H.utf8ArrayToStr)(it),userDataBytes:it})}}else if(G<B.bytesAvailable)for(var $e=0;$e<G;$e++)B.readUByte()}break}case 7:if(_=!0,P=!0,E&&y&&(y.debug+="SPS "),!p.sps){var Qe=new L.default(N.data),gt=Qe.readSPS();p.width=gt.width,p.height=gt.height,p.pixelRatio=gt.pixelRatio,p.sps=[N.data],p.duration=v._duration;for(var et=N.data.subarray(1,4),tt="avc1.",Je=0;Je<3;Je++){var vt=et[Je].toString(16);vt.length<2&&(vt="0"+vt),tt+=vt}p.codec=tt}break;case 8:_=!0,E&&y&&(y.debug+="PPS "),p.pps||(p.pps=[N.data]);break;case 9:_=!1,p.audFound=!0,y&&n(y,p),y=v.avcSample=s(!1,C.pts,C.dts,E?"AUD ":"");break;case 12:_=!1;break;default:_=!1,y&&(y.debug+="unknown NAL "+N.type+" ");break}if(y&&_){var wt=y.units;wt.push(N)}}),b&&y&&(n(y,p),this.avcSample=null)},x.getLastNalUnit=function(){var C,b=this.avcSample,v;if(!b||b.units.length===0){var p=this._avcTrack.samples;b=p[p.length-1]}if((C=b)!==null&&C!==void 0&&C.units){var c=b.units;v=c[c.length-1]}return v},x.parseAVCNALu=function(C){var b=C.byteLength,v=this._avcTrack,p=v.naluState||0,c=p,E=[],y=0,_,P,N,K=-1,$=0;for(p===-1&&(K=0,$=C[0]&31,p=0,y=1);y<b;){if(_=C[y++],!p){p=_?0:1;continue}if(p===1){p=_?0:2;continue}if(!_)p=3;else if(_===1){if(K>=0){var B={data:C.subarray(K,y-p-1),type:$};E.push(B)}else{var R=this.getLastNalUnit();if(R&&(c&&y<=4-c&&(R.state&&(R.data=R.data.subarray(0,R.data.byteLength-c))),P=y-p-1,P>0)){var G=new Uint8Array(R.data.byteLength+P);G.set(R.data,0),G.set(C.subarray(0,P),R.data.byteLength),R.data=G,R.state=0}}y<b?(N=C[y]&31,K=y,$=N,p=0):p=-1}else p=0}if(K>=0&&p>=0){var Q={data:C.subarray(K,b),type:$,state:p};E.push(Q)}if(E.length===0){var ne=this.getLastNalUnit();if(ne){var le=new Uint8Array(ne.data.byteLength+C.byteLength);le.set(ne.data,0),le.set(C,ne.data.byteLength),ne.data=le}}return v.naluState=p,E},x.parseAACPES=function(C){var b=0,v=this._audioTrack,p=this.aacOverFlow,c=C.data;if(p){this.aacOverFlow=null;var E=p.sample.unit.byteLength,y=Math.min(p.missing,E),_=E-y;p.sample.unit.set(c.subarray(0,y),_),v.samples.push(p.sample),b=p.missing}var P,N;for(P=b,N=c.length;P<N-1&&!z.isHeader(c,P);P++);if(P!==b){var K,$;if(P<N-1?(K="AAC PES did not start with ADTS header,offset:"+P,$=!1):(K="no ADTS header found in AAC PES",$=!0),g.logger.warn("parsing error:"+K),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:$,reason:K}),$)return}z.initTrackConfig(v,this.observer,c,P,this.audioCodec);var B;if(C.pts!==void 0)B=C.pts;else if(p){var R=z.getFrameDuration(v.samplerate);B=p.sample.pts+R}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;P<N;)if(z.isHeader(c,P)){if(P+5<N){var Q=z.appendFrame(v,c,P,B,G);if(Q)if(Q.missing)this.aacOverFlow=Q;else{P+=Q.length,G++;continue}}break}else P++},x.parseMPEGPES=function(C){var b=C.data,v=b.length,p=0,c=0,E=C.pts;if(E===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;c<v;)if(U.isHeader(b,c)){var y=U.appendFrame(this._audioTrack,b,c,E,p);if(y)c+=y.length,p++;else break}else c++},x.parseID3PES=function(C){if(C.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(C)},S}();d.minProbeByteLength=188;function s(S,x,A,C){return{key:S,frame:!1,pts:x,dts:A,units:[],debug:C,length:0}}function l(S,x){return(S[x+10]&31)<<8|S[x+11]}function r(S,x,A,C){var b={audio:-1,avc:-1,id3:-1,isAAC:!0},v=(S[x+1]&15)<<8|S[x+2],p=x+3+v-4,c=(S[x+10]&15)<<8|S[x+11];for(x+=12+c;x<p;){var E=(S[x+1]&31)<<8|S[x+2];switch(S[x]){case 207:if(!C){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:b.audio===-1&&(b.audio=E);break;case 21:b.id3===-1&&(b.id3=E);break;case 219:if(!C){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:b.avc===-1&&(b.avc=E);break;case 3:case 4:A?b.audio===-1&&(b.audio=E,b.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((S[x+3]&15)<<8|S[x+4])+5}return b}function a(S){var x=0,A,C,b,v,p,c=S.data;if(!S||S.size===0)return null;for(;c[0].length<19&&c.length>1;){var E=new Uint8Array(c[0].length+c[1].length);E.set(c[0]),E.set(c[1],c[0].length),c[0]=E,c.splice(1,1)}A=c[0];var y=(A[0]<<16)+(A[1]<<8)+A[2];if(y===1){if(C=(A[4]<<8)+A[5],C&&C>S.size-6)return null;var _=A[7];_&192&&(v=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,_&64?(p=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,v-p>60*9e4&&(g.logger.warn(Math.round((v-p)/9e4)+"s delta between PTS and DTS, align them"),v=p)):p=v),b=A[8];var P=b+9;if(S.size<=P)return null;S.size-=P;for(var N=new Uint8Array(S.size),K=0,$=c.length;K<$;K++){A=c[K];var B=A.byteLength;if(P)if(P>B){P-=B;continue}else A=A.subarray(P),B-=P,P=0;N.set(A,x),x+=B}return C&&(C-=b+3),{data:N,pts:v,dts:p,len:C}}return null}function n(S,x){if(S.units.length&&S.frame){if(S.pts===void 0){var A=x.samples,C=A.length;if(C){var b=A[C-1];S.pts=b.pts,S.dts=b.dts}else{x.dropped++;return}}x.samples.push(S)}S.debug.length&&g.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function h(S,x){var A=S.length;if(A>0){if(x.pts>=S[A-1].pts)S.push(x);else for(var C=A-1;C>=0;C--)if(x.pts<S[C].pts){S.splice(C,0,x);break}}else S.push(x)}function O(S){for(var x=S.byteLength,A=[],C=1;C<x-2;)S[C]===0&&S[C+1]===0&&S[C+2]===3?(A.push(C+2),C+=2):C++;if(A.length===0)return S;var b=x-A.length,v=new Uint8Array(b),p=0;for(C=0;C<b;p++,C++)p===A[0]&&(p++,A.shift()),v[C]=S[p];return v}V.default=d},"./src/errors.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"ErrorTypes",function(){return z}),M.d(V,"ErrorDetails",function(){return U});var z;(function(L){L.NETWORK_ERROR="networkError",L.MEDIA_ERROR="mediaError",L.KEY_SYSTEM_ERROR="keySystemError",L.MUX_ERROR="muxError",L.OTHER_ERROR="otherError"})(z||(z={}));var U;(function(L){L.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",L.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",L.KEY_SYSTEM_NO_SESSION="keySystemNoSession",L.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",L.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",L.MANIFEST_LOAD_ERROR="manifestLoadError",L.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",L.MANIFEST_PARSING_ERROR="manifestParsingError",L.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",L.LEVEL_EMPTY_ERROR="levelEmptyError",L.LEVEL_LOAD_ERROR="levelLoadError",L.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",L.LEVEL_SWITCH_ERROR="levelSwitchError",L.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",L.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",L.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",L.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",L.FRAG_LOAD_ERROR="fragLoadError",L.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",L.FRAG_DECRYPT_ERROR="fragDecryptError",L.FRAG_PARSING_ERROR="fragParsingError",L.REMUX_ALLOC_ERROR="remuxAllocError",L.KEY_LOAD_ERROR="keyLoadError",L.KEY_LOAD_TIMEOUT="keyLoadTimeOut",L.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",L.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",L.BUFFER_APPEND_ERROR="bufferAppendError",L.BUFFER_APPENDING_ERROR="bufferAppendingError",L.BUFFER_STALLED_ERROR="bufferStalledError",L.BUFFER_FULL_ERROR="bufferFullError",L.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",L.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",L.INTERNAL_EXCEPTION="internalException",L.INTERNAL_ABORTED="aborted",L.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"Events",function(){return z});var z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return S});var z=M("./node_modules/url-toolkit/src/url-toolkit.js"),U=M.n(z),L=M("./src/loader/playlist-loader.ts"),H=M("./src/loader/key-loader.ts"),F=M("./src/controller/id3-track-controller.ts"),D=M("./src/controller/latency-controller.ts"),I=M("./src/controller/level-controller.ts"),g=M("./src/controller/fragment-tracker.ts"),f=M("./src/controller/stream-controller.ts"),u=M("./src/is-supported.ts"),d=M("./src/utils/logger.ts"),s=M("./src/config.ts"),l=M("./node_modules/eventemitter3/index.js"),r=M.n(l),a=M("./src/events.ts"),n=M("./src/errors.ts");function h(x,A){for(var C=0;C<A.length;C++){var b=A[C];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(x,b.key,b)}}function O(x,A,C){return A&&h(x.prototype,A),C&&h(x,C),x}var S=function(){x.isSupported=function(){return Object(u.isSupported)()};function x(C){C===void 0&&(C={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new l.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 b=this.config=Object(s.mergeConfig)(x.DefaultConfig,C);this.userConfig=C,Object(d.enableLogs)(b.debug),this._autoLevelCapping=-1,b.progressive&&Object(s.enableStreamingMode)(b);var v=b.abrController,p=b.bufferController,c=b.capLevelController,E=b.fpsController,y=this.abrController=new v(this),_=this.bufferController=new p(this),P=this.capLevelController=new c(this),N=new E(this),K=new L.default(this),$=new H.default(this),B=new F.default(this),R=this.levelController=new I.default(this),G=new g.FragmentTracker(this),Q=this.streamController=new f.default(this,G);P.setStreamController(Q),N.setStreamController(Q);var ne=[R,Q];this.networkControllers=ne;var le=[K,$,y,_,P,N,B,G];this.audioTrackController=this.createController(b.audioTrackController,null,ne),this.createController(b.audioStreamController,G,ne),this.subtitleTrackController=this.createController(b.subtitleTrackController,null,ne),this.createController(b.subtitleStreamController,G,ne),this.createController(b.timelineController,null,le),this.emeController=this.createController(b.emeController,null,le),this.cmcdController=this.createController(b.cmcdController,null,le),this.latencyController=this.createController(D.default,null,le),this.coreComponents=le}var A=x.prototype;return A.createController=function(b,v,p){if(b){var c=v?new b(this,v):new b(this);return p&&p.push(c),c}return null},A.on=function(b,v,p){p===void 0&&(p=this),this._emitter.on(b,v,p)},A.once=function(b,v,p){p===void 0&&(p=this),this._emitter.once(b,v,p)},A.removeAllListeners=function(b){this._emitter.removeAllListeners(b)},A.off=function(b,v,p,c){p===void 0&&(p=this),this._emitter.off(b,v,p,c)},A.listeners=function(b){return this._emitter.listeners(b)},A.emit=function(b,v,p){return this._emitter.emit(b,v,p)},A.trigger=function(b,v){if(this.config.debug)return this.emit(b,b,v);try{return this.emit(b,b,v)}catch(p){d.logger.error("An internal error happened while handling event "+b+'. Error message: "'+p.message+'". Here is a stacktrace:',p),this.trigger(a.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:b,error:p})}return!1},A.listenerCount=function(b){return this._emitter.listenerCount(b)},A.destroy=function(){d.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(b){return b.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(b){return b.destroy()}),this.coreComponents.length=0},A.attachMedia=function(b){d.logger.log("attachMedia"),this._media=b,this.trigger(a.Events.MEDIA_ATTACHING,{media:b})},A.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(b){this.stopLoad();var v=this.media,p=this.url,c=this.url=z.buildAbsoluteURL(self.location.href,b,{alwaysNormalize:!0});d.logger.log("loadSource:"+c),v&&p&&p!==c&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(v)),this.trigger(a.Events.MANIFEST_LOADING,{url:b})},A.startLoad=function(b){b===void 0&&(b=-1),d.logger.log("startLoad("+b+")"),this.networkControllers.forEach(function(v){v.startLoad(b)})},A.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach(function(b){b.stopLoad()})},A.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){d.logger.log("recoverMediaError");var b=this._media;this.detachMedia(),b&&this.attachMedia(b)},A.removeLevel=function(b,v){v===void 0&&(v=0),this.levelController.removeLevel(b,v)},O(x,[{key:"levels",get:function(){var b=this.levelController.levels;return b||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(b){d.logger.log("set currentLevel:"+b),this.loadLevel=b,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(b){d.logger.log("set nextLevel:"+b),this.levelController.manualLevel=b,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(b){d.logger.log("set loadLevel:"+b),this.levelController.manualLevel=b}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(b){this.levelController.nextLoadLevel=b}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(b){d.logger.log("set firstLevel:"+b),this.levelController.firstLevel=b}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(b){d.logger.log("set startLevel:"+b),b!==-1&&(b=Math.max(b,this.minAutoLevel)),this.levelController.startLevel=b}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(b){var v=!!b;v!==this.config.capLevelToPlayerSize&&(v?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=v)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(b){this._autoLevelCapping!==b&&(d.logger.log("set autoLevelCapping:"+b),this._autoLevelCapping=b)}},{key:"bandwidthEstimate",get:function(){var b=this.abrController.bwEstimator;return b?b.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var b=this.levels,v=this.config.minAutoBitrate;if(!b)return 0;for(var p=b.length,c=0;c<p;c++)if(b[c].maxBitrate>v)return c;return 0}},{key:"maxAutoLevel",get:function(){var b=this.levels,v=this.autoLevelCapping,p;return v===-1&&b&&b.length?p=b.length-1:p=v,p}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(b){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,b)}},{key:"audioTracks",get:function(){var b=this.audioTrackController;return b?b.audioTracks:[]}},{key:"audioTrack",get:function(){var b=this.audioTrackController;return b?b.audioTrack:-1},set:function(b){var v=this.audioTrackController;v&&(v.audioTrack=b)}},{key:"subtitleTracks",get:function(){var b=this.subtitleTrackController;return b?b.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var b=this.subtitleTrackController;return b?b.subtitleTrack:-1},set:function(b){var v=this.subtitleTrackController;v&&(v.subtitleTrack=b)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var b=this.subtitleTrackController;return b?b.subtitleDisplay:!1},set:function(b){var v=this.subtitleTrackController;v&&(v.subtitleDisplay=b)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(b){this.config.lowLatencyMode=b}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return n.ErrorTypes}},{key:"ErrorDetails",get:function(){return n.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:s.hlsDefaultConfig},set:function(b){x.defaultConfig=b}}]),x}();S.defaultConfig=void 0},"./src/is-supported.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"isSupported",function(){return L}),M.d(V,"changeTypeSupported",function(){return H});var z=M("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function L(){var F=Object(z.getMediaSource)();if(!F)return!1;var D=U(),I=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!I&&!!g}function H(){var F,D=U();return typeof(D==null||((F=D.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return d}),M.d(V,"LoadError",function(){return l});var z=M("./src/polyfills/number.ts"),U=M("./src/errors.ts");function L(r,a){r.prototype=Object.create(a.prototype),r.prototype.constructor=r,g(r,a)}function H(r){var a=typeof Map=="function"?new Map:void 0;return H=function(h){if(h===null||!I(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,O)}function O(){return F(h,arguments,f(this).constructor)}return O.prototype=Object.create(h.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),g(O,h)},H(r)}function F(r,a,n){return D()?F=Reflect.construct:F=function(O,S,x){var A=[null];A.push.apply(A,S);var C=Function.bind.apply(O,A),b=new C;return x&&g(b,x.prototype),b},F.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function I(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function g(r,a){return g=Object.setPrototypeOf||function(h,O){return h.__proto__=O,h},g(r,a)}function f(r){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},f(r)}var u=Math.pow(2,17),d=function(){function r(n){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=n}var a=r.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,O){var S=this,x=h.url;if(!x)return Promise.reject(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var A=this.config,C=A.fLoader,b=A.loader;return new Promise(function(v,p){S.loader&&S.loader.destroy();var c=S.loader=h.loader=C?new C(A):new b(A),E=s(h),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:u};h.stats=c.stats,c.load(E,y,{onSuccess:function(P,N,K,$){S.resetLoader(h,c),v({frag:h,part:null,payload:P.data,networkDetails:$})},onError:function(P,N,K){S.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:P,networkDetails:K}))},onAbort:function(P,N,K){S.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:K}))},onTimeout:function(P,N,K){S.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:K}))},onProgress:function(P,N,K,$){O&&O({frag:h,part:null,payload:K,networkDetails:$})}})})},a.loadPart=function(h,O,S){var x=this;this.abort();var A=this.config,C=A.fLoader,b=A.loader;return new Promise(function(v,p){x.loader&&x.loader.destroy();var c=x.loader=h.loader=C?new C(A):new b(A),E=s(h,O),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:u};O.stats=c.stats,c.load(E,y,{onSuccess:function(P,N,K,$){x.resetLoader(h,c),x.updateStatsFromPart(h,O);var B={frag:h,part:O,payload:P.data,networkDetails:$};S(B),v(B)},onError:function(P,N,K){x.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:O,response:P,networkDetails:K}))},onAbort:function(P,N,K){h.stats.aborted=O.stats.aborted,x.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:O,networkDetails:K}))},onTimeout:function(P,N,K){x.resetLoader(h,c),p(new l({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:O,networkDetails:K}))}})})},a.updateStatsFromPart=function(h,O){var S=h.stats,x=O.stats,A=x.total;if(S.loaded+=x.loaded,A){var C=Math.round(h.duration/O.duration),b=Math.min(Math.round(S.loaded/A),C),v=C-b,p=v*Math.round(S.loaded/b);S.total=S.loaded+p}else S.total=Math.max(S.loaded,S.total);var c=S.loading,E=x.loading;c.start?c.first+=E.first-E.start:(c.start=E.start,c.first=E.first),c.end=E.end},a.resetLoader=function(h,O){h.loader=null,this.loader===O&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),O.destroy()},r}();function s(r,a){a===void 0&&(a=null);var n=a||r,h={frag:r,part:a,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},O=n.byteRangeStartOffset,S=n.byteRangeEndOffset;return Object(z.isFiniteNumber)(O)&&Object(z.isFiniteNumber)(S)&&(h.rangeStart=O,h.rangeEnd=S),h}var l=function(r){L(a,r);function a(n){for(var h,O=arguments.length,S=new Array(O>1?O-1:0),x=1;x<O;x++)S[x-1]=arguments[x];return h=r.call.apply(r,[this].concat(S))||this,h.data=void 0,h.data=n,h}return a}(H(Error))},"./src/loader/fragment.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"ElementaryStreamTypes",function(){return d}),M.d(V,"BaseSegment",function(){return s}),M.d(V,"Fragment",function(){return l}),M.d(V,"Part",function(){return r});var z=M("./src/polyfills/number.ts"),U=M("./node_modules/url-toolkit/src/url-toolkit.js"),L=M.n(U),H=M("./src/utils/logger.ts"),F=M("./src/loader/level-key.ts"),D=M("./src/loader/load-stats.ts");function I(a,n){a.prototype=Object.create(n.prototype),a.prototype.constructor=a,g(a,n)}function g(a,n){return g=Object.setPrototypeOf||function(O,S){return O.__proto__=S,O},g(a,n)}function f(a,n){for(var h=0;h<n.length;h++){var O=n[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function u(a,n,h){return n&&f(a.prototype,n),h&&f(a,h),a}var d;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(d||(d={}));var s=function(){function a(h){var O;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(O={},O[d.AUDIO]=null,O[d.VIDEO]=null,O[d.AUDIOVIDEO]=null,O),this.baseurl=h}var n=a.prototype;return n.setByteRange=function(O,S){var x=O.split("@",2),A=[];x.length===1?A[0]=S?S.byteRangeEndOffset:0:A[0]=parseInt(x[1]),A[1]=parseInt(x[0])+A[0],this._byteRange=A},u(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(O){this._url=O}}]),a}(),l=function(a){I(n,a);function n(O,S){var x;return x=a.call(this,S)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new D.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=O,x}var h=n.prototype;return h.createInitializationVector=function(S){for(var x=new Uint8Array(16),A=12;A<16;A++)x[A]=S>>8*(15-A)&255;return x},h.setDecryptDataFromLevelKey=function(S,x){var A=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(A=F.LevelKey.fromURI(S.uri),A.method=S.method,A.iv=this.createInitializationVector(x),A.keyFormat="identity"),A},h.setElementaryStreamInfo=function(S,x,A,C,b,v){v===void 0&&(v=!1);var p=this.elementaryStreams,c=p[S];if(!c){p[S]={startPTS:x,endPTS:A,startDTS:C,endDTS:b,partial:v};return}c.startPTS=Math.min(c.startPTS,x),c.endPTS=Math.max(c.endPTS,A),c.startDTS=Math.min(c.startDTS,C),c.endDTS=Math.max(c.endDTS,b)},h.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[d.AUDIO]=null,S[d.VIDEO]=null,S[d.AUDIOVIDEO]=null},u(n,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var S=this.sn;typeof S!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),S=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,S)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var S=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+S*1e3}},{key:"encrypted",get:function(){var S;return!!((S=this.decryptdata)!==null&&S!==void 0&&S.keyFormat&&this.decryptdata.uri)}}]),n}(s),r=function(a){I(n,a);function n(h,O,S,x,A){var C;C=a.call(this,S)||this,C.fragOffset=0,C.duration=0,C.gap=!1,C.independent=!1,C.relurl=void 0,C.fragment=void 0,C.index=void 0,C.stats=new D.LoadStats,C.duration=h.decimalFloatingPoint("DURATION"),C.gap=h.bool("GAP"),C.independent=h.bool("INDEPENDENT"),C.relurl=h.enumeratedString("URI"),C.fragment=O,C.index=x;var b=h.enumeratedString("BYTERANGE");return b&&C.setByteRange(b,A),A&&(C.fragOffset=A.fragOffset+A.duration),C}return u(n,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var O=this.elementaryStreams;return!!(O.audio||O.video||O.audiovideo)}}]),n}(s)},"./src/loader/key-loader.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return H});var z=M("./src/events.ts"),U=M("./src/errors.ts"),L=M("./src/utils/logger.ts"),H=function(){function F(I){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=I,this._registerListeners()}var D=F.prototype;return D._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var f=this.loaders[g];f&&f.destroy()}this.loaders={}},D.onKeyLoading=function(g,f){var u=f.frag,d=u.type,s=this.loaders[d];if(!u.decryptdata){L.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var l=u.decryptdata.uri;if(l!==this.decrypturl||this.decryptkey===null){var r=this.hls.config;if(s&&(L.logger.warn("abort previous key loader for type:"+d),s.abort()),!l){L.logger.warn("key uri is falsy");return}var a=r.loader,n=u.loader=this.loaders[d]=new a(r);this.decrypturl=l,this.decryptkey=null;var h={url:l,frag:u,responseType:"arraybuffer"},O={timeout:r.fragLoadingTimeOut,maxRetry:0,retryDelay:r.fragLoadingRetryDelay,maxRetryDelay:r.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};n.load(h,O,S)}else this.decryptkey&&(u.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:u}))},D.loadsuccess=function(g,f,u){var d=u.frag;if(!d.decryptdata){L.logger.error("after key load, decryptdata unset");return}this.decryptkey=d.decryptdata.key=new Uint8Array(g.data),d.loader=null,delete this.loaders[d.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:d})},D.loaderror=function(g,f){var u=f.frag,d=u.loader;d&&d.abort(),delete this.loaders[u.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:u,response:g})},D.loadtimeout=function(g,f){var u=f.frag,d=u.loader;d&&d.abort(),delete this.loaders[u.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:u})},F}()},"./src/loader/level-details.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"LevelDetails",function(){return F});var z=M("./src/polyfills/number.ts");function U(D,I){for(var g=0;g<I.length;g++){var f=I[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(D,f.key,f)}}function L(D,I,g){return I&&U(D.prototype,I),g&&U(D,g),D}var H=10,F=function(){function D(g){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=g}var I=D.prototype;return I.reloaded=function(f){if(!f){this.advanced=!0,this.updated=!0;return}var u=this.lastPartSn-f.lastPartSn,d=this.lastPartIndex-f.lastPartIndex;this.updated=this.endSN!==f.endSN||!!d||!!u,this.advanced=this.endSN>f.endSN||u>0||u===0&&d>0,this.updated||this.advanced?this.misses=Math.floor(f.misses*.6):this.misses=f.misses+1,this.availabilityDelay=f.availabilityDelay},L(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var f=this.driftEndTime-this.driftStartTime;if(f>0){var u=this.driftEnd-this.driftStart;return u*1e3/f}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var f;return(f=this.fragments)!==null&&f!==void 0&&f.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 f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var f;return(f=this.partList)!==null&&f!==void 0&&f.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"LevelKey",function(){return F});var z=M("./node_modules/url-toolkit/src/url-toolkit.js"),U=M.n(z);function L(D,I){for(var g=0;g<I.length;g++){var f=I[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(D,f.key,f)}}function H(D,I,g){return I&&L(D.prototype,I),g&&L(D,g),D}var F=function(){D.fromURL=function(g,f){return new D(g,f)},D.fromURI=function(g){return new D(g)};function D(I,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(z.buildAbsoluteURL)(I,g,{alwaysNormalize:!0}):this._uri=I}return H(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"LoadStats",function(){return z});var z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return n});var z=M("./src/polyfills/number.ts"),U=M("./node_modules/url-toolkit/src/url-toolkit.js"),L=M.n(U),H=M("./src/loader/fragment.ts"),F=M("./src/loader/level-details.ts"),D=M("./src/loader/level-key.ts"),I=M("./src/utils/attr-list.ts"),g=M("./src/utils/logger.ts"),f=M("./src/utils/codecs.ts"),u=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),l=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("|")),r=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var C,b;return r.test((C=(b=U.parseURL(A))===null||b===void 0?void 0:b.path)!=null?C:"")}var n=function(){function A(){}return A.findGroup=function(b,v){for(var p=0;p<b.length;p++){var c=b[p];if(c.id===v)return c}},A.convertAVC1ToAVCOTI=function(b){var v=b.split(".");if(v.length>2){var p=v.shift()+".";return p+=parseInt(v.shift()).toString(16),p+=("000"+parseInt(v.shift()).toString(16)).substr(-4),p}return b},A.resolve=function(b,v){return U.buildAbsoluteURL(v,b,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(b,v){var p=[],c={},E=!1;u.lastIndex=0;for(var y;(y=u.exec(b))!=null;)if(y[1]){var _=new I.AttrList(y[1]),P={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:A.resolve(y[2],v)},N=_.decimalResolution("RESOLUTION");N&&(P.width=N.width,P.height=N.height),h((_.CODECS||"").split(/[ ,]+/).filter(function($){return $}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=A.convertAVC1ToAVCOTI(P.videoCodec)),p.push(P)}else if(y[3]){var K=new I.AttrList(y[3]);K["DATA-ID"]&&(E=!0,c[K["DATA-ID"]]=K)}return{levels:p,sessionData:E?c:null}},A.parseMasterPlaylistMedia=function(b,v,p,c){c===void 0&&(c=[]);var E,y=[],_=0;for(d.lastIndex=0;(E=d.exec(b))!==null;){var P=new I.AttrList(E[1]);if(P.TYPE===p){var N={attrs:P,bitrate:0,id:_++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:p,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?A.resolve(P.URI,v):""};if(c.length){var K=A.findGroup(c,N.groupId)||c[0];O(N,K,"audioCodec"),O(N,K,"textCodec")}y.push(N)}}return y},A.parseLevelPlaylist=function(b,v,p,c,E){var y=new F.LevelDetails(v),_=y.fragments,P=null,N=0,K=0,$=0,B=0,R=null,G=new H.Fragment(c,v),Q,ne,le,_e=-1,pe=!1;for(s.lastIndex=0,y.m3u8=b;(Q=s.exec(b))!==null;){pe&&(pe=!1,G=new H.Fragment(c,v),G.start=$,G.sn=N,G.cc=B,G.level=p,P&&(G.initSegment=P,G.rawProgramDateTime=P.rawProgramDateTime));var Ee=Q[1];if(Ee){G.duration=parseFloat(Ee);var Oe=(" "+Q[2]).slice(1);G.title=Oe||null,G.tagList.push(Oe?["INF",Ee,Oe]:["INF",Ee])}else if(Q[3])Object(z.isFiniteNumber)(G.duration)&&(G.start=$,le&&(G.levelkey=le),G.sn=N,G.level=p,G.cc=B,G.urlId=E,_.push(G),G.relurl=(" "+Q[3]).slice(1),x(G,R),R=G,$+=G.duration,N++,K=0,pe=!0);else if(Q[4]){var we=(" "+Q[4]).slice(1);R?G.setByteRange(we,R):G.setByteRange(we)}else if(Q[5])G.rawProgramDateTime=(" "+Q[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),_e===-1&&(_e=_.length);else{if(Q=Q[0].match(l),!Q){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<Q.length&&!(typeof Q[ne]!="undefined");ne++);var he=(" "+Q[ne]).slice(1),oe=(" "+Q[ne+1]).slice(1),Le=Q[ne+2]?(" "+Q[ne+2]).slice(1):"";switch(he){case"PLAYLIST-TYPE":y.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":N=y.startSN=parseInt(oe);break;case"SKIP":{var Ye=new I.AttrList(oe),nt=Ye.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(nt)){y.skippedSegments=nt;for(var qe=nt;qe--;)_.unshift(null);N+=nt}var it=Ye.enumeratedString("RECENTLY-REMOVED-DATERANGES");it&&(y.recentlyRemovedDateranges=it.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(oe);break;case"VERSION":y.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(oe||Le)&&G.tagList.push(Le?[oe,Le]:[oe]);break;case"DIS":B++;case"GAP":G.tagList.push([he]);break;case"BITRATE":G.tagList.push([he,oe]);break;case"DISCONTINUITY-SEQ":B=parseInt(oe);break;case"KEY":{var He,$e=new I.AttrList(oe),Qe=$e.enumeratedString("METHOD"),gt=$e.URI,et=$e.hexadecimalInteger("IV"),tt=$e.enumeratedString("KEYFORMATVERSIONS"),Je=$e.enumeratedString("KEYID"),vt=(He=$e.enumeratedString("KEYFORMAT"))!=null?He:"identity",wt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(wt.indexOf(vt)>-1){g.logger.warn("Keyformat "+vt+" is not supported from the manifest");continue}else if(vt!=="identity")continue;Qe&&(le=D.LevelKey.fromURL(v,gt),gt&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Qe)>=0&&(le.method=Qe,le.keyFormat=vt,Je&&(le.keyID=Je),tt&&(le.keyFormatVersions=tt),le.iv=et));break}case"START":{var Et=new I.AttrList(oe),xt=Et.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(xt)&&(y.startTimeOffset=xt);break}case"MAP":{var kt=new I.AttrList(oe);G.relurl=kt.URI,kt.BYTERANGE&&G.setByteRange(kt.BYTERANGE),G.level=p,G.sn="initSegment",le&&(G.levelkey=le),G.initSegment=null,P=G,pe=!0;break}case"SERVER-CONTROL":{var Ot=new I.AttrList(oe);y.canBlockReload=Ot.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Ot.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Ot.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Ot.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Ot.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ae=new I.AttrList(oe);y.partTarget=Ae.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=y.partList;Ce||(Ce=y.partList=[]);var Ge=K>0?Ce[Ce.length-1]:void 0,ze=K++,Re=new H.Part(new I.AttrList(oe),G,v,ze,Ge);Ce.push(Re),G.duration+=Re.duration;break}case"PRELOAD-HINT":{var je=new I.AttrList(oe);y.preloadHint=je;break}case"RENDITION-REPORT":{var ge=new I.AttrList(oe);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:g.logger.warn("line parsed but not handled: "+Q);break}}}R&&!R.relurl?(_.pop(),$-=R.duration,y.partList&&(y.fragmentHint=R)):y.partList&&(x(G,R),G.cc=B,y.fragmentHint=G);var de=_.length,ce=_[0],re=_[de-1];if($+=y.skippedSegments*y.targetduration,$>0&&de&&re){y.averagetargetduration=$/de;var ae=re.sn;y.endSN=ae!=="initSegment"?ae:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(ue){return ue.relurl&&a(ue.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new H.Fragment(c,v),G.relurl=re.relurl,G.level=p,G.sn="initSegment",ce.initSegment=G,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&($+=y.fragmentHint.duration),y.totalduration=$,y.endCC=B,_e>0&&S(_,_e),y},A}();function h(A,C){["video","audio","text"].forEach(function(b){var v=A.filter(function(c){return Object(f.isCodecType)(c,b)});if(v.length){var p=v.filter(function(c){return c.lastIndexOf("avc1",0)===0||c.lastIndexOf("mp4a",0)===0});C[b+"Codec"]=p.length>0?p[0]:v[0],A=A.filter(function(c){return v.indexOf(c)===-1})}}),C.unknownCodecs=A}function O(A,C,b){var v=C[b];v&&(A[b]=v)}function S(A,C){for(var b=A[C],v=C;v--;){var p=A[v];if(!p)return;p.programDateTime=b.programDateTime-p.duration*1e3,b=p}}function x(A,C){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):C!=null&&C.programDateTime&&(A.programDateTime=C.endProgramDateTime),Object(z.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/polyfills/number.ts"),U=M("./src/events.ts"),L=M("./src/errors.ts"),H=M("./src/utils/logger.ts"),F=M("./src/utils/mp4-tools.ts"),D=M("./src/loader/m3u8-parser.ts"),I=M("./src/types/loader.ts"),g=M("./src/utils/attr-list.ts");function f(s){var l=s.type;switch(l){case I.PlaylistContextType.AUDIO_TRACK:return I.PlaylistLevelType.AUDIO;case I.PlaylistContextType.SUBTITLE_TRACK:return I.PlaylistLevelType.SUBTITLE;default:return I.PlaylistLevelType.MAIN}}function u(s,l){var r=s.url;return(r===void 0||r.indexOf("data:")===0)&&(r=l.url),r}var d=function(){function s(r){this.hls=void 0,this.loaders=Object.create(null),this.hls=r,this.registerListeners()}var l=s.prototype;return l.registerListeners=function(){var a=this.hls;a.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},l.createInternalLoader=function(a){var n=this.hls.config,h=n.pLoader,O=n.loader,S=h||O,x=new S(n);return a.loader=x,this.loaders[a.type]=x,x},l.getInternalLoader=function(a){return this.loaders[a.type]},l.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},l.destroyInternalLoaders=function(){for(var a in this.loaders){var n=this.loaders[a];n&&n.destroy(),this.resetInternalLoader(a)}},l.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},l.onManifestLoading=function(a,n){var h=n.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:I.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},l.onLevelLoading=function(a,n){var h=n.id,O=n.level,S=n.url,x=n.deliveryDirectives;this.load({id:h,groupId:null,level:O,responseType:"text",type:I.PlaylistContextType.LEVEL,url:S,deliveryDirectives:x})},l.onAudioTrackLoading=function(a,n){var h=n.id,O=n.groupId,S=n.url,x=n.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:I.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:x})},l.onSubtitleTrackLoading=function(a,n){var h=n.id,O=n.groupId,S=n.url,x=n.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:I.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:x})},l.load=function(a){var n,h=this.hls.config,O=this.getInternalLoader(a);if(O){var S=O.context;if(S&&S.url===a.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),O.abort()}var x,A,C,b;switch(a.type){case I.PlaylistContextType.MANIFEST:x=h.manifestLoadingMaxRetry,A=h.manifestLoadingTimeOut,C=h.manifestLoadingRetryDelay,b=h.manifestLoadingMaxRetryTimeout;break;case I.PlaylistContextType.LEVEL:case I.PlaylistContextType.AUDIO_TRACK:case I.PlaylistContextType.SUBTITLE_TRACK:x=0,A=h.levelLoadingTimeOut;break;default:x=h.levelLoadingMaxRetry,A=h.levelLoadingTimeOut,C=h.levelLoadingRetryDelay,b=h.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(a),(n=a.deliveryDirectives)!==null&&n!==void 0&&n.part){var v;if(a.type===I.PlaylistContextType.LEVEL&&a.level!==null?v=this.hls.levels[a.level].details:a.type===I.PlaylistContextType.AUDIO_TRACK&&a.id!==null?v=this.hls.audioTracks[a.id].details:a.type===I.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(v=this.hls.subtitleTracks[a.id].details),v){var p=v.partTarget,c=v.targetduration;p&&c&&(A=Math.min(Math.max(p*3,c*.8)*1e3,A))}}var E={timeout:A,maxRetry:x,retryDelay:C,maxRetryDelay:b,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(a,E,y)},l.loadsuccess=function(a,n,h,O){if(O===void 0&&(O=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,n,h,O);return}this.resetInternalLoader(h.type);var S=a.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",O);return}n.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,n,h,O):this.handleMasterPlaylist(a,n,h,O)},l.loaderror=function(a,n,h){h===void 0&&(h=null),this.handleNetworkError(n,h,!1,a)},l.loadtimeout=function(a,n,h){h===void 0&&(h=null),this.handleNetworkError(n,h,!0)},l.handleMasterPlaylist=function(a,n,h,O){var S=this.hls,x=a.data,A=u(a,h),C=D.default.parseMasterPlaylist(x,A),b=C.levels,v=C.sessionData;if(!b.length){this.handleManifestParsingError(a,h,"no level found in manifest",O);return}var p=b.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),c=b.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),E=D.default.parseMasterPlaylistMedia(x,A,"AUDIO",p),y=D.default.parseMasterPlaylistMedia(x,A,"SUBTITLES",c),_=D.default.parseMasterPlaylistMedia(x,A,"CLOSED-CAPTIONS");if(E.length){var P=E.some(function(N){return!N.url});!P&&b[0].audioCodec&&!b[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}S.trigger(U.Events.MANIFEST_LOADED,{levels:b,audioTracks:E,subtitles:y,captions:_,url:A,stats:n,networkDetails:O,sessionData:v})},l.handleTrackOrLevelPlaylist=function(a,n,h,O){var S=this.hls,x=h.id,A=h.level,C=h.type,b=u(a,h),v=Object(z.isFiniteNumber)(x)?x:0,p=Object(z.isFiniteNumber)(A)?A:v,c=f(h),E=D.default.parseLevelPlaylist(a.data,b,p,c,v);if(!E.fragments.length){S.trigger(U.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:b,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(C===I.PlaylistContextType.MANIFEST){var y={attrs:new g.AttrList({}),bitrate:0,details:E,name:"",url:b};S.trigger(U.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:b,stats:n,networkDetails:O,sessionData:null})}if(n.parsing.end=performance.now(),E.needSidxRanges){var _,P=(_=E.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:P,isSidxRequest:!0,type:C,level:A,levelDetails:E,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=E,this.handlePlaylistLoaded(a,n,h,O)},l.handleSidxRequest=function(a,n){var h=Object(F.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var O=h.references,S=n.levelDetails;O.forEach(function(x,A){var C=x.info,b=S.fragments[A];b.byteRange.length===0&&b.setByteRange(String(1+C.end-C.start)+"@"+String(C.start)),b.initSegment&&b.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},l.handleManifestParsingError=function(a,n,h,O){this.hls.trigger(U.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:n.type===I.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:n,networkDetails:O})},l.handleNetworkError=function(a,n,h,O){h===void 0&&(h=!1),H.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var S=L.ErrorDetails.UNKNOWN,x=!1,A=this.getInternalLoader(a);switch(a.type){case I.PlaylistContextType.MANIFEST:S=h?L.ErrorDetails.MANIFEST_LOAD_TIMEOUT:L.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case I.PlaylistContextType.LEVEL:S=h?L.ErrorDetails.LEVEL_LOAD_TIMEOUT:L.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.AUDIO_TRACK:S=h?L.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.SUBTITLE_TRACK:S=h?L.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:L.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}A&&this.resetInternalLoader(a.type);var C={type:L.ErrorTypes.NETWORK_ERROR,details:S,fatal:x,url:a.url,loader:A,context:a,networkDetails:n};O&&(C.response=O),this.hls.trigger(U.Events.ERROR,C)},l.handlePlaylistLoaded=function(a,n,h,O){var S=h.type,x=h.level,A=h.id,C=h.groupId,b=h.loader,v=h.levelDetails,p=h.deliveryDirectives;if(!(v!=null&&v.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",O);return}if(!b)return;v.live&&(b.getCacheAge&&(v.ageHeader=b.getCacheAge()||0),(!b.getCacheAge||isNaN(v.ageHeader))&&(v.ageHeader=0));switch(S){case I.PlaylistContextType.MANIFEST:case I.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:v,level:x||0,id:A||0,stats:n,networkDetails:O,deliveryDirectives:p});break;case I.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:v,id:A||0,groupId:C||"",stats:n,networkDetails:O,deliveryDirectives:p});break;case I.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:v,id:A||0,groupId:C||"",stats:n,networkDetails:O,deliveryDirectives:p});break}},s}();V.default=d},"./src/polyfills/number.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"isFiniteNumber",function(){return z}),M.d(V,"MAX_SAFE_INTEGER",function(){return U});var z=Number.isFinite||function(L){return typeof L=="number"&&isFinite(L)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,V,M){"use strict";M.r(V);var z=function(){function U(){}return U.getSilentFrame=function(H,F){switch(H){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(F===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(F===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();V.default=z},"./src/remux/mp4-generator.ts":function(q,V,M){"use strict";M.r(V);var z=Math.pow(2,32)-1,U=function(){function L(){}return L.init=function(){L.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in L.types)L.types.hasOwnProperty(F)&&(L.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var D=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]),I=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]);L.HDLR_TYPES={video:D,audio:I};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),f=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=f,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var u=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,u,s,u,d),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,g))},L.box=function(F){for(var D=8,I=arguments.length,g=new Array(I>1?I-1:0),f=1;f<I;f++)g[f-1]=arguments[f];for(var u=g.length,d=u;u--;)D+=g[u].byteLength;var s=new Uint8Array(D);for(s[0]=D>>24&255,s[1]=D>>16&255,s[2]=D>>8&255,s[3]=D&255,s.set(F,4),u=0,D=8;u<d;u++)s.set(g[u],D),D+=g[u].byteLength;return s},L.hdlr=function(F){return L.box(L.types.hdlr,L.HDLR_TYPES[F])},L.mdat=function(F){return L.box(L.types.mdat,F)},L.mdhd=function(F,D){D*=F;var I=Math.floor(D/(z+1)),g=Math.floor(D%(z+1));return L.box(L.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,I>>24,I>>16&255,I>>8&255,I&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},L.mdia=function(F){return L.box(L.types.mdia,L.mdhd(F.timescale,F.duration),L.hdlr(F.type),L.minf(F))},L.mfhd=function(F){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},L.minf=function(F){return F.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(F)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(F))},L.moof=function(F,D,I){return L.box(L.types.moof,L.mfhd(F),L.traf(I,D))},L.moov=function(F){for(var D=F.length,I=[];D--;)I[D]=L.trak(F[D]);return L.box.apply(null,[L.types.moov,L.mvhd(F[0].timescale,F[0].duration)].concat(I).concat(L.mvex(F)))},L.mvex=function(F){for(var D=F.length,I=[];D--;)I[D]=L.trex(F[D]);return L.box.apply(null,[L.types.mvex].concat(I))},L.mvhd=function(F,D){D*=F;var I=Math.floor(D/(z+1)),g=Math.floor(D%(z+1)),f=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,I>>24,I>>16&255,I>>8&255,I&255,g>>24,g>>16&255,g>>8&255,g&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 L.box(L.types.mvhd,f)},L.sdtp=function(F){var D=F.samples||[],I=new Uint8Array(4+D.length),g,f;for(g=0;g<D.length;g++)f=D[g].flags,I[g+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return L.box(L.types.sdtp,I)},L.stbl=function(F){return L.box(L.types.stbl,L.stsd(F),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))},L.avc1=function(F){var D=[],I=[],g,f,u;for(g=0;g<F.sps.length;g++)f=F.sps[g],u=f.byteLength,D.push(u>>>8&255),D.push(u&255),D=D.concat(Array.prototype.slice.call(f));for(g=0;g<F.pps.length;g++)f=F.pps[g],u=f.byteLength,I.push(u>>>8&255),I.push(u&255),I=I.concat(Array.prototype.slice.call(f));var d=L.box(L.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|F.sps.length].concat(D).concat([F.pps.length]).concat(I))),s=F.width,l=F.height,r=F.pixelRatio[0],a=F.pixelRatio[1];return L.box(L.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,s>>8&255,s&255,l>>8&255,l&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]),d,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255])))},L.esds=function(F){var D=F.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(F.config).concat([6,1,2]))},L.mp4a=function(F){var D=F.samplerate;return L.box(L.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),L.box(L.types.esds,L.esds(F)))},L.mp3=function(F){var D=F.samplerate;return L.box(L.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},L.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(F)):L.box(L.types.stsd,L.STSD,L.mp4a(F)):L.box(L.types.stsd,L.STSD,L.avc1(F))},L.tkhd=function(F){var D=F.id,I=F.duration*F.timescale,g=F.width,f=F.height,u=Math.floor(I/(z+1)),d=Math.floor(I%(z+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&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,g>>8&255,g&255,0,0,f>>8&255,f&255,0,0]))},L.traf=function(F,D){var I=L.sdtp(F),g=F.id,f=Math.floor(D/(z+1)),u=Math.floor(D%(z+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,u>>24,u>>16&255,u>>8&255,u&255])),L.trun(F,I.length+16+20+8+16+8+8),I)},L.trak=function(F){return F.duration=F.duration||4294967295,L.box(L.types.trak,L.tkhd(F),L.mdia(F))},L.trex=function(F){var D=F.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},L.trun=function(F,D){var I=F.samples||[],g=I.length,f=12+16*g,u=new Uint8Array(f),d,s,l,r,a,n;for(D+=8+f,u.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),d=0;d<g;d++)s=I[d],l=s.duration,r=s.size,a=s.flags,n=s.cts,u.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,n>>>24&255,n>>>16&255,n>>>8&255,n&255],12+16*d);return L.box(L.types.trun,u)},L.initSegment=function(F){L.types||L.init();var D=L.moov(F),I=new Uint8Array(L.FTYP.byteLength+D.byteLength);return I.set(L.FTYP),I.set(D,L.FTYP.byteLength),I},L}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,V.default=U},"./src/remux/mp4-remuxer.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return n}),M.d(V,"normalizePts",function(){return h});var z=M("./src/polyfills/number.ts"),U=M("./src/remux/aac-helper.ts"),L=M("./src/remux/mp4-generator.ts"),H=M("./src/events.ts"),F=M("./src/errors.ts"),D=M("./src/utils/logger.ts"),I=M("./src/types/loader.ts"),g=M("./src/utils/timescale-conversion.ts");function f(){return f=Object.assign||function(A){for(var C=1;C<arguments.length;C++){var b=arguments[C];for(var v in b)Object.prototype.hasOwnProperty.call(b,v)&&(A[v]=b[v])}return A},f.apply(this,arguments)}var u=10*1e3,d=1024,s=1152,l=null,r=null,a=!1,n=function(){function A(b,v,p,c){if(c===void 0&&(c=""),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=b,this.config=v,this.typeSupported=p,this.ISGenerated=!1,l===null){var E=navigator.userAgent||"",y=E.match(/Chrome\/(\d+)/i);l=y?parseInt(y[1]):0}if(r===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);r=_?parseInt(_[1]):0}a=!!l&&l<75||!!r&&r<600}var C=A.prototype;return C.destroy=function(){},C.resetTimeStamp=function(v){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=v},C.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(v){var p=!1,c=v.reduce(function(E,y){var _=y.pts-E;return _<-4294967296?(p=!0,h(E,y.pts)):_>0?E:y.pts},v[0].pts);return p&&D.logger.debug("PTS rollover detected"),c},C.remux=function(v,p,c,E,y,_,P,N){var K,$,B,R,G,Q,ne=y,le=y,_e=v.pid>-1,pe=p.pid>-1,Ee=p.samples.length,Oe=v.samples.length>0,we=Ee>1,he=(!_e||Oe)&&(!pe||we)||this.ISGenerated||P;if(he){this.ISGenerated||(B=this.generateIS(v,p,y));var oe=this.isVideoContiguous,Le=-1;if(we&&(Le=O(p.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(Q=!0,Le>0){D.logger.warn("[mp4-remuxer]: Dropped "+Le+" out of "+Ee+" video samples due to a missing keyframe");var Ye=this.getVideoStartPts(p.samples);p.samples=p.samples.slice(Le),p.dropped+=Le,le+=(p.samples[0].pts-Ye)/(p.timescale||9e4)}else Le===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),Q=!1);if(this.ISGenerated){if(Oe&&we){var nt=this.getVideoStartPts(p.samples),qe=h(v.samples[0].pts,nt)-nt,it=qe/p.inputTimeScale;ne+=Math.max(0,it),le+=Math.max(0,-it)}if(Oe){if(v.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(v,p,y)),$=this.remuxAudio(v,ne,this.isAudioContiguous,_,pe||we||N===I.PlaylistLevelType.AUDIO?le:void 0),we){var He=$?$.endPTS-$.startPTS:0;p.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(v,p,y)),K=this.remuxVideo(p,le,oe,He)}}else we&&(K=this.remuxVideo(p,le,oe,0));K&&(K.firstKeyFrame=Le,K.independent=Le!==-1)}}return this.ISGenerated&&(c.samples.length&&(G=this.remuxID3(c,y)),E.samples.length&&(R=this.remuxText(E,y))),{audio:$,video:K,initSegment:B,independent:Q,text:R,id3:G}},C.generateIS=function(v,p,c){var E=v.samples,y=p.samples,_=this.typeSupported,P={},N=!Object(z.isFiniteNumber)(this._initPTS),K="audio/mp4",$,B,R;if(N&&($=B=Infinity),v.config&&E.length&&(v.timescale=v.samplerate,v.isAAC||(_.mpeg?(K="audio/mpeg",v.codec=""):_.mp3&&(v.codec="mp3")),P.audio={id:"audio",container:K,codec:v.codec,initSegment:!v.isAAC&&_.mpeg?new Uint8Array(0):L.default.initSegment([v]),metadata:{channelCount:v.channelCount}},N&&(R=v.inputTimeScale,$=B=E[0].pts-Math.round(R*c))),p.sps&&p.pps&&y.length&&(p.timescale=p.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:p.codec,initSegment:L.default.initSegment([p]),metadata:{width:p.width,height:p.height}},N)){R=p.inputTimeScale;var G=this.getVideoStartPts(y),Q=Math.round(R*c);B=Math.min(B,h(y[0].dts,G)-Q),$=Math.min($,G-Q)}if(Object.keys(P).length)return this.ISGenerated=!0,N&&(this._initPTS=$,this._initDTS=B),{tracks:P,initPTS:$,timescale:R}},C.remuxVideo=function(v,p,c,E){var y=v.inputTimeScale,_=v.samples,P=[],N=_.length,K=this._initPTS,$=this.nextAvcDts,B=8,R,G,Q,ne=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,_e=0,pe=!1;if(!c||$===null){var Ee=p*y,Oe=_[0].pts-h(_[0].dts,_[0].pts);$=Ee-Oe}for(var we=0;we<N;we++){var he=_[we];if(he.pts=h(he.pts-K,$),he.dts=h(he.dts-K,$),he.dts>he.pts){var oe=9e4*.2;_e=Math.max(Math.min(_e,he.pts-he.dts),-1*oe)}he.dts<_[we>0?we-1:we].dts&&(pe=!0)}pe&&_.sort(function(at,Be){var We=at.dts-Be.dts,Me=at.pts-Be.pts;return We||Me}),G=_[0].dts,Q=_[_.length-1].dts;var Le=Math.round((Q-G)/(N-1));if(_e<0){if(_e<Le*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Le,!0)+" ms");for(var Ye=_e,nt=0;nt<N;nt++)_[nt].dts=Ye=Math.max(Ye,_[nt].pts-Le),_[nt].pts=Math.max(Ye,_[nt].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var qe=0;qe<N;qe++)_[qe].dts=_[qe].dts+_e}G=_[0].dts}if(c){var it=G-$,He=it>Le,$e=it<-1;if(He||$e){He?D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(it,!0)+" ms ("+it+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-it,!0)+" ms ("+it+"dts) overlapping between fragments detected"),G=$;var Qe=_[0].pts-it;_[0].dts=G,_[0].pts=Qe,D.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Qe,!0)+"/"+Object(g.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(it,!0)+" ms")}}a&&(G=Math.max(0,G));for(var gt=0,et=0,tt=0;tt<N;tt++){for(var Je=_[tt],vt=Je.units,wt=vt.length,Et=0,xt=0;xt<wt;xt++)Et+=vt[xt].data.length;et+=Et,gt+=wt,Je.length=Et,Je.dts=Math.max(Je.dts,G),Je.pts=Math.max(Je.pts,Je.dts,0),ne=Math.min(Je.pts,ne),le=Math.max(Je.pts,le)}Q=_[N-1].dts;var kt=et+4*gt+8,Ot;try{Ot=new Uint8Array(kt)}catch(at){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:kt,reason:"fail allocating video mdat "+kt});return}var Ae=new DataView(Ot.buffer);Ae.setUint32(0,kt),Ot.set(L.default.types.mdat,4);for(var Ce=0;Ce<N;Ce++){for(var Ge=_[Ce],ze=Ge.units,Re=0,je=0,ge=ze.length;je<ge;je++){var de=ze[je],ce=de.data,re=de.data.byteLength;Ae.setUint32(B,re),B+=4,Ot.set(ce,B),B+=re,Re+=4+re}if(Ce<N-1)R=_[Ce+1].dts-Ge.dts;else{var ae=this.config,ue=Ge.dts-_[Ce>0?Ce-1:Ce].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var fe=Math.floor(ae.maxBufferHole*y),be=(E?ne+E*y:this.nextAudioPts)-Ge.pts;be>fe?(R=be-ue,R<0&&(R=ue),D.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+R/90+" ms for the last video frame.")):R=ue}else R=ue}var Ie=Math.round(Ge.pts-Ge.dts);P.push(new S(Ge.key,R,Re,Ie))}if(P.length&&l&&l<70){var Xe=P[0].flags;Xe.dependsOn=2,Xe.isNonSync=0}console.assert(R!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=$=Q+R,this.isVideoContiguous=!0;var ut=L.default.moof(v.sequenceNumber++,G,f({},v,{samples:P})),bt="video",ft={data1:ut,data2:Ot,startPTS:ne/y,endPTS:(le+R)/y,startDTS:G/y,endDTS:$/y,type:bt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:v.dropped};return v.samples=[],v.dropped=0,console.assert(Ot.length,"MDAT length must not be zero"),ft},C.remuxAudio=function(v,p,c,E,y){var _=v.inputTimeScale,P=v.samplerate?v.samplerate:_,N=_/P,K=v.isAAC?d:s,$=K*N,B=this._initPTS,R=!v.isAAC&&this.typeSupported.mpeg,G=[],Q=v.samples,ne=R?0:8,le=this.nextAudioPts||-1,_e=p*_;if(this.isAudioContiguous=c=c||Q.length&&le>0&&(E&&Math.abs(_e-le)<9e3||Math.abs(h(Q[0].pts-B,_e)-le)<20*$),Q.forEach(function(ce){ce.pts=h(ce.pts-B,_e)}),!c||le<0){if(Q=Q.filter(function(ce){return ce.pts>=0}),!Q.length)return;y===0?le=0:E?le=Math.max(0,_e):le=Q[0].pts}if(v.isAAC)for(var pe=y!==void 0,Ee=this.config.maxAudioFramesDrift,Oe=0,we=le;Oe<Q.length;Oe++){var he=Q[Oe],oe=he.pts,Le=oe-we,Ye=Math.abs(1e3*Le/_);if(Le<=-Ee*$&&pe)Oe===0&&(D.logger.warn("Audio frame @ "+(oe/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Le/_)+" ms."),this.nextAudioPts=le=we=oe);else if(Le>=Ee*$&&Ye<u&&pe){var nt=Math.round(Le/$);we=oe-nt*$,we<0&&(nt--,we+=$),Oe===0&&(this.nextAudioPts=le=we),D.logger.warn("[mp4-remuxer]: Injecting "+nt+" audio frame @ "+(we/_).toFixed(3)+"s due to "+Math.round(1e3*Le/_)+" ms gap.");for(var qe=0;qe<nt;qe++){var it=Math.max(we,0),He=U.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);He||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),He=he.unit.subarray()),Q.splice(Oe,0,{unit:He,pts:it}),we+=$,Oe++}}he.pts=we,we+=$}for(var $e=null,Qe=null,gt,et=0,tt=Q.length;tt--;)et+=Q[tt].unit.byteLength;for(var Je=0,vt=Q.length;Je<vt;Je++){var wt=Q[Je],Et=wt.unit,xt=wt.pts;if(Qe!==null){var kt=G[Je-1];kt.duration=Math.round((xt-Qe)/N)}else if(c&&v.isAAC&&(xt=le),$e=xt,et>0){et+=ne;try{gt=new Uint8Array(et)}catch(ce){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating audio mdat "+et});return}if(!R){var Ot=new DataView(gt.buffer);Ot.setUint32(0,et),gt.set(L.default.types.mdat,4)}}else return;gt.set(Et,ne);var Ae=Et.byteLength;ne+=Ae,G.push(new S(!0,K,Ae,0)),Qe=xt}var Ce=G.length;if(!Ce)return;var Ge=G[G.length-1];this.nextAudioPts=le=Qe+N*Ge.duration;var ze=R?new Uint8Array(0):L.default.moof(v.sequenceNumber++,$e/N,f({},v,{samples:G}));v.samples=[];var Re=$e/_,je=le/_,ge="audio",de={data1:ze,data2:gt,startPTS:Re,endPTS:je,startDTS:Re,endDTS:je,type:ge,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(gt.length,"MDAT length must not be zero"),de},C.remuxEmptyAudio=function(v,p,c,E){var y=v.inputTimeScale,_=v.samplerate?v.samplerate:y,P=y/_,N=this.nextAudioPts,K=(N!==null?N:E.startDTS*y)+this._initDTS,$=E.endDTS*y+this._initDTS,B=P*d,R=Math.ceil(($-K)/B),G=U.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Q=[],ne=0;ne<R;ne++){var le=K+ne*B;Q.push({unit:G,pts:le,dts:le})}return v.samples=Q,this.remuxAudio(v,p,c,!1)},C.remuxID3=function(v,p){var c=v.samples.length;if(!c)return;for(var E=v.inputTimeScale,y=this._initPTS,_=this._initDTS,P=0;P<c;P++){var N=v.samples[P];N.pts=h(N.pts-y,p*E)/E,N.dts=h(N.dts-_,p*E)/E}var K=v.samples;return v.samples=[],{samples:K}},C.remuxText=function(v,p){var c=v.samples.length;if(!c)return;for(var E=v.inputTimeScale,y=this._initPTS,_=0;_<c;_++){var P=v.samples[_];P.pts=h(P.pts-y,p*E)/E}v.samples.sort(function(K,$){return K.pts-$.pts});var N=v.samples;return v.samples=[],{samples:N}},A}();function h(A,C){var b;if(C===null)return A;for(C<A?b=-8589934592:b=8589934592;Math.abs(A-C)>4294967296;)A+=b;return A}function O(A){for(var C=0;C<A.length;C++)if(A[C].key)return C;return-1}var S=function(C,b,v,p){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=b,this.size=v,this.cts=p,this.flags=new x(C)},x=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/polyfills/number.ts"),U=M("./src/utils/mp4-tools.ts"),L=M("./src/loader/fragment.ts"),H=M("./src/utils/logger.ts"),F=function(){function g(){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 f=g.prototype;return f.destroy=function(){},f.resetTimeStamp=function(d){this.initPTS=d,this.lastEndDTS=null},f.resetNextTimestamp=function(){this.lastEndDTS=null},f.resetInitSegment=function(d,s,l){this.audioCodec=s,this.videoCodec=l,this.generateInitSegment(d),this.emitInitSegment=!0},f.generateInitSegment=function(d){var s=this.audioCodec,l=this.videoCodec;if(!d||!d.byteLength){this.initTracks=void 0,this.initData=void 0;return}var r=this.initData=Object(U.parseInitSegment)(d);s||(s=I(r.audio,L.ElementaryStreamTypes.AUDIO)),l||(l=I(r.video,L.ElementaryStreamTypes.VIDEO));var a={};r.audio&&r.video?a.audiovideo={container:"video/mp4",codec:s+","+l,initSegment:d,id:"main"}:r.audio?a.audio={container:"audio/mp4",codec:s,initSegment:d,id:"audio"}:r.video?a.video={container:"video/mp4",codec:l,initSegment:d,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},f.remux=function(d,s,l,r,a){var n=this.initPTS,h=this.lastEndDTS,O={audio:void 0,video:void 0,text:r,id3:l,initSegment:void 0};Object(z.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var S=s.samples;if(!S||!S.length)return O;var x={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(S),A=this.initData),!A||!A.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),O;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(n)||(this.initPTS=x.initPTS=n=D(A,S,h));var C=Object(U.getDuration)(S,A),b=h,v=C+b;Object(U.offsetStartDTS)(A,S,n),C>0?this.lastEndDTS=v:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var p=!!A.audio,c=!!A.video,E="";p&&(E+="audio"),c&&(E+="video");var y={data1:S,startPTS:b,startDTS:b,endPTS:v,endDTS:v,type:E,hasAudio:p,hasVideo:c,nb:1,dropped:0};return O.audio=y.type==="audio"?y:void 0,O.video=y.type!=="audio"?y:void 0,O.text=r,O.id3=l,O.initSegment=x,O},g}(),D=function(f,u,d){return Object(U.getStartDTS)(f,u)-d};function I(g,f){var u=g==null?void 0:g.codec;return u&&u.length>4?u:u==="hvc1"?"hvc1.1.c.L120.90":u==="av01"?"av01.0.04M.08":u==="avc1"||f===L.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=F},"./src/task-loop.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return z});var z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var L=U.prototype;return L.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},L.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},L.onHandlerDestroyed=function(){},L.hasInterval=function(){return!!this._tickInterval},L.hasNextTick=function(){return!!this._tickTimer},L.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},L.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},L.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},L.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},L.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},L.doTick=function(){},U}()},"./src/types/cmcd.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"CMCDVersion",function(){return z}),M.d(V,"CMCDObjectType",function(){return U}),M.d(V,"CMCDStreamingFormat",function(){return L}),M.d(V,"CMCDStreamType",function(){return H});var z=1,U;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(U||(U={}));var L;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(L||(L={}));var H;(function(F){F.VOD="v",F.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"HlsSkip",function(){return L}),M.d(V,"getSkipValue",function(){return H}),M.d(V,"HlsUrlParameters",function(){return F}),M.d(V,"Level",function(){return D});function z(I,g){for(var f=0;f<g.length;f++){var u=g[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(I,u.key,u)}}function U(I,g,f){return g&&z(I.prototype,g),f&&z(I,f),I}var L;(function(I){I.No="",I.Yes="YES",I.v2="v2"})(L||(L={}));function H(I,g){var f=I.canSkipUntil,u=I.canSkipDateRanges,d=I.endSN,s=g!==void 0?g-d:0;return f&&s<f?u?L.v2:L.Yes:L.No}var F=function(){function I(f,u,d){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=f,this.part=u,this.skip=d}var g=I.prototype;return g.addDirectives=function(u){var d=new self.URL(u);return this.msn!==void 0&&d.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&d.searchParams.set("_HLS_part",this.part.toString()),this.skip&&d.searchParams.set("_HLS_skip",this.skip),d.toString()},I}(),D=function(){function I(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(f){return f}).join(",").replace(/\.[^.,]+/g,"")}return U(I,[{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(f){var u=f%this.url.length;this._urlId!==u&&(this.details=void 0,this._urlId=u)}}]),I}()},"./src/types/loader.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"PlaylistContextType",function(){return z}),M.d(V,"PlaylistLevelType",function(){return U});var z;(function(L){L.MANIFEST="manifest",L.LEVEL="level",L.AUDIO_TRACK="audioTrack",L.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var U;(function(L){L.MAIN="main",L.AUDIO="audio",L.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"ChunkMetadata",function(){return z});var z=function(H,F,D,I,g,f){I===void 0&&(I=0),g===void 0&&(g=-1),f===void 0&&(f=!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=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=H,this.sn=F,this.id=D,this.size=I,this.part=g,this.partial=f};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"AttrList",function(){return L});var z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,L=function(){function H(D){typeof D=="string"&&(D=H.parseAttrList(D));for(var I in D)D.hasOwnProperty(I)&&(this[I]=D[I])}var F=H.prototype;return F.decimalInteger=function(I){var g=parseInt(this[I],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.hexadecimalInteger=function(I){if(this[I]){var g=(this[I]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var f=new Uint8Array(g.length/2),u=0;u<g.length/2;u++)f[u]=parseInt(g.slice(u*2,u*2+2),16);return f}else return null},F.hexadecimalIntegerAsNumber=function(I){var g=parseInt(this[I],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},F.decimalFloatingPoint=function(I){return parseFloat(this[I])},F.optionalFloat=function(I,g){var f=this[I];return f?parseFloat(f):g},F.enumeratedString=function(I){return this[I]},F.bool=function(I){return this[I]==="YES"},F.decimalResolution=function(I){var g=z.exec(this[I]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},H.parseAttrList=function(I){var g,f={},u='"';for(U.lastIndex=0;(g=U.exec(I))!==null;){var d=g[2];d.indexOf(u)===0&&d.lastIndexOf(u)===d.length-1&&(d=d.slice(1,-1)),f[g[1]]=d}return f},H}()},"./src/utils/binary-search.ts":function(q,V,M){"use strict";M.r(V);var z={search:function(L,H){for(var F=0,D=L.length-1,I=null,g=null;F<=D;){I=(F+D)/2|0,g=L[I];var f=H(g);if(f>0)F=I+1;else if(f<0)D=I-1;else return g}return null}};V.default=z},"./src/utils/buffer-helper.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"BufferHelper",function(){return L});var z=M("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},L=function(){function H(){}return H.isBuffered=function(D,I){try{if(D){for(var g=H.getBuffered(D),f=0;f<g.length;f++)if(I>=g.start(f)&&I<=g.end(f))return!0}}catch(u){}return!1},H.bufferInfo=function(D,I,g){try{if(D){var f=H.getBuffered(D),u=[],d;for(d=0;d<f.length;d++)u.push({start:f.start(d),end:f.end(d)});return this.bufferedInfo(u,I,g)}}catch(s){}return{len:0,start:I,end:I,nextStart:void 0}},H.bufferedInfo=function(D,I,g){I=Math.max(0,I),D.sort(function(x,A){var C=x.start-A.start;return C||A.end-x.end});var f=[];if(g)for(var u=0;u<D.length;u++){var d=f.length;if(d){var s=f[d-1].end;D[u].start-s<g?D[u].end>s&&(f[d-1].end=D[u].end):f.push(D[u])}else f.push(D[u])}else f=D;for(var l=0,r,a=I,n=I,h=0;h<f.length;h++){var O=f[h].start,S=f[h].end;if(I+g>=O&&I<S)a=O,n=S,l=n-I;else if(I+g<O){r=O;break}}return{len:l,start:a||0,end:n||0,nextStart:r}},H.getBuffered=function(D){try{return D.buffered}catch(I){return z.logger.log("failed to get media.buffered",I),U}},H}()},"./src/utils/cea-608-parser.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"Row",function(){return n}),M.d(V,"CaptionScreen",function(){return h});var z=M("./src/utils/logger.ts"),U={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},L=function(v){var p=v;return U.hasOwnProperty(v)&&(p=U[v]),String.fromCharCode(p)},H=15,F=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},I={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},u=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],d;(function(b){b[b.ERROR=0]="ERROR",b[b.TEXT=1]="TEXT",b[b.WARNING=2]="WARNING",b[b.INFO=2]="INFO",b[b.DEBUG=3]="DEBUG",b[b.DATA=3]="DATA"})(d||(d={}));var s=function(){function b(){this.time=null,this.verboseLevel=d.ERROR}var v=b.prototype;return v.log=function(c,E){this.verboseLevel>=c&&z.logger.log(this.time+" ["+c+"] "+E)},b}(),l=function(v){for(var p=[],c=0;c<v.length;c++)p.push(v[c].toString(16));return p},r=function(){function b(p,c,E,y,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=p||"white",this.underline=c||!1,this.italics=E||!1,this.background=y||"black",this.flash=_||!1}var v=b.prototype;return v.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},v.setStyles=function(c){for(var E=["foreground","underline","italics","background","flash"],y=0;y<E.length;y++){var _=E[y];c.hasOwnProperty(_)&&(this[_]=c[_])}},v.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},v.equals=function(c){return this.foreground===c.foreground&&this.underline===c.underline&&this.italics===c.italics&&this.background===c.background&&this.flash===c.flash},v.copy=function(c){this.foreground=c.foreground,this.underline=c.underline,this.italics=c.italics,this.background=c.background,this.flash=c.flash},v.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},b}(),a=function(){function b(p,c,E,y,_,P){this.uchar=void 0,this.penState=void 0,this.uchar=p||" ",this.penState=new r(c,E,y,_,P)}var v=b.prototype;return v.reset=function(){this.uchar=" ",this.penState.reset()},v.setChar=function(c,E){this.uchar=c,this.penState.copy(E)},v.setPenState=function(c){this.penState.copy(c)},v.equals=function(c){return this.uchar===c.uchar&&this.penState.equals(c.penState)},v.copy=function(c){this.uchar=c.uchar,this.penState.copy(c.penState)},v.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},b}(),n=function(){function b(p){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var c=0;c<F;c++)this.chars.push(new a);this.logger=p,this.pos=0,this.currPenState=new r}var v=b.prototype;return v.equals=function(c){for(var E=!0,y=0;y<F;y++)if(!this.chars[y].equals(c.chars[y])){E=!1;break}return E},v.copy=function(c){for(var E=0;E<F;E++)this.chars[E].copy(c.chars[E])},v.isEmpty=function(){for(var c=!0,E=0;E<F;E++)if(!this.chars[E].isEmpty()){c=!1;break}return c},v.setCursor=function(c){this.pos!==c&&(this.pos=c),this.pos<0?(this.logger.log(d.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(d.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},v.moveCursor=function(c){var E=this.pos+c;if(c>1)for(var y=this.pos+1;y<E+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(E)},v.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},v.insertChar=function(c){c>=144&&this.backSpace();var E=L(c);if(this.pos>=F){this.logger.log(d.ERROR,"Cannot insert "+c.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},v.clearFromPos=function(c){var E;for(E=c;E<F;E++)this.chars[E].reset()},v.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},v.clearToEndOfRow=function(){this.clearFromPos(this.pos)},v.getTextString=function(){for(var c=[],E=!0,y=0;y<F;y++){var _=this.chars[y].uchar;_!==" "&&(E=!1),c.push(_)}return E?"":c.join("")},v.setPenStyles=function(c){this.currPenState.setStyles(c);var E=this.chars[this.pos];E.setPenState(this.currPenState)},b}(),h=function(){function b(p){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var c=0;c<H;c++)this.rows.push(new n(p));this.logger=p,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var v=b.prototype;return v.reset=function(){for(var c=0;c<H;c++)this.rows[c].clear();this.currRow=H-1},v.equals=function(c){for(var E=!0,y=0;y<H;y++)if(!this.rows[y].equals(c.rows[y])){E=!1;break}return E},v.copy=function(c){for(var E=0;E<H;E++)this.rows[E].copy(c.rows[E])},v.isEmpty=function(){for(var c=!0,E=0;E<H;E++)if(!this.rows[E].isEmpty()){c=!1;break}return c},v.backSpace=function(){var c=this.rows[this.currRow];c.backSpace()},v.clearToEndOfRow=function(){var c=this.rows[this.currRow];c.clearToEndOfRow()},v.insertChar=function(c){var E=this.rows[this.currRow];E.insertChar(c)},v.setPen=function(c){var E=this.rows[this.currRow];E.setPenStyles(c)},v.moveCursor=function(c){var E=this.rows[this.currRow];E.moveCursor(c)},v.setCursor=function(c){this.logger.log(d.INFO,"setCursor: "+c);var E=this.rows[this.currRow];E.setCursor(c)},v.setPAC=function(c){this.logger.log(d.INFO,"pacData = "+JSON.stringify(c));var E=c.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var y=0;y<H;y++)this.rows[y].clear();var _=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var N=P.rows[_].cueStartTime,K=this.logger.time;if(N&&K!==null&&N<K)for(var $=0;$<this.nrRollUpRows;$++)this.rows[E-this.nrRollUpRows+$+1].copy(P.rows[_+$])}}this.currRow=E;var B=this.rows[this.currRow];if(c.indent!==null){var R=c.indent,G=Math.max(R-1,0);B.setCursor(c.indent),c.color=B.chars[G].penState.foreground}var Q={foreground:c.color,underline:c.underline,italics:c.italics,background:"black",flash:!1};this.setPen(Q)},v.setBkgData=function(c){this.logger.log(d.INFO,"bkgData = "+JSON.stringify(c)),this.backSpace(),this.setPen(c),this.insertChar(32)},v.setRollUpRows=function(c){this.nrRollUpRows=c},v.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(d.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(d.TEXT,this.getDisplayText());var c=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(c,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(d.INFO,"Rolling up")},v.getDisplayText=function(c){c=c||!1;for(var E=[],y="",_=-1,P=0;P<H;P++){var N=this.rows[P].getTextString();N&&(_=P+1,c?E.push("Row "+_+": '"+N+"'"):E.push(N.trim()))}return E.length>0&&(c?y="["+E.join(" | ")+"]":y=E.join(`
|
|
`)),y},v.getTextAndFormat=function(){return this.rows},b}(),O=function(){function b(p,c,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=p,this.outputFilter=c,this.mode=null,this.verbose=0,this.displayedMemory=new h(E),this.nonDisplayedMemory=new h(E),this.lastOutputScreen=new h(E),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var v=b.prototype;return v.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},v.getHandler=function(){return this.outputFilter},v.setHandler=function(c){this.outputFilter=c},v.setPAC=function(c){this.writeScreen.setPAC(c)},v.setBkgData=function(c){this.writeScreen.setBkgData(c)},v.setMode=function(c){if(c===this.mode)return;this.mode=c,this.logger.log(d.INFO,"MODE="+c),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=c},v.insertChars=function(c){for(var E=0;E<c.length;E++)this.writeScreen.insertChar(c[E]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(d.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(d.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},v.ccRCL=function(){this.logger.log(d.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},v.ccBS=function(){if(this.logger.log(d.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},v.ccAOF=function(){},v.ccAON=function(){},v.ccDER=function(){this.logger.log(d.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},v.ccRU=function(c){this.logger.log(d.INFO,"RU("+c+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(c)},v.ccFON=function(){this.logger.log(d.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},v.ccRDC=function(){this.logger.log(d.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},v.ccTR=function(){this.logger.log(d.INFO,"TR"),this.setMode("MODE_TEXT")},v.ccRTD=function(){this.logger.log(d.INFO,"RTD"),this.setMode("MODE_TEXT")},v.ccEDM=function(){this.logger.log(d.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},v.ccCR=function(){this.logger.log(d.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},v.ccENM=function(){this.logger.log(d.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},v.ccEOC=function(){if(this.logger.log(d.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var c=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=c,this.writeScreen=this.nonDisplayedMemory,this.logger.log(d.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},v.ccTO=function(c){this.logger.log(d.INFO,"TO("+c+") - Tab Offset"),this.writeScreen.moveCursor(c)},v.ccMIDROW=function(c){var E={flash:!1};if(E.underline=c%2===1,E.italics=c>=46,E.italics)E.foreground="white";else{var y=Math.floor(c/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=_[y]}this.logger.log(d.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},v.outputDataUpdate=function(c){c===void 0&&(c=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),c&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},v.cueSplitAtTime=function(c){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,c,this.displayedMemory),this.cueStartTime=c))},b}(),S=function(){function b(p,c,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new s;this.channels=[null,new O(p,c,y),new O(p+1,E,y)],this.cmdHistory=C(),this.logger=y}var v=b.prototype;return v.getHandler=function(c){return this.channels[c].getHandler()},v.setHandler=function(c,E){this.channels[c].setHandler(E)},v.addData=function(c,E){var y,_,P,N=!1;this.logger.time=c;for(var K=0;K<E.length;K+=2){if(_=E[K]&127,P=E[K+1]&127,_===0&&P===0)continue;if(this.logger.log(d.DATA,"["+l([E[K],E[K+1]])+"] -> ("+l([_,P])+")"),y=this.parseCmd(_,P),y||(y=this.parseMidrow(_,P)),y||(y=this.parsePAC(_,P)),y||(y=this.parseBackgroundAttributes(_,P)),!y&&(N=this.parseChars(_,P),N)){var $=this.currentChannel;if($&&$>0){var B=this.channels[$];B.insertChars(N)}else this.logger.log(d.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!N&&this.logger.log(d.WARNING,"Couldn't parse cleaned data "+l([_,P])+" orig: "+l([E[K],E[K+1]]))}},v.parseCmd=function(c,E){var y=this.cmdHistory,_=(c===20||c===28||c===21||c===29)&&E>=32&&E<=47,P=(c===23||c===31)&&E>=33&&E<=35;if(!(_||P))return!1;if(A(c,E,y))return x(null,null,y),this.logger.log(d.DEBUG,"Repeated command ("+l([c,E])+") is dropped"),!0;var N=c===20||c===21||c===23?1:2,K=this.channels[N];return c===20||c===21||c===28||c===29?E===32?K.ccRCL():E===33?K.ccBS():E===34?K.ccAOF():E===35?K.ccAON():E===36?K.ccDER():E===37?K.ccRU(2):E===38?K.ccRU(3):E===39?K.ccRU(4):E===40?K.ccFON():E===41?K.ccRDC():E===42?K.ccTR():E===43?K.ccRTD():E===44?K.ccEDM():E===45?K.ccCR():E===46?K.ccENM():E===47&&K.ccEOC():K.ccTO(E-32),x(c,E,y),this.currentChannel=N,!0},v.parseMidrow=function(c,E){var y=0;if((c===17||c===25)&&E>=32&&E<=47){if(c===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(d.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[y];return _?(_.ccMIDROW(E),this.logger.log(d.DEBUG,"MIDROW ("+l([c,E])+")"),!0):!1}return!1},v.parsePAC=function(c,E){var y,_=this.cmdHistory,P=(c>=17&&c<=23||c>=25&&c<=31)&&E>=64&&E<=127,N=(c===16||c===24)&&E>=64&&E<=95;if(!(P||N))return!1;if(A(c,E,_))return x(null,null,_),!0;var K=c<=23?1:2;E>=64&&E<=95?y=K===1?D[c]:g[c]:y=K===1?I[c]:f[c];var $=this.channels[K];return $?($.setPAC(this.interpretPAC(y,E)),x(c,E,_),this.currentChannel=K,!0):!1},v.interpretPAC=function(c,E){var y,_={color:null,italics:!1,indent:null,underline:!1,row:c};return E>95?y=E-96:y=E-64,_.underline=(y&1)===1,y<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((y-16)/2)*4,_},v.parseChars=function(c,E){var y,_=null,P=null;if(c>=25?(y=2,P=c-8):(y=1,P=c),P>=17&&P<=19){var N;P===17?N=E+80:P===18?N=E+112:N=E+144,this.logger.log(d.INFO,"Special char '"+L(N)+"' in channel "+y),_=[N]}else c>=32&&c<=127&&(_=E===0?[c]:[c,E]);if(_){var K=l(_);this.logger.log(d.DEBUG,"Char codes = "+K.join(",")),x(c,E,this.cmdHistory)}return _},v.parseBackgroundAttributes=function(c,E){var y=(c===16||c===24)&&E>=32&&E<=47,_=(c===23||c===31)&&E>=45&&E<=47;if(!(y||_))return!1;var P,N={};c===16||c===24?(P=Math.floor((E-32)/2),N.background=u[P],E%2===1&&(N.background=N.background+"_semi")):E===45?N.background="transparent":(N.foreground="black",E===47&&(N.underline=!0));var K=c<=23?1:2,$=this.channels[K];return $.setBkgData(N),x(c,E,this.cmdHistory),!0},v.reset=function(){for(var c=0;c<Object.keys(this.channels).length;c++){var E=this.channels[c];E&&E.reset()}this.cmdHistory=C()},v.cueSplitAtTime=function(c){for(var E=0;E<this.channels.length;E++){var y=this.channels[E];y&&y.cueSplitAtTime(c)}},b}();function x(b,v,p){p.a=b,p.b=v}function A(b,v,p){return p.a===b&&p.b===v}function C(){return{a:null,b:null}}V.default=S},"./src/utils/codecs.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"isCodecType",function(){return U}),M.d(V,"isCodecSupportedInMp4",function(){return L});var z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(H,F){var D=z[F];return!!D&&D[H.slice(0,4)]===!0}function L(H,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/utils/vttparser.ts"),U=M("./src/utils/webvtt-parser.ts"),L=M("./src/utils/texttrack-utils.ts"),H=/\s/,F={newCue:function(I,g,f,u){for(var d=[],s,l,r,a,n,h=self.VTTCue||self.TextTrackCue,O=0;O<u.rows.length;O++)if(s=u.rows[O],r=!0,a=0,n="",!s.isEmpty()){for(var S=0;S<s.chars.length;S++)H.test(s.chars[S].uchar)&&r?a++:(n+=s.chars[S].uchar,r=!1);s.cueStartTime=g,g===f&&(f+=1e-4),a>=16?a--:a++;var x=Object(z.fixLineBreaks)(n.trim()),A=Object(U.generateCueId)(g,f,x);(!I||!I.cues||!I.cues.getCueById(A))&&(l=new h(g,f,x),l.id=A,l.line=O+1,l.align="left",l.position=10+Math.min(80,Math.floor(a*8/32)*10),d.push(l))}return I&&d.length&&(d.sort(function(C,b){return C.line==="auto"||b.line==="auto"?0:C.line>8&&b.line>8?b.line-C.line:C.line-b.line}),d.forEach(function(C){return Object(L.addCueToTrack)(I,C)})),d}};V.default=F},"./src/utils/discontinuities.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"findFirstFragWithCC",function(){return H}),M.d(V,"shouldAlignOnDiscontinuities",function(){return F}),M.d(V,"findDiscontinuousReferenceFrag",function(){return D}),M.d(V,"adjustSlidingStart",function(){return g}),M.d(V,"alignStream",function(){return f}),M.d(V,"alignPDT",function(){return d}),M.d(V,"alignFragmentByPDTDelta",function(){return s}),M.d(V,"alignMediaPlaylistByPDT",function(){return l});var z=M("./src/polyfills/number.ts"),U=M("./src/utils/logger.ts"),L=M("./src/controller/level-helper.ts");function H(r,a){for(var n=null,h=0,O=r.length;h<O;h++){var S=r[h];if(S&&S.cc===a){n=S;break}}return n}function F(r,a,n){return!!(a.details&&(n.endCC>n.startCC||r&&r.cc<n.startCC))}function D(r,a){var n=r.fragments,h=a.fragments;if(!h.length||!n.length){U.logger.log("No fragments to align");return}var O=H(n,h[0].cc);if(!O||O&&!O.startPTS){U.logger.log("No frag in previous level to align on");return}return O}function I(r,a){if(r){var n=r.start+a;r.start=r.startPTS=n,r.endPTS=n+r.duration}}function g(r,a){for(var n=a.fragments,h=0,O=n.length;h<O;h++)I(n[h],r);a.fragmentHint&&I(a.fragmentHint,r),a.alignedSliding=!0}function f(r,a,n){if(!a)return;u(r,n,a),!n.alignedSliding&&a.details&&d(n,a.details),!n.alignedSliding&&a.details&&!n.skippedSegments&&Object(L.adjustSliding)(a.details,n)}function u(r,a,n){if(F(r,n,a)){var h=D(n.details,a);h&&Object(z.isFiniteNumber)(h.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(h.start,a))}}function d(r,a){if(!a.fragments.length||!r.hasProgramDateTime||!a.hasProgramDateTime)return;var n=a.fragments[0].programDateTime,h=r.fragments[0].programDateTime,O=(h-n)/1e3+a.fragments[0].start;O&&Object(z.isFiniteNumber)(O)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(h-n)+"ms, sliding:"+O.toFixed(3)+" "+r.url+" "),g(O,r))}function s(r,a){var n=r.programDateTime;if(!n)return;var h=(n-a)/1e3;r.start=r.startPTS=h,r.endPTS=h+r.duration}function l(r,a){if(!a.fragments.length||!r.hasProgramDateTime||!a.hasProgramDateTime)return;var n=a.fragments[0].programDateTime,h=a.fragments[0].start,O=n-h*1e3;r.fragments.forEach(function(S){s(S,O)}),r.fragmentHint&&s(r.fragmentHint,O),r.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/utils/ewma.ts"),U=function(){function L(F,D,I){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=I,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(F),this.fast_=new z.default(D)}var H=L.prototype;return H.update=function(D,I){var g=this.slow_,f=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new z.default(D,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==I&&(this.fast_=new z.default(I,f.getEstimate(),f.getTotalWeight()))},H.sample=function(D,I){D=Math.max(D,this.minDelayMs_);var g=8*I,f=D/1e3,u=g/f;this.fast_.sample(f,u),this.slow_.sample(f,u)},H.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},L}();V.default=U},"./src/utils/ewma.ts":function(q,V,M){"use strict";M.r(V);var z=function(){function U(H,F,D){F===void 0&&(F=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=F,this.totalWeight_=D}var L=U.prototype;return L.sample=function(F,D){var I=Math.pow(this.alpha_,F);this.estimate_=D*(1-I)+I*this.estimate_,this.totalWeight_+=F},L.getTotalWeight=function(){return this.totalWeight_},L.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},U}();V.default=z},"./src/utils/fetch-loader.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"fetchSupported",function(){return s});var z=M("./src/polyfills/number.ts"),U=M("./src/loader/load-stats.ts"),L=M("./src/demux/chunk-cache.ts");function H(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,f(h,O)}function F(h){var O=typeof Map=="function"?new Map:void 0;return F=function(x){if(x===null||!g(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(x))return O.get(x);O.set(x,A)}function A(){return D(x,arguments,u(this).constructor)}return A.prototype=Object.create(x.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),f(A,x)},F(h)}function D(h,O,S){return I()?D=Reflect.construct:D=function(A,C,b){var v=[null];v.push.apply(v,C);var p=Function.bind.apply(A,v),c=new p;return b&&f(c,b.prototype),c},D.apply(null,arguments)}function I(){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(h){return!1}}function g(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function f(h,O){return f=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},f(h,O)}function u(h){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)},u(h)}function d(){return d=Object.assign||function(h){for(var O=1;O<arguments.length;O++){var S=arguments[O];for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(h[x]=S[x])}return h},d.apply(this,arguments)}function s(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var l=function(){function h(S){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=S.fetchSetup||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var O=h.prototype;return O.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},O.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},O.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},O.load=function(x,A,C){var b=this,v=this.stats;if(v.loading.start)throw new Error("Loader can only be used once.");v.loading.start=self.performance.now();var p=r(x,this.controller.signal),c=C.onProgress,E=x.responseType==="arraybuffer",y=E?"byteLength":"length";this.context=x,this.config=A,this.callbacks=C,this.request=this.fetchSetup(x,p),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){b.abortInternal(),C.onTimeout(v,x,b.response)},A.timeout),self.fetch(this.request).then(function(_){if(b.response=b.loader=_,!_.ok){var P=_.status,N=_.statusText;throw new n(N||"fetch, bad network response",P,_)}return v.loading.first=Math.max(self.performance.now(),v.loading.start),v.total=parseInt(_.headers.get("Content-Length")||"0"),c&&Object(z.isFiniteNumber)(A.highWaterMark)?b.loadProgressively(_,v,x,A.highWaterMark,c):E?_.arrayBuffer():_.text()}).then(function(_){var P=b.response;self.clearTimeout(b.requestTimeout),v.loading.end=Math.max(self.performance.now(),v.loading.first),v.loaded=v.total=_[y];var N={url:P.url,data:_};c&&!Object(z.isFiniteNumber)(A.highWaterMark)&&c(v,x,_,P),C.onSuccess(N,v,x,P)}).catch(function(_){if(self.clearTimeout(b.requestTimeout),v.aborted)return;var P=_.code||0;C.onError({code:P,text:_.message},x,_.details)})},O.getCacheAge=function(){var x=null;if(this.response){var A=this.response.headers.get("age");x=A?parseFloat(A):null}return x},O.loadProgressively=function(x,A,C,b,v){b===void 0&&(b=0);var p=new L.default,c=x.body.getReader(),E=function y(){return c.read().then(function(_){if(_.done)return p.dataLength&&v(A,C,p.flush(),x),Promise.resolve(new ArrayBuffer(0));var P=_.value,N=P.length;return A.loaded+=N,N<b||p.dataLength?(p.push(P),p.dataLength>=b&&v(A,C,p.flush(),x)):v(A,C,P,x),y()}).catch(function(){return Promise.reject()})};return E()},h}();function r(h,O){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(d({},h.headers))};return h.rangeEnd&&S.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),S}function a(h,O){return new self.Request(h.url,O)}var n=function(h){H(O,h);function O(S,x,A){var C;return C=h.call(this,S)||this,C.code=void 0,C.details=void 0,C.code=x,C.details=A,C}return O}(F(Error));V.default=l},"./src/utils/imsc1-ttml-parser.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"IMSC1_CODEC",function(){return g}),M.d(V,"parseIMSC1",function(){return s});var z=M("./src/utils/mp4-tools.ts"),U=M("./src/utils/vttparser.ts"),L=M("./src/utils/vttcue.ts"),H=M("./src/demux/id3.ts"),F=M("./src/utils/timescale-conversion.ts"),D=M("./src/utils/webvtt-parser.ts");function I(){return I=Object.assign||function(b){for(var v=1;v<arguments.length;v++){var p=arguments[v];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(b[c]=p[c])}return b},I.apply(this,arguments)}var g="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,u=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,d={left:"start",center:"center",right:"end",start:"start",end:"end"};function s(b,v,p,c,E){var y=Object(z.findBox)(new Uint8Array(b),["mdat"]);if(y.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var _=y[0],P=Object(H.utf8ArrayToStr)(new Uint8Array(b,_.start,_.end-_.start)),N=Object(F.toTimescaleFromScale)(v,1,p);try{c(l(P,N))}catch(K){E(K)}}function l(b,v){var p=new DOMParser,c=p.parseFromString(b,"text/xml"),E=c.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(y).reduce(function(B,R){return B[R]=E.getAttribute("ttp:"+R)||y[R],B},{}),P=E.getAttribute("xml:space")!=="preserve",N=a(r(E,"styling","style")),K=a(r(E,"layout","region")),$=r(E,"body","[begin]");return[].map.call($,function(B){var R=n(B,P);if(!R||!B.hasAttribute("begin"))return null;var G=x(B.getAttribute("begin"),_),Q=x(B.getAttribute("dur"),_),ne=x(B.getAttribute("end"),_);if(G===null)throw S(B);if(ne===null){if(Q===null)throw S(B);ne=G+Q}var le=new L.default(G-v,ne-v,R);le.id=Object(D.generateCueId)(le.startTime,le.endTime,le.text);var _e=K[B.getAttribute("region")],pe=N[B.getAttribute("style")];le.position=10,le.size=80;var Ee=h(_e,pe),Oe=Ee.textAlign;if(Oe){var we=d[Oe];we&&(le.lineAlign=we),le.align=Oe}return I(le,Ee),le}).filter(function(B){return B!==null})}function r(b,v,p){var c=b.getElementsByTagName(v)[0];return c?[].slice.call(c.querySelectorAll(p)):[]}function a(b){return b.reduce(function(v,p){var c=p.getAttribute("xml:id");return c&&(v[c]=p),v},{})}function n(b,v){return[].slice.call(b.childNodes).reduce(function(p,c,E){var y;return c.nodeName==="br"&&E?p+`
|
|
`:(y=c.childNodes)!==null&&y!==void 0&&y.length?n(c,v):v?p+c.textContent.trim().replace(/\s+/g," "):p+c.textContent},"")}function h(b,v){var p="http://www.w3.org/ns/ttml#styling",c=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return c.reduce(function(E,y){var _=O(v,p,y)||O(b,p,y);return _&&(E[y]=_),E},{})}function O(b,v,p){return b.hasAttributeNS(v,p)?b.getAttributeNS(v,p):null}function S(b){return new Error("Could not parse ttml timestamp "+b)}function x(b,v){if(!b)return null;var p=Object(U.parseTimeStamp)(b);return p===null&&(f.test(b)?p=A(b,v):u.test(b)&&(p=C(b,v))),p}function A(b,v){var p=f.exec(b),c=(p[4]|0)+(p[5]|0)/v.subFrameRate;return(p[1]|0)*3600+(p[2]|0)*60+(p[3]|0)+c/v.frameRate}function C(b,v){var p=u.exec(b),c=Number(p[1]),E=p[2];switch(E){case"h":return c*3600;case"m":return c*60;case"ms":return c*1e3;case"f":return c/v.frameRate;case"t":return c/v.tickRate}return c}},"./src/utils/logger.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"enableLogs",function(){return D}),M.d(V,"logger",function(){return I});var z=function(){},U={trace:z,debug:z,log:z,warn:z,info:z,error:z},L=U;function H(g){var f=self.console[g];return f?f.bind(self.console,"["+g+"] >"):z}function F(g){for(var f=arguments.length,u=new Array(f>1?f-1:0),d=1;d<f;d++)u[d-1]=arguments[d];u.forEach(function(s){L[s]=g[s]?g[s].bind(g):H(s)})}function D(g){if(self.console&&g===!0||typeof g=="object"){F(g,"debug","log","info","warn","error");try{L.log()}catch(f){L=U}}else L=U}var I=L},"./src/utils/mediakeys-helper.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"KeySystems",function(){return z}),M.d(V,"requestMediaKeySystemAccess",function(){return U});var z;(function(L){L.WIDEVINE="com.widevine.alpha",L.PLAYREADY="com.microsoft.playready"})(z||(z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"bin2str",function(){return F}),M.d(V,"readUint16",function(){return D}),M.d(V,"readUint32",function(){return I}),M.d(V,"writeUint32",function(){return g}),M.d(V,"findBox",function(){return f}),M.d(V,"parseSegmentIndex",function(){return u}),M.d(V,"parseInitSegment",function(){return d}),M.d(V,"getStartDTS",function(){return s}),M.d(V,"getDuration",function(){return l}),M.d(V,"computeRawDurationFromSamples",function(){return r}),M.d(V,"offsetStartDTS",function(){return a}),M.d(V,"segmentValidRange",function(){return n}),M.d(V,"appendUint8Array",function(){return h});var z=M("./src/utils/typed-array.ts"),U=M("./src/loader/fragment.ts"),L=Math.pow(2,32)-1,H=[].push;function F(O){return String.fromCharCode.apply(null,O)}function D(O,S){"data"in O&&(S+=O.start,O=O.data);var x=O[S]<<8|O[S+1];return x<0?65536+x:x}function I(O,S){"data"in O&&(S+=O.start,O=O.data);var x=O[S]<<24|O[S+1]<<16|O[S+2]<<8|O[S+3];return x<0?4294967296+x:x}function g(O,S,x){"data"in O&&(S+=O.start,O=O.data),O[S]=x>>24,O[S+1]=x>>16&255,O[S+2]=x>>8&255,O[S+3]=x&255}function f(O,S){var x=[];if(!S.length)return x;var A,C,b;"data"in O?(A=O.data,C=O.start,b=O.end):(A=O,C=0,b=A.byteLength);for(var v=C;v<b;){var p=I(A,v),c=F(A.subarray(v+4,v+8)),E=p>1?v+p:b;if(c===S[0])if(S.length===1)x.push({data:A,start:v+8,end:E});else{var y=f({data:A,start:v+8,end:E},S.slice(1));y.length&&H.apply(x,y)}v=E}return x}function u(O){var S=f(O,["moov"]),x=S[0],A=x?x.end:null,C=f(O,["sidx"]);if(!C||!C[0])return null;var b=[],v=C[0],p=v.data[0],c=p===0?8:16,E=I(v,c);c+=4;var y=0,_=0;p===0?c+=8:c+=16,c+=2;var P=v.end+_,N=D(v,c);c+=2;for(var K=0;K<N;K++){var $=c,B=I(v,$);$+=4;var R=B&2147483647,G=(B&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Q=I(v,$);$+=4,b.push({referenceSize:R,subsegmentDuration:Q,info:{duration:Q/E,start:P,end:P+R-1}}),P+=R,$+=4,c=$}return{earliestPresentationTime:y,timescale:E,version:p,referencesCount:N,references:b,moovEndOffset:A}}function d(O){for(var S=[],x=f(O,["moov","trak"]),A=0;A<x.length;A++){var C=x[A],b=f(C,["tkhd"])[0];if(b){var v=b.data[b.start],p=v===0?12:20,c=I(b,p),E=f(C,["mdia","mdhd"])[0];if(E){v=E.data[E.start],p=v===0?12:20;var y=I(E,p),_=f(C,["mdia","hdlr"])[0];if(_){var P=F(_.data.subarray(_.start+8,_.start+12)),N={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[P];if(N){var K=f(C,["mdia","minf","stbl","stsd"])[0],$=void 0;K&&($=F(K.data.subarray(K.start+12,K.start+16))),S[c]={timescale:y,type:N},S[N]={timescale:y,id:c,codec:$}}}}}}var B=f(O,["moov","mvex","trex"]);return B.forEach(function(R){var G=I(R,4),Q=S[G];Q&&(Q.default={duration:I(R,12),flags:I(R,20)})}),S}function s(O,S){return f(S,["moof","traf"]).reduce(function(x,A){var C=f(A,["tfdt"])[0],b=C.data[C.start],v=f(A,["tfhd"]).reduce(function(p,c){var E=I(c,4),y=O[E];if(y){var _=I(C,4);b===1&&(_*=Math.pow(2,32),_+=I(C,8));var P=y.timescale||9e4,N=_/P;if(isFinite(N)&&(p===null||N<p))return N}return p},null);return v!==null&&isFinite(v)&&(x===null||v<x)?v:x},null)||0}function l(O,S){for(var x=0,A=0,C=0,b=f(O,["moof","traf"]),v=0;v<b.length;v++){var p=b[v],c=f(p,["tfhd"])[0],E=I(c,4),y=S[E];if(!y)continue;var _=y.default,P=I(c,0)|(_==null?void 0:_.flags),N=_==null?void 0:_.duration;P&8&&(P&2?N=I(c,12):N=I(c,8));for(var K=y.timescale||9e4,$=f(p,["trun"]),B=0;B<$.length;B++){if(N){var R=I($[B],4);x=N*R}else x=r($[B]);y.type===U.ElementaryStreamTypes.VIDEO?A+=x/K:y.type===U.ElementaryStreamTypes.AUDIO&&(C+=x/K)}}if(A===0&&C===0){var G=u(O);if(G!=null&&G.references)return G.references.reduce(function(Q,ne){return Q+ne.info.duration||0},0)}return A||C}function r(O){var S=I(O,0),x=8;S&1&&(x+=4),S&4&&(x+=4);for(var A=0,C=I(O,4),b=0;b<C;b++){if(S&256){var v=I(O,x);A+=v,x+=4}S&512&&(x+=4),S&1024&&(x+=4),S&2048&&(x+=4)}return A}function a(O,S,x){f(S,["moof","traf"]).forEach(function(A){f(A,["tfhd"]).forEach(function(C){var b=I(C,4),v=O[b];if(!v)return;var p=v.timescale||9e4;f(A,["tfdt"]).forEach(function(c){var E=c.data[c.start],y=I(c,4);if(E===0)g(c,4,y-x*p);else{y*=Math.pow(2,32),y+=I(c,8),y-=x*p,y=Math.max(y,0);var _=Math.floor(y/(L+1)),P=Math.floor(y%(L+1));g(c,4,_),g(c,8,P)}})})})}function n(O){var S={valid:null,remainder:null},x=f(O,["moof"]);if(x){if(x.length<2)return S.remainder=O,S}else return S;var A=x[x.length-1];return S.valid=Object(z.sliceUint8)(O,0,A.start-8),S.remainder=Object(z.sliceUint8)(O,A.start-8),S}function h(O,S){var x=new Uint8Array(O.length+S.length);return x.set(O),x.set(S,O.length),x}},"./src/utils/output-filter.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"default",function(){return z});var z=function(){function U(H,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=F}var L=U.prototype;return L.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},L.newCue=function(F,D,I){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=D,this.screen=I,this.timelineController.createCaptionsTrack(this.trackName)},L.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"sendAddTrackEvent",function(){return U}),M.d(V,"addCueToTrack",function(){return L}),M.d(V,"clearCurrentCues",function(){return H}),M.d(V,"removeCuesInRange",function(){return F}),M.d(V,"getCuesInRange",function(){return I});var z=M("./src/utils/logger.ts");function U(g,f){var u;try{u=new Event("addtrack")}catch(d){u=document.createEvent("Event"),u.initEvent("addtrack",!1,!1)}u.track=g,f.dispatchEvent(u)}function L(g,f){var u=g.mode;if(u==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(f.id))try{if(g.addCue(f),!g.cues.getCueById(f.id))throw new Error("addCue is failed for: "+f)}catch(s){z.logger.debug("[texttrack-utils]: "+s);var d=new self.TextTrackCue(f.startTime,f.endTime,f.text);d.id=f.id,g.addCue(d)}u==="disabled"&&(g.mode=u)}function H(g){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues)for(var u=g.cues.length;u--;)g.removeCue(g.cues[u]);f==="disabled"&&(g.mode=f)}function F(g,f,u){var d=g.mode;if(d==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var s=I(g.cues,f,u),l=0;l<s.length;l++)g.removeCue(s[l]);d==="disabled"&&(g.mode=d)}function D(g,f){if(f<g[0].startTime)return 0;var u=g.length-1;if(f>g[u].endTime)return-1;for(var d=0,s=u;d<=s;){var l=Math.floor((s+d)/2);if(f<g[l].startTime)s=l-1;else if(f>g[l].startTime&&d<u)d=l+1;else return l}return g[d].startTime-f<f-g[s].startTime?d:s}function I(g,f,u){var d=[],s=D(g,f);if(s>-1)for(var l=s,r=g.length;l<r;l++){var a=g[l];if(a.startTime>=f&&a.endTime<=u)d.push(a);else if(a.startTime>u)return d}return d}},"./src/utils/time-ranges.ts":function(q,V,M){"use strict";M.r(V);var z={toString:function(L){for(var H="",F=L.length,D=0;D<F;D++)H+="["+L.start(D).toFixed(3)+","+L.end(D).toFixed(3)+"]";return H}};V.default=z},"./src/utils/timescale-conversion.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"toTimescaleFromBase",function(){return U}),M.d(V,"toTimescaleFromScale",function(){return L}),M.d(V,"toMsFromMpegTsClock",function(){return H}),M.d(V,"toMpegTsClockFromTimescale",function(){return F});var z=9e4;function U(D,I,g,f){g===void 0&&(g=1),f===void 0&&(f=!1);var u=D*I*g;return f?Math.round(u):u}function L(D,I,g,f){return g===void 0&&(g=1),f===void 0&&(f=!1),U(D,I,1/g,f)}function H(D,I){return I===void 0&&(I=!1),U(D,1e3,1/z,I)}function F(D,I){return I===void 0&&(I=1),U(D,z,1/I)}},"./src/utils/typed-array.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"sliceUint8",function(){return z});function z(U,L,H){return Uint8Array.prototype.slice?U.slice(L,H):new Uint8Array(Array.prototype.slice.call(U,L,H))}},"./src/utils/vttcue.ts":function(q,V,M){"use strict";M.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],U=["start","middle","end","left","right"];function L(g,f){if(typeof f!="string")return!1;if(!Array.isArray(g))return!1;var u=f.toLowerCase();return~g.indexOf(u)?u:!1}function H(g){return L(z,g)}function F(g){return L(U,g)}function D(g){for(var f=arguments.length,u=new Array(f>1?f-1:0),d=1;d<f;d++)u[d-1]=arguments[d];for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var r in l)g[r]=l[r]}return g}function I(g,f,u){var d=this,s={enumerable:!0};d.hasBeenReset=!1;var l="",r=!1,a=g,n=f,h=u,O=null,S="",x=!0,A="auto",C="start",b=50,v="middle",p=50,c="middle";Object.defineProperty(d,"id",D({},s,{get:function(){return l},set:function(y){l=""+y}})),Object.defineProperty(d,"pauseOnExit",D({},s,{get:function(){return r},set:function(y){r=!!y}})),Object.defineProperty(d,"startTime",D({},s,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",D({},s,{get:function(){return n},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");n=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",D({},s,{get:function(){return h},set:function(y){h=""+y,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",D({},s,{get:function(){return O},set:function(y){O=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",D({},s,{get:function(){return S},set:function(y){var _=H(y);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",D({},s,{get:function(){return x},set:function(y){x=!!y,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",D({},s,{get:function(){return A},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",D({},s,{get:function(){return C},set:function(y){var _=F(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");C=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",D({},s,{get:function(){return b},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");b=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",D({},s,{get:function(){return v},set:function(y){var _=F(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");v=_,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",D({},s,{get:function(){return p},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",D({},s,{get:function(){return c},set:function(y){var _=F(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");c=_,this.hasBeenReset=!0}})),d.displayState=void 0}return I.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},I}()},"./src/utils/vttparser.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"parseTimeStamp",function(){return L}),M.d(V,"fixLineBreaks",function(){return f}),M.d(V,"VTTParser",function(){return u});var z=M("./src/utils/vttcue.ts"),U=function(){function d(){}var s=d.prototype;return s.decode=function(r,a){if(!r)return"";if(typeof r!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(r))},d}();function L(d){function s(r,a,n,h){return(r|0)*3600+(a|0)*60+(n|0)+parseFloat(h||0)}var l=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return l?parseFloat(l[2])>59?s(l[2],l[3],0,l[4]):s(l[1],l[2],l[3],l[4]):null}var H=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(r,a){!this.get(r)&&a!==""&&(this.values[r]=a)},s.get=function(r,a,n){return n?this.has(r)?this.values[r]:a[n]:this.has(r)?this.values[r]:a},s.has=function(r){return r in this.values},s.alt=function(r,a,n){for(var h=0;h<n.length;++h)if(a===n[h]){this.set(r,a);break}},s.integer=function(r,a){/^-?\d+$/.test(a)&&this.set(r,parseInt(a,10))},s.percent=function(r,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var n=parseFloat(a);if(n>=0&&n<=100)return this.set(r,n),!0}return!1},d}();function F(d,s,l,r){var a=r?d.split(r):[d];for(var n in a){if(typeof a[n]!="string")continue;var h=a[n].split(l);if(h.length!==2)continue;var O=h[0],S=h[1];s(O,S)}}var D=new z.default(0,0,""),I=D.align==="middle"?"middle":"center";function g(d,s,l){var r=d;function a(){var O=L(d);if(O===null)throw new Error("Malformed timestamp: "+r);return d=d.replace(/^[^\sa-zA-Z-]+/,""),O}function n(O,S){var x=new H;F(O,function(b,v){var p;switch(b){case"region":for(var c=l.length-1;c>=0;c--)if(l[c].id===v){x.set(b,l[c].region);break}break;case"vertical":x.alt(b,v,["rl","lr"]);break;case"line":p=v.split(","),x.integer(b,p[0]),x.percent(b,p[0])&&x.set("snapToLines",!1),x.alt(b,p[0],["auto"]),p.length===2&&x.alt("lineAlign",p[1],["start",I,"end"]);break;case"position":p=v.split(","),x.percent(b,p[0]),p.length===2&&x.alt("positionAlign",p[1],["start",I,"end","line-left","line-right","auto"]);break;case"size":x.percent(b,v);break;case"align":x.alt(b,v,["start",I,"end","left","right"]);break}},/:/,/\s/),S.region=x.get("region",null),S.vertical=x.get("vertical","");var A=x.get("line","auto");A==="auto"&&D.line===-1&&(A=-1),S.line=A,S.lineAlign=x.get("lineAlign","start"),S.snapToLines=x.get("snapToLines",!0),S.size=x.get("size",100),S.align=x.get("align",I);var C=x.get("position","auto");C==="auto"&&D.position===50&&(C=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=C}function h(){d=d.replace(/^\s+/,"")}if(h(),s.startTime=a(),h(),d.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);d=d.substr(3),h(),s.endTime=a(),h(),n(d,s)}function f(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
`)}var u=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(r){var a=this;r&&(a.buffer+=a.decoder.decode(r,{stream:!0}));function n(){var C=a.buffer,b=0;for(C=f(C);b<C.length&&C[b]!=="\r"&&C[b]!==`
|
|
`;)++b;var v=C.substr(0,b);return C[b]==="\r"&&++b,C[b]===`
|
|
`&&++b,a.buffer=C.substr(b),v}function h(C){F(C,function(b,v){},/:/)}try{var O="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;O=n();var S=O.match(/^()?WEBVTT([ \t].*)?$/);if(!S||!S[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var x=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;x?x=!1:O=n();switch(a.state){case"HEADER":/:/.test(O)?h(O):O||(a.state="ID");continue;case"NOTE":O||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(O)){a.state="NOTE";break}if(!O)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",O.indexOf("-->")===-1){a.cue.id=O;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(O,a.cue,a.regionList)}catch(C){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=O.indexOf("-->")!==-1;if(!O||A&&(x=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=O}continue;case"BADCUE":O||(a.state="ID")}}}catch(C){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.flush=function(){var r=this;try{if((r.cue||r.state==="HEADER")&&(r.buffer+=`
|
|
|
|
`,r.parse()),r.state==="INITIAL"||r.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){r.onparsingerror&&r.onparsingerror(a)}return r.onflush&&r.onflush(),this},d}()},"./src/utils/webvtt-parser.ts":function(q,V,M){"use strict";M.r(V),M.d(V,"generateCueId",function(){return u}),M.d(V,"parseWebVTT",function(){return s});var z=M("./src/polyfills/number.ts"),U=M("./src/utils/vttparser.ts"),L=M("./src/demux/id3.ts"),H=M("./src/utils/timescale-conversion.ts"),F=M("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,I=function(r,a,n){return n===void 0&&(n=0),r.substr(n,a.length)===a},g=function(r){var a=parseInt(r.substr(-3)),n=parseInt(r.substr(-6,2)),h=parseInt(r.substr(-9,2)),O=r.length>9?parseInt(r.substr(0,r.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(n)||!Object(z.isFiniteNumber)(h)||!Object(z.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+r);return a+=1e3*n,a+=60*1e3*h,a+=60*60*1e3*O,a},f=function(r){for(var a=5381,n=r.length;n;)a=a*33^r.charCodeAt(--n);return(a>>>0).toString()};function u(l,r,a){return f(l.toString())+f(r.toString())+f(a)}var d=function(r,a,n){var h=r[a],O=r[h.prevCC];if(!O||!O.new&&h.new){r.ccOffset=r.presentationOffset=h.start,h.new=!1;return}for(;(S=O)!==null&&S!==void 0&&S.new;){var S;r.ccOffset+=h.start-O.start,h.new=!1,h=O,O=r[h.prevCC]}r.presentationOffset=n};function s(l,r,a,n,h,O,S,x){var A=new U.VTTParser,C=Object(L.utf8ArrayToStr)(new Uint8Array(l)).trim().replace(D,`
|
|
`).split(`
|
|
`),b=[],v=Object(H.toMpegTsClockFromTimescale)(r,a),p="00:00.000",c=0,E=0,y,_=!0,P=!1;A.oncue=function(N){var K=n[h],$=n.ccOffset,B=(c-v)/9e4;if(K!=null&&K.new&&(E!==void 0?$=n.ccOffset=K.start:d(n,h,B)),B&&($=B-n.presentationOffset),P){var R=N.endTime-N.startTime,G=Object(F.normalizePts)((N.startTime+$-E)*9e4,O*9e4)/9e4;N.startTime=G,N.endTime=G+R}var Q=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(Q)),N.id||(N.id=u(N.startTime,N.endTime,Q)),N.endTime>0&&b.push(N)},A.onparsingerror=function(N){y=N},A.onflush=function(){if(y){x(y);return}S(b)},C.forEach(function(N){if(_)if(I(N,"X-TIMESTAMP-MAP=")){_=!1,P=!0,N.substr(16).split(",").forEach(function(K){I(K,"LOCAL:")?p=K.substr(6):I(K,"MPEGTS:")&&(c=parseInt(K.substr(7)))});try{E=g(p)/1e3}catch(K){P=!1,y=K}return}else N===""&&(_=!1);A.parse(N+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(q,V,M){"use strict";M.r(V);var z=M("./src/utils/logger.ts"),U=M("./src/loader/load-stats.ts"),L=/^age:\s*[\d.]+\s*$/m,H=function(){function F(I){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=I?I.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var D=F.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},D.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(g,f,u){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=f,this.callbacks=u,this.retryDelay=f.retryDelay,this.loadInternal()},D.loadInternal=function(){var g=this.config,f=this.context;if(!g)return;var u=this.loader=new self.XMLHttpRequest,d=this.stats;d.loading.first=0,d.loaded=0;var s=this.xhrSetup;try{if(s)try{s(u,f.url)}catch(a){u.open("GET",f.url,!0),s(u,f.url)}u.readyState||u.open("GET",f.url,!0);var l=this.context.headers;if(l)for(var r in l)u.setRequestHeader(r,l[r])}catch(a){this.callbacks.onError({code:u.status,text:a.message},f,u);return}f.rangeEnd&&u.setRequestHeader("Range","bytes="+f.rangeStart+"-"+(f.rangeEnd-1)),u.onreadystatechange=this.readystatechange.bind(this),u.onprogress=this.loadprogress.bind(this),u.responseType=f.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),u.send()},D.readystatechange=function(){var g=this.context,f=this.loader,u=this.stats;if(!g||!f)return;var d=f.readyState,s=this.config;if(u.aborted)return;if(d>=2)if(self.clearTimeout(this.requestTimeout),u.loading.first===0&&(u.loading.first=Math.max(self.performance.now(),u.loading.start)),d===4){f.onreadystatechange=null,f.onprogress=null;var l=f.status;if(l>=200&&l<300){u.loading.end=Math.max(self.performance.now(),u.loading.first);var r,a;if(g.responseType==="arraybuffer"?(r=f.response,a=r.byteLength):(r=f.responseText,a=r.length),u.loaded=u.total=a,!this.callbacks)return;var n=this.callbacks.onProgress;if(n&&n(u,g,r,f),!this.callbacks)return;var h={url:f.responseURL,data:r};this.callbacks.onSuccess(h,u,g,f)}else u.retry>=s.maxRetry||l>=400&&l<499?(z.logger.error(l+" while loading "+g.url),this.callbacks.onError({code:l,text:f.statusText},g,f)):(z.logger.warn(l+" while loading "+g.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,s.maxRetryDelay),u.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)},D.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(g){var f=this.stats;f.loaded=g.loaded,g.lengthComputable&&(f.total=g.total)},D.getCacheAge=function(){var g=null;if(this.loader&&L.test(this.loader.getAllResponseHeaders())){var f=this.loader.getResponseHeader("age");g=f?parseFloat(f):null}return g},F}();V.default=H}}).default})},vHTk:function(Fe,Se,W){Fe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return Et});var q=W("rePB"),V=W("VTBJ"),M=W("KQm4"),z=W("U8pU"),U=W("ODXe"),L=W("q1tI"),H=W("TSYQ"),F=W.n(H),D=W("Gytx"),I=W.n(D),g=W("Kwbf"),f=W("t23M"),u=W("qx4F"),d=W("6eGT"),s=W("IBYe"),l=W("Ff2n"),r=W("c+Xe"),a=W("fyJ8"),n=W("biw7");function h(Ae,Ce,Ge,ze,Re){var je=Ge[Ae]||{},ge=Ge[Ce]||{},de,ce;je.fixed==="left"?de=ze.left[Ae]:ge.fixed==="right"&&(ce=ze.right[Ce]);var re=!1,ae=!1,ue=!1,fe=!1,be=Ge[Ce+1],Ie=Ge[Ae-1];if(Re==="rtl"){if(de!==void 0){var Xe=Ie&&Ie.fixed==="left";fe=!Xe}else if(ce!==void 0){var ut=be&&be.fixed==="right";ue=!ut}}else if(de!==void 0){var bt=be&&be.fixed==="left";re=!bt}else if(ce!==void 0){var ft=Ie&&Ie.fixed==="right";ae=!ft}return{fixLeft:de,fixRight:ce,lastFixLeft:re,firstFixRight:ae,lastFixRight:ue,firstFixLeft:fe,isSticky:ze.isSticky}}var O=W("sR1s");function S(Ae){var Ce=Ae.cells,Ge=Ae.stickyOffsets,ze=Ae.flattenColumns,Re=Ae.rowComponent,je=Ae.cellComponent,ge=Ae.onHeaderRow,de=Ae.index,ce=L.useContext(n.a),re=ce.prefixCls,ae=ce.direction,ue;ge&&(ue=ge(Ce.map(function(be){return be.column}),de));var fe=Object(O.a)(Ce.map(function(be){return be.column}));return L.createElement(Re,Object.assign({},ue),Ce.map(function(be,Ie){var Xe=be.column,ut=h(be.colStart,be.colEnd,ze,Ge,ae),bt;return Xe&&Xe.onHeaderCell&&(bt=be.column.onHeaderCell(Xe)),L.createElement(a.a,Object.assign({},be,{ellipsis:Xe.ellipsis,align:Xe.align,component:je,prefixCls:re,key:fe[Ie]},ut,{additionalProps:bt,rowType:"header"}))}))}S.displayName="HeaderRow";var x=S;function A(Ae){var Ce=[];function Ge(ge,de){var ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;Ce[ce]=Ce[ce]||[];var re=de,ae=ge.filter(Boolean).map(function(ue){var fe={key:ue.key,className:ue.className||"",children:ue.title,column:ue,colStart:re},be=1,Ie=ue.children;return Ie&&Ie.length>0&&(be=Ge(Ie,re,ce+1).reduce(function(Xe,ut){return Xe+ut},0),fe.hasSubColumns=!0),"colSpan"in ue&&(be=ue.colSpan),"rowSpan"in ue&&(fe.rowSpan=ue.rowSpan),fe.colSpan=be,fe.colEnd=fe.colStart+be-1,Ce[ce].push(fe),re+=be,be});return ae}Ge(Ae,0);for(var ze=Ce.length,Re=function(de){Ce[de].forEach(function(ce){!("rowSpan"in ce)&&!ce.hasSubColumns&&(ce.rowSpan=ze-de)})},je=0;je<ze;je+=1)Re(je);return Ce}function C(Ae){var Ce=Ae.stickyOffsets,Ge=Ae.columns,ze=Ae.flattenColumns,Re=Ae.onHeaderRow,je=L.useContext(n.a),ge=je.prefixCls,de=je.getComponent,ce=L.useMemo(function(){return A(Ge)},[Ge]),re=de(["header","wrapper"],"thead"),ae=de(["header","row"],"tr"),ue=de(["header","cell"],"th");return L.createElement(re,{className:"".concat(ge,"-thead")},ce.map(function(fe,be){var Ie=L.createElement(x,{key:be,flattenColumns:ze,cells:fe,stickyOffsets:Ce,rowComponent:ae,cellComponent:ue,onHeaderRow:Re,index:be});return Ie}))}var b=C,v=W("hW8S");function p(Ae){for(var Ce=Ae.colWidths,Ge=Ae.columns,ze=Ae.columCount,Re=[],je=ze||Ge.length,ge=!1,de=je-1;de>=0;de-=1){var ce=Ce[de],re=Ge&&Ge[de],ae=re&&re[v.a];(ce||ae||ge)&&(Re.unshift(L.createElement("col",Object.assign({key:de,style:{width:ce,minWidth:ce}},ae))),ge=!0)}return L.createElement("colgroup",null,Re)}var c=p;function E(Ae,Ce){return Object(L.useMemo)(function(){for(var Ge=[],ze=0;ze<Ce;ze+=1){var Re=Ae[ze];if(Re!==void 0)Ge[ze]=Re;else return null}return Ge},[Ae.join("_"),Ce])}var y=L.forwardRef(function(Ae,Ce){var Ge=Ae.noData,ze=Ae.columns,Re=Ae.flattenColumns,je=Ae.colWidths,ge=Ae.columCount,de=Ae.stickyOffsets,ce=Ae.direction,re=Ae.fixHeader,ae=Ae.offsetHeader,ue=Ae.stickyClassName,fe=Ae.onScroll,be=Object(l.a)(Ae,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),Ie=L.useContext(n.a),Xe=Ie.prefixCls,ut=Ie.scrollbarSize,bt=Ie.isSticky,ft=bt&&!re?0:ut,at=L.useRef(null),Be=L.useCallback(function(st){Object(r.b)(Ce,st),Object(r.b)(at,st)},[]);L.useEffect(function(){var st;function dt(Te){var ke=Te.currentTarget,rt=Te.deltaX;rt&&(fe({currentTarget:ke,scrollLeft:ke.scrollLeft+rt}),Te.preventDefault())}return(st=at.current)===null||st===void 0||st.addEventListener("wheel",dt),function(){var Te;(Te=at.current)===null||Te===void 0||Te.removeEventListener("wheel",dt)}},[]);var We=Re[Re.length-1],Me={fixed:We?We.fixed:null,onHeaderCell:function(){return{className:"".concat(Xe,"-cell-scrollbar")}}},se=Object(L.useMemo)(function(){return ft?[].concat(Object(M.a)(ze),[Me]):ze},[ft,ze]),ve=Object(L.useMemo)(function(){return ft?[].concat(Object(M.a)(Re),[Me]):Re},[ft,Re]),Ke=Object(L.useMemo)(function(){var st=de.right,dt=de.left;return Object(V.a)(Object(V.a)({},de),{},{left:ce==="rtl"?[].concat(Object(M.a)(dt.map(function(Te){return Te+ft})),[0]):dt,right:ce==="rtl"?st:[].concat(Object(M.a)(st.map(function(Te){return Te+ft})),[0]),isSticky:bt})},[ft,de,bt]),Pe=E(je,ge);return L.createElement("div",{style:Object(V.a)({overflow:"hidden"},bt?{top:ae}:{}),ref:Be,className:F()("".concat(Xe,"-header"),Object(q.a)({},ue,!!ue))},L.createElement("table",{style:{tableLayout:"fixed",visibility:Ge||Pe?null:"hidden"}},L.createElement(c,{colWidths:Pe?[].concat(Object(M.a)(Pe),[ft]):[],columCount:ge+1,columns:ve}),L.createElement(b,Object.assign({},be,{stickyOffsets:Ke,columns:se,flattenColumns:ve}))))});y.displayName="FixedHeader";var _=y,P=L.createContext(null),N=P;function K(Ae){var Ce=Ae.prefixCls,Ge=Ae.children,ze=Ae.component,Re=Ae.cellComponent,je=Ae.fixHeader,ge=Ae.fixColumn,de=Ae.horizonScroll,ce=Ae.className,re=Ae.expanded,ae=Ae.componentWidth,ue=Ae.colSpan,fe=L.useContext(n.a),be=fe.scrollbarSize;return L.useMemo(function(){var Ie=Ge;return ge&&(Ie=L.createElement("div",{style:{width:ae-(je?be:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(Ce,"-expanded-row-fixed")},Ie)),L.createElement(ze,{className:ce,style:{display:re?null:"none"}},L.createElement(a.a,{component:Re,prefixCls:Ce,colSpan:ue},Ie))},[Ge,ze,je,de,ce,re,ae,ue,be])}var $=K;function B(Ae){var Ce=Ae.className,Ge=Ae.style,ze=Ae.record,Re=Ae.index,je=Ae.rowKey,ge=Ae.getRowKey,de=Ae.rowExpandable,ce=Ae.expandedKeys,re=Ae.onRow,ae=Ae.indent,ue=ae===void 0?0:ae,fe=Ae.rowComponent,be=Ae.cellComponent,Ie=Ae.childrenColumnName,Xe=L.useContext(n.a),ut=Xe.prefixCls,bt=Xe.fixedInfoList,ft=L.useContext(N),at=ft.fixHeader,Be=ft.fixColumn,We=ft.horizonScroll,Me=ft.componentWidth,se=ft.flattenColumns,ve=ft.expandableType,Ke=ft.expandRowByClick,Pe=ft.onTriggerExpand,st=ft.rowClassName,dt=ft.expandedRowClassName,Te=ft.indentSize,ke=ft.expandIcon,rt=ft.expandedRowRender,Ct=ft.expandIconColumnIndex,At=L.useState(!1),cn=Object(U.a)(At,2),yn=cn[0],en=cn[1],Dt=ce&&ce.has(Ae.recordKey);L.useEffect(function(){Dt&&en(!0)},[Dt]);var Rn=ve==="row"&&(!de||de(ze)),Fn=ve==="nest",Cn=Ie&&ze&&ze[Ie],Qt=Rn||Fn,Sn;re&&(Sn=re(ze,Re));var Bn=function(w){if(Ke&&Qt&&Pe(ze,w),Sn&&Sn.onClick){for(var T,j=arguments.length,ee=new Array(j>1?j-1:0),X=1;X<j;X++)ee[X-1]=arguments[X];(T=Sn).onClick.apply(T,[w].concat(ee))}},li;typeof st=="string"?li=st:typeof st=="function"&&(li=st(ze,Re,ue));var ct=Object(O.a)(se),St=L.createElement(fe,Object.assign({},Sn,{"data-row-key":je,className:F()(Ce,"".concat(ut,"-row"),"".concat(ut,"-row-level-").concat(ue),li,Sn&&Sn.className),style:Object(V.a)(Object(V.a)({},Ge),Sn?Sn.style:null),onClick:Bn}),se.map(function(J,w){var T=J.render,j=J.dataIndex,ee=J.className,X=ct[w],ye=bt[w],Ve;w===(Ct||0)&&Fn&&(Ve=L.createElement(L.Fragment,null,L.createElement("span",{style:{paddingLeft:"".concat(Te*ue,"px")},className:"".concat(ut,"-row-indent indent-level-").concat(ue)}),ke({prefixCls:ut,expanded:Dt,expandable:Cn,record:ze,onExpand:Pe})));var ot;return J.onCell&&(ot=J.onCell(ze,Re)),L.createElement(a.a,Object.assign({className:ee,ellipsis:J.ellipsis,align:J.align,component:be,prefixCls:ut,key:X,record:ze,index:Re,dataIndex:j,render:T,shouldCellUpdate:J.shouldCellUpdate},ye,{appendNode:Ve,additionalProps:ot}))})),zn;if(Rn&&(yn||Dt)){var pi=rt(ze,Re,ue+1,Dt),ui=dt&&dt(ze,Re,ue);zn=L.createElement($,{expanded:Dt,className:F()("".concat(ut,"-expanded-row"),"".concat(ut,"-expanded-row-level-").concat(ue+1),ui),prefixCls:ut,fixHeader:at,fixColumn:Be,horizonScroll:We,component:fe,componentWidth:Me,cellComponent:be,colSpan:se.length},pi)}var ki;return Cn&&Dt&&(ki=(ze[Ie]||[]).map(function(J,w){var T=ge(J,w);return L.createElement(B,Object.assign({},Ae,{key:T,rowKey:T,record:J,recordKey:T,index:w,indent:ue+1}))})),L.createElement(L.Fragment,null,St,zn,ki)}B.displayName="BodyRow";var R=B,G=L.createContext(null),Q=G;function ne(Ae){var Ce=Ae.columnKey,Ge=Ae.onColumnResize,ze=L.useRef();return L.useEffect(function(){ze.current&&Ge(Ce,ze.current.offsetWidth)},[]),L.createElement(f.a,{onResize:function(je){var ge=je.offsetWidth;Ge(Ce,ge)}},L.createElement("td",{ref:ze,style:{padding:0,border:0,height:0}},L.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function le(Ae){var Ce=Ae.data,Ge=Ae.getRowKey,ze=Ae.measureColumnWidth,Re=Ae.expandedKeys,je=Ae.onRow,ge=Ae.rowExpandable,de=Ae.emptyNode,ce=Ae.childrenColumnName,re=L.useContext(Q),ae=re.onColumnResize,ue=L.useContext(n.a),fe=ue.prefixCls,be=ue.getComponent,Ie=L.useContext(N),Xe=Ie.fixHeader,ut=Ie.horizonScroll,bt=Ie.flattenColumns,ft=Ie.componentWidth;return L.useMemo(function(){var at=be(["body","wrapper"],"tbody"),Be=be(["body","row"],"tr"),We=be(["body","cell"],"td"),Me;Ce.length?Me=Ce.map(function(ve,Ke){var Pe=Ge(ve,Ke);return L.createElement(R,{key:Pe,rowKey:Pe,record:ve,recordKey:Pe,index:Ke,rowComponent:Be,cellComponent:We,expandedKeys:Re,onRow:je,getRowKey:Ge,rowExpandable:ge,childrenColumnName:ce})}):Me=L.createElement($,{expanded:!0,className:"".concat(fe,"-placeholder"),prefixCls:fe,fixHeader:Xe,fixColumn:ut,horizonScroll:ut,component:Be,componentWidth:ft,cellComponent:We,colSpan:bt.length},de);var se=Object(O.a)(bt);return L.createElement(at,{className:"".concat(fe,"-tbody")},ze&&L.createElement("tr",{"aria-hidden":"true",className:"".concat(fe,"-measure-row"),style:{height:0}},se.map(function(ve){return L.createElement(ne,{key:ve,columnKey:ve,onColumnResize:ae})})),Me)},[Ce,fe,je,ze,Re,Ge,be,ft,de,bt])}var _e=L.memo(le);_e.displayName="Body";var pe=_e,Ee=W("wRmb"),Oe=W("xEkU"),we=W.n(Oe);function he(Ae){var Ce=Object(L.useRef)(Ae),Ge=Object(L.useState)({}),ze=Object(U.a)(Ge,2),Re=ze[1],je=Object(L.useRef)(null),ge=Object(L.useRef)([]);function de(ce){je.current===null&&(ge.current=[],je.current=we()(function(){ge.current.forEach(function(re){Ce.current=re(Ce.current)}),je.current=null,Re({})})),ge.current.push(ce)}return Object(L.useEffect)(function(){return function(){we.a.cancel(je.current)}},[]),[Ce.current,de]}function oe(Ae){var Ce=Object(L.useRef)(Ae),Ge=Object(L.useRef)(null);function ze(){window.clearTimeout(Ge.current)}function Re(ge){Ce.current=ge,ze(),Ge.current=window.setTimeout(function(){Ce.current=null,Ge.current=null},100)}function je(){return Ce.current}return Object(L.useEffect)(function(){return ze},[]),[Re,je]}function Le(Ae,Ce,Ge){var ze=Object(L.useMemo)(function(){for(var Re=[],je=[],ge=0,de=0,ce=0;ce<Ce;ce+=1)if(Ge==="rtl"){je[ce]=de,de+=Ae[ce]||0;var re=Ce-ce-1;Re[re]=ge,ge+=Ae[re]||0}else{Re[ce]=ge,ge+=Ae[ce]||0;var ae=Ce-ce-1;je[ae]=de,de+=Ae[ae]||0}return{left:Re,right:je}},[Ae,Ce,Ge]);return ze}var Ye=Le;function nt(Ae){var Ce=Ae.className,Ge=Ae.children;return L.createElement("div",{className:Ce},Ge)}var qe=nt,it=W("n6Qo");function He(Ae){var Ce,Ge=Ae.prefixCls,ze=Ae.record,Re=Ae.onExpand,je=Ae.expanded,ge=Ae.expandable,de="".concat(Ge,"-row-expand-icon");if(!ge)return L.createElement("span",{className:F()(de,"".concat(Ge,"-row-spaced"))});var ce=function(ae){Re(ze,ae),ae.stopPropagation()};return L.createElement("span",{className:F()(de,(Ce={},Object(q.a)(Ce,"".concat(Ge,"-row-expanded"),je),Object(q.a)(Ce,"".concat(Ge,"-row-collapsed"),!je),Ce)),onClick:ce})}function $e(Ae,Ce,Ge){var ze=[];function Re(je){(je||[]).forEach(function(ge,de){ze.push(Ce(ge,de)),Re(ge[Ge])})}return Re(Ae),ze}var Qe=W("zT1h"),gt=W("y0+3"),et=function(Ce,Ge){var ze,Re,je=Ce.scrollBodyRef,ge=Ce.onScroll,de=Ce.offsetScroll,ce=L.useContext(n.a),re=ce.prefixCls,ae=((ze=je.current)===null||ze===void 0?void 0:ze.scrollWidth)||0,ue=((Re=je.current)===null||Re===void 0?void 0:Re.clientWidth)||0,fe=ae&&ue*(ue/ae),be=L.useRef(),Ie=he({scrollLeft:0,isHiddenScrollBar:!1}),Xe=Object(U.a)(Ie,2),ut=Xe[0],bt=Xe[1],ft=L.useRef({delta:0,x:0}),at=L.useState(!1),Be=Object(U.a)(at,2),We=Be[0],Me=Be[1],se=function(){Me(!1)},ve=function(Te){Te.persist(),ft.current.delta=Te.pageX-ut.scrollLeft,ft.current.x=0,Me(!0),Te.preventDefault()},Ke=function(Te){var ke,rt=Te||((ke=window)===null||ke===void 0?void 0:ke.event),Ct=rt.buttons;if(!We||Ct===0){We&&Me(!1);return}var At=ft.current.x+Te.pageX-ft.current.x-ft.current.delta;At<=0&&(At=0),At+fe>=ue&&(At=ue-fe),ge({scrollLeft:At/ue*(ae+2)}),ft.current.x=Te.pageX},Pe=function(){var Te=Object(gt.b)(je.current).top,ke=Te+je.current.offsetHeight,rt=document.documentElement.scrollTop+window.innerHeight;ke-Object(u.a)()<=rt||Te>=rt-de?bt(function(Ct){return Object(V.a)(Object(V.a)({},Ct),{},{isHiddenScrollBar:!0})}):bt(function(Ct){return Object(V.a)(Object(V.a)({},Ct),{},{isHiddenScrollBar:!1})})},st=function(Te){bt(function(ke){return Object(V.a)(Object(V.a)({},ke),{},{scrollLeft:Te/ae*ue||0})})};return L.useImperativeHandle(Ge,function(){return{setScrollLeft:st}}),L.useEffect(function(){var dt=Object(Qe.a)(document.body,"mouseup",se,!1),Te=Object(Qe.a)(document.body,"mousemove",Ke,!1);return Pe(),function(){dt.remove(),Te.remove()}},[fe,We]),L.useEffect(function(){var dt=Object(Qe.a)(window,"scroll",Pe,!1),Te=Object(Qe.a)(window,"resize",Pe,!1);return function(){dt.remove(),Te.remove()}},[]),L.useEffect(function(){ut.isHiddenScrollBar||bt(function(dt){var Te,ke;return Object(V.a)(Object(V.a)({},dt),{},{scrollLeft:je.current.scrollLeft/((Te=je.current)===null||Te===void 0?void 0:Te.scrollWidth)*((ke=je.current)===null||ke===void 0?void 0:ke.clientWidth)})})},[ut.isHiddenScrollBar]),ae<=ue||!fe||ut.isHiddenScrollBar?null:L.createElement("div",{style:{height:Object(u.a)(),width:ue,bottom:de},className:"".concat(re,"-sticky-scroll")},L.createElement("div",{onMouseDown:ve,ref:be,className:F()("".concat(re,"-sticky-scroll-bar"),Object(q.a)({},"".concat(re,"-sticky-scroll-bar-active"),We)),style:{width:"".concat(fe,"px"),transform:"translate3d(".concat(ut.scrollLeft,"px, 0, 0)")}}))},tt=L.forwardRef(et);function Je(Ae,Ce){return L.useMemo(function(){var Ge=!!Ae;return{isSticky:Ge,stickyClassName:Ge?"".concat(Ce,"-sticky-header"):"",offsetHeader:Object(z.a)(Ae)==="object"&&Ae.offsetHeader||0,offsetScroll:Object(z.a)(Ae)==="object"&&Ae.offsetScroll||0}},[Ae,Ce])}var vt=[],wt={},Et="rc-table-internal-hook",xt=L.memo(function(Ae){var Ce=Ae.children;return Ce},function(Ae,Ce){return I()(Ae.props,Ce.props)?Ae.pingLeft!==Ce.pingLeft||Ae.pingRight!==Ce.pingRight:!1});function kt(Ae){var Ce,Ge=Ae.prefixCls,ze=Ae.className,Re=Ae.rowClassName,je=Ae.style,ge=Ae.data,de=Ae.rowKey,ce=Ae.scroll,re=Ae.tableLayout,ae=Ae.direction,ue=Ae.title,fe=Ae.footer,be=Ae.summary,Ie=Ae.id,Xe=Ae.showHeader,ut=Ae.components,bt=Ae.emptyText,ft=Ae.onRow,at=Ae.onHeaderRow,Be=Ae.internalHooks,We=Ae.transformColumns,Me=Ae.internalRefs,se=Ae.sticky,ve=ge||vt,Ke=!!ve.length,Pe=L.useState(0),st=Object(U.a)(Pe,2),dt=st[0],Te=st[1];L.useEffect(function(){Te(Object(u.a)())});var ke=L.useMemo(function(){return Object(O.c)(ut,{})},[ut]),rt=L.useCallback(function(En,hn){return Object(O.b)(ke,En)||hn},[ke]),Ct=L.useMemo(function(){return typeof de=="function"?de:function(En){var hn=En&&En[de];return hn}},[de]),At=Object(v.c)(Ae),cn=At.expandIcon,yn=At.expandedRowKeys,en=At.defaultExpandedRowKeys,Dt=At.defaultExpandAllRows,Rn=At.expandedRowRender,Fn=At.onExpand,Cn=At.onExpandedRowsChange,Qt=At.expandRowByClick,Sn=At.rowExpandable,Bn=At.expandIconColumnIndex,li=At.expandedRowClassName,ct=At.childrenColumnName,St=At.indentSize,zn=cn||He,pi=ct||"children",ui=L.useMemo(function(){return Rn?"row":Ae.expandable&&Be===Et&&Ae.expandable.__PARENT_RENDER_ICON__||ve.some(function(En){return En&&Object(z.a)(En)==="object"&&En[pi]})?"nest":!1},[!!Rn,ve]),ki=L.useState(function(){return en||(Dt?$e(ve,Ct,pi):[])}),J=Object(U.a)(ki,2),w=J[0],T=J[1],j=L.useMemo(function(){return new Set(yn||w||[])},[yn,w]),ee=L.useCallback(function(En){var hn=Ct(En,ve.indexOf(En)),gn,gi=j.has(hn);gi?(j.delete(hn),gn=Object(M.a)(j)):gn=[].concat(Object(M.a)(j),[hn]),T(gn),Fn&&Fn(!gi,En),Cn&&Cn(gn)},[Ct,j,ve,Fn,Cn]),X=L.useState(0),ye=Object(U.a)(X,2),Ve=ye[0],ot=ye[1],ht=Object(Ee.b)(Object(V.a)(Object(V.a)(Object(V.a)({},Ae),At),{},{expandable:!!Rn,expandedKeys:j,getRowKey:Ct,onTriggerExpand:ee,expandIcon:zn,expandIconColumnIndex:Bn,direction:ae}),Be===Et?We:null),Ue=Object(U.a)(ht,2),mt=Ue[0],Rt=Ue[1],Mt=L.useMemo(function(){return{columns:mt,flattenColumns:Rt}},[mt,Rt]),Jt=L.useRef(),Tt=L.useRef(),qt=L.useRef(),Zt=L.useState(!1),Mn=Object(U.a)(Zt,2),Gt=Mn[0],wn=Mn[1],On=L.useState(!1),Ln=Object(U.a)(On,2),xn=Ln[0],In=Ln[1],Hn=he(new Map),ri=Object(U.a)(Hn,2),Vn=ri[0],_n=ri[1],jn=Object(O.a)(Rt),dn=jn.map(function(En){return Vn.get(En)}),pn=L.useMemo(function(){return dn},[dn.join("_")]),mn=Ye(pn,Rt.length,ae),zt=ce&&Object(O.d)(ce.y),yt=ce&&Object(O.d)(ce.x),Wt=yt&&Rt.some(function(En){var hn=En.fixed;return hn}),pt=L.useRef(),$t=Je(se,Ge),Nt=$t.isSticky,Xn=$t.offsetHeader,sn=$t.offsetScroll,Zn=$t.stickyClassName,Ki,Ci,Vi;zt&&(Ci={overflowY:"scroll",maxHeight:ce.y}),yt&&(Ki={overflowX:"auto"},zt||(Ci={overflowY:"hidden"}),Vi={width:ce.x===!0?"auto":ce.x,minWidth:"100%"});var Ni=L.useCallback(function(En,hn){_n(function(gn){var gi=new Map(gn);return gi.set(En,hn),gi})},[]),Ri=oe(null),Gi=Object(U.a)(Ri,2),Kn=Gi[0],Ht=Gi[1];function Xi(En,hn){if(!hn)return;typeof hn=="function"?hn(En):hn.scrollLeft!==En&&(hn.scrollLeft=En)}var _i=function(hn){var gn=hn.currentTarget,gi=hn.scrollLeft,Qi=typeof gi=="number"?gi:gn.scrollLeft,qi=gn||wt;if(!Ht()||Ht()===qi){var ir;Kn(qi),Xi(Qi,Tt.current),Xi(Qi,qt.current),Xi(Qi,(ir=pt.current)===null||ir===void 0?void 0:ir.setScrollLeft)}if(gn){var Tr=gn.scrollWidth,on=gn.clientWidth;wn(Qi>0),In(Qi<Tr-on)}},nr=function(){qt.current&&_i({currentTarget:qt.current})},Ft=function(hn){var gn=hn.width;nr(),ot(Jt.current?Jt.current.offsetWidth:gn)};L.useEffect(function(){return nr},[]),L.useEffect(function(){yt&&nr()},[yt]),L.useEffect(function(){Be===Et&&Me&&(Me.body.current=qt.current)});var Xt=rt(["table"],"table"),Kt=L.useMemo(function(){return re||(Wt?ce.x==="max-content"?"auto":"fixed":zt||Rt.some(function(En){var hn=En.ellipsis;return hn})?"fixed":"auto")},[zt,Wt,Rt,re]),tn,rn={colWidths:pn,columCount:Rt.length,stickyOffsets:mn,onHeaderRow:at,fixHeader:zt},Tn=L.useMemo(function(){return Ke?null:typeof bt=="function"?bt():bt},[Ke,bt]),ln=L.createElement(pe,{data:ve,measureColumnWidth:zt||yt||Nt,expandedKeys:j,rowExpandable:Sn,getRowKey:Ct,onRow:ft,emptyNode:Tn,childrenColumnName:pi}),Un=L.createElement(c,{colWidths:Rt.map(function(En){var hn=En.width;return hn}),columns:Rt}),ai=be&&L.createElement(it.b,null,be(ve)),nn=rt(["body"]);if(zt||Nt){var bi;typeof nn=="function"?(bi=nn(ve,{scrollbarSize:dt,ref:qt,onScroll:_i}),rn.colWidths=Rt.map(function(En,hn){var gn=En.width,gi=hn===mt.length-1?gn-dt:gn;return typeof gi=="number"&&!Number.isNaN(gi)?gi:(Object(g.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):bi=L.createElement("div",{style:Object(V.a)(Object(V.a)({},Ki),Ci),onScroll:_i,ref:qt,className:F()("".concat(Ge,"-body"))},L.createElement(Xt,{style:Object(V.a)(Object(V.a)({},Vi),{},{tableLayout:Kt})},Un,ln,ai),Nt&&L.createElement(tt,{ref:pt,offsetScroll:sn,scrollBodyRef:qt,onScroll:_i})),tn=L.createElement(L.Fragment,null,Xe!==!1&&L.createElement(_,Object.assign({noData:!ve.length},rn,Mt,{direction:ae,offsetHeader:Xn,stickyClassName:Zn,ref:Tt,onScroll:_i})),bi)}else tn=L.createElement("div",{style:Object(V.a)(Object(V.a)({},Ki),Ci),className:F()("".concat(Ge,"-content")),onScroll:_i,ref:qt},L.createElement(Xt,{style:Object(V.a)(Object(V.a)({},Vi),{},{tableLayout:Kt})},Un,Xe!==!1&&L.createElement(b,Object.assign({},rn,Mt)),ln,ai));var bn=Object(v.b)(Ae),Qn=L.createElement("div",Object.assign({className:F()(Ge,ze,(Ce={},Object(q.a)(Ce,"".concat(Ge,"-rtl"),ae==="rtl"),Object(q.a)(Ce,"".concat(Ge,"-ping-left"),Gt),Object(q.a)(Ce,"".concat(Ge,"-ping-right"),xn),Object(q.a)(Ce,"".concat(Ge,"-layout-fixed"),re==="fixed"),Object(q.a)(Ce,"".concat(Ge,"-fixed-header"),zt),Object(q.a)(Ce,"".concat(Ge,"-fixed-column"),Wt),Object(q.a)(Ce,"".concat(Ge,"-scroll-horizontal"),yt),Object(q.a)(Ce,"".concat(Ge,"-has-fix-left"),Rt[0]&&Rt[0].fixed),Object(q.a)(Ce,"".concat(Ge,"-has-fix-right"),Rt[Rt.length-1]&&Rt[Rt.length-1].fixed==="right"),Ce)),style:je,id:Ie,ref:Jt},bn),L.createElement(xt,{pingLeft:Gt,pingRight:xn,props:Object(V.a)(Object(V.a)({},Ae),{},{stickyOffsets:mn,mergedExpandedKeys:j})},ue&&L.createElement(qe,{className:"".concat(Ge,"-title")},ue(ve)),L.createElement("div",{className:"".concat(Ge,"-container")},tn),fe&&L.createElement(qe,{className:"".concat(Ge,"-footer")},fe(ve))));yt&&(Qn=L.createElement(f.a,{onResize:Ft},Qn));var qn=L.useMemo(function(){return{prefixCls:Ge,getComponent:rt,scrollbarSize:dt,direction:ae,fixedInfoList:Rt.map(function(En,hn){return h(hn,hn,Rt,mn,ae)}),isSticky:Nt}},[Ge,rt,dt,ae,Rt,mn,ae,Nt]),mi=L.useMemo(function(){return Object(V.a)(Object(V.a)({},Mt),{},{tableLayout:Kt,rowClassName:Re,expandedRowClassName:li,componentWidth:Ve,fixHeader:zt,fixColumn:Wt,horizonScroll:yt,expandIcon:zn,expandableType:ui,expandRowByClick:Qt,expandedRowRender:Rn,onTriggerExpand:ee,expandIconColumnIndex:Bn,indentSize:St})},[Mt,Kt,Re,li,Ve,zt,Wt,yt,zn,ui,Qt,Rn,ee,Bn,St]),Wr=L.useMemo(function(){return{onColumnResize:Ni}},[Ni]);return L.createElement(n.a.Provider,{value:qn},L.createElement(N.Provider,{value:mi},L.createElement(Q.Provider,{value:Wr},Qn)))}kt.Column=s.a,kt.ColumnGroup=d.a,kt.Summary=it.a,kt.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var Ot=Se.b=kt},wRmb:function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return I});var q=W("rePB"),V=W("KQm4"),M=W("VTBJ"),z=W("Ff2n"),U=W("q1tI"),L=W.n(U),H=W("Kwbf"),F=W("Zm9Q"),D=W("hW8S");function I(s){return Object(F.a)(s).filter(function(l){return U.isValidElement(l)}).map(function(l){var r=l.key,a=l.props,n=a.children,h=Object(z.a)(a,["children"]),O=Object(M.a)({key:r},h);return n&&(O.children=I(n)),O})}function g(s){return s.reduce(function(l,r){var a=r.fixed,n=a===!0?"left":a,h=r.children;return h&&h.length>0?[].concat(Object(V.a)(l),Object(V.a)(g(h).map(function(O){return Object(M.a)({fixed:n},O)}))):[].concat(Object(V.a)(l),[Object(M.a)(Object(M.a)({},r),{},{fixed:n})])},[])}function f(s){for(var l=!0,r=0;r<s.length;r+=1){var a=s[r];if(l&&a.fixed!=="left")l=!1;else if(!l&&a.fixed==="left"){Object(H.a)(!1,"Index ".concat(r-1," of `columns` missing `fixed='left'` prop."));break}}for(var n=!0,h=s.length-1;h>=0;h-=1){var O=s[h];if(n&&O.fixed!=="right")n=!1;else if(!n&&O.fixed==="right"){Object(H.a)(!1,"Index ".concat(h+1," of `columns` missing `fixed='right'` prop."));break}}}function u(s){return s.map(function(l){var r=l.fixed,a=Object(z.a)(l,["fixed"]),n=r;return r==="left"?n="right":r==="right"&&(n="left"),Object(M.a)({fixed:n},a)})}function d(s,l){var r=s.prefixCls,a=s.columns,n=s.children,h=s.expandable,O=s.expandedKeys,S=s.getRowKey,x=s.onTriggerExpand,A=s.expandIcon,C=s.rowExpandable,b=s.expandIconColumnIndex,v=s.direction,p=s.expandRowByClick,c=U.useMemo(function(){return a||I(n)},[a,n]),E=U.useMemo(function(){if(h){var P,N=b||0,K=c[N],$=(P={},Object(q.a)(P,D.a,{className:"".concat(r,"-expand-icon-col")}),Object(q.a)(P,"title",""),Object(q.a)(P,"fixed",K?K.fixed:null),Object(q.a)(P,"className","".concat(r,"-row-expand-icon-cell")),Object(q.a)(P,"render",function(G,Q,ne){var le=S(Q,ne),_e=O.has(le),pe=C?C(Q):!0,Ee=A({prefixCls:r,expanded:_e,expandable:pe,record:Q,onExpand:x});return p?U.createElement("span",{onClick:function(we){return we.stopPropagation()}},Ee):Ee}),P),B=c.slice();return N>=0&&B.splice(N,0,$),B}return c},[h,c,S,O,A,v]),y=U.useMemo(function(){var P=E;return l&&(P=l(P)),P.length||(P=[{render:function(){return null}}]),P},[l,E,v]),_=U.useMemo(function(){return v==="rtl"?u(g(y)):g(y)},[y,v]);return[y,_]}Se.b=d},"y0+3":function(Fe,Se,W){"use strict";W.d(Se,"a",function(){return g}),W.d(Se,"b",function(){return u});var q=/margin|padding|width|height|max|min|offset/,V={left:!0,top:!0},M={cssFloat:1,styleFloat:1,float:1};function z(d){return d.nodeType===1?d.ownerDocument.defaultView.getComputedStyle(d,null):{}}function U(d,s,l){if(s=s.toLowerCase(),l==="auto"){if(s==="height")return d.offsetHeight;if(s==="width")return d.offsetWidth}return s in V||(V[s]=q.test(s)),V[s]?parseFloat(l)||0:l}function L(d,s){var l=arguments.length,r=z(d);return s=M[s]?"cssFloat"in d.style?"cssFloat":"styleFloat":s,l===1?r:U(d,s,r[s]||d.style[s])}function H(d,s,l){var r=arguments.length;if(s=M[s]?"cssFloat"in d.style?"cssFloat":"styleFloat":s,r===3)return typeof l=="number"&&q.test(s)&&(l="".concat(l,"px")),d.style[s]=l,l;for(var a in s)s.hasOwnProperty(a)&&H(d,a,s[a]);return z(d)}function F(d){return d===document.body?document.documentElement.clientWidth:d.offsetWidth}function D(d){return d===document.body?window.innerHeight||document.documentElement.clientHeight:d.offsetHeight}function I(){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),s=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:d,height:s}}function g(){var d=document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return{width:d,height:s}}function f(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function u(d){var s=d.getBoundingClientRect(),l=document.documentElement;return{left:s.left+(window.pageXOffset||l.scrollLeft)-(l.clientLeft||document.body.clientLeft||0),top:s.top+(window.pageYOffset||l.scrollTop)-(l.clientTop||document.body.clientTop||0)}}},ynwM:function(Fe,Se,W){var q=W("MFOe"),V=q.Global;Fe.exports={name:"oldFF-globalStorage",read:z,write:U,each:L,remove:H,clearAll:F};var M=V.globalStorage;function z(D){return M[D]}function U(D,I){M[D]=I}function L(D){for(var I=M.length-1;I>=0;I--){var g=M.key(I);D(M[g],g)}}function H(D){return M.removeItem(D)}function F(){L(function(D,I){delete M[D]})}}}]);
|